Nagios监控Sphinx的indexer日志

时间:2025-11-04 19:15:53来源:极客码头作者:域名
Nagios监控Sphinx的indexer日志
复制#1.登上运行有sphinx的监控服务器上,下载脚本放到nagios的日志libexec目录下,例如: cd /usr/local/nagios/libexec/ wget http://down.chengyongxu.com/check_indexer_log # #2.改属主,b2b供应网监控加执行权限 chown nagios:nagios check_indexer_log chmod 755 check_indexer_log # #3.在nrpe.cfg文件中增加下边一行,日志参数根据你的监控需要修改 #----------------------------增加文字-开始---------------------------- command[check_indexer_log]=/usr/local/nagios/libexec/check_indexer_log #----------------------------增加文字-结束---------------------------- # #4.保存退出后重启nrpe service nrpe restart # #5.要主监控服务器上增加一个服务监控 #----------------------------增加文字-开始---------------------------- define service{ host_name 10.0.0.166 service_description check_indexer_log check_command check_nrpe!check_indexer_log max_check_attempts 3 check_interval 10 retry_interval 5 check_period 24x7 notification_interval 30 notification_period 24x7 notification_options w,u,c #contacts contacts(*) contact_groups sa_groups } #----------------------------增加文字-结束---------------------------- # #6.保存退出后重启nagios service nagios restart 插件贴出如下: #!/bin/bash LOG_DIR=/usr/local/sphinx/var/log UPDATE_TIME=40 # 上次改动时间最早的文件和其改动时间,香港云服务器格式为03-0317:25 FILE_A=`ls -t $LOG_DIR/*searchd.log | tail -n 1` TIME_A=`ls -tl $LOG_DIR/*searchd.log | tail -n 1 | awk {print $6$7}` # 要求的日志最近更新时间,格式为03-0317:25 TIME_B=`date +%m-%d%H:%M -d "$UPDATE_TIME min ago"` if [[ "$TIME_A" > "$TIME_B" ]] then echo "OK | All files changed in $UPDATE_TIME minutes" else echo "$FILE_A last update time is 监控$TIME_A" exit 2 fi1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.96.97.98.99.100.101.102.103.
相关内容