《Nagios 监控redis,简单又实用》要点:
本文介绍了Nagios 监控redis,简单又实用,希望对您有用。如果有疑问,可以联系我们。
首先介绍下怎么安装:
脚本用到了perl的Redis库,需要先安装这个:
# perl -MCPAN -e shell
# install Redis
1.wget http://farmerluo.googlecode.com/files/check_redis.pl
2.cp check_redis.pl /etc/nagios/command/
3.chown cacti.nagios check_redis.pl
在nagios内加入这个插件:
1.vi /etc/nagios/objects/command.cfg
2.# 'check_redis' command definition
3.define command{
4.command_name check_redis
5.command_line /etc/nagios/command/check_redis.pl -h $HOSTADDRESS$ $ARG1$
6.}
加入一个服务:
vi /etc/nagios/objects/linuxhost.cfg
define service{
use generic-service ; Name of service template to use
host_name rcs
service_description redis
check_command check_redis
notifications_enabled 1
}
检查下nagios配置是否正解:
nagios -v /etc/nagios/nagios.cfg
define command {
command_name check_redis_new
command_line $USER1$/check_redis.pl -H $HOSTADDRESS$ -p $ARG1$ -T $ARG2$ -R -A -M $_HOSTSYSTEM_MEMORY$ -m $ARG3$ -a $ARG4$ -w $ARG5$ -c $ARG6$ -f -P "$SERVICEPERFDATA$"
}
define service {
use prod-service
hostgroups redishosts
service_description Redis
check_command check_redis_new!5666!"1,2"!"80,90"!blocked_clients,connected_clients!50,~!100,~
}
欢迎参与《Nagios 监控redis,简单又实用》讨论,分享您的想法,维易PHP学院为您提供专业教程。