The line is monitored with Nagios and the version is the newest 4.0.8
Download the Redis plugin on the Nagios server
Page
Https://exchange.nagios.org/directory/Plugins/Databases/check_redis-2Epl/details
Download check_redis.pl file
Installing the Perl Redis Environment
[Email protected] ~]# yum install-y perl-cpan perl-time-hires perl-yaml
[[email protected] ~]# perl-mcpan-e Shell
cpan> Install Redis
After encountering the [Yes] location, all the way to the return, you need to install a lot of components.
I spent more than 2-3 hours, and kept the carriage return, finally installed.
Place the check_redis.pl file in the/usr/local/nagios/libexec/directory
Set permissions
[Email protected] ~]#chmod 755 check_redis.pl
[Email protected] ~]#chown nagios:nagios check_redis.pl
Test Plug-ins
[Email protected] ~]#cd/usr/local/nagios/libexec/
[Email protected] ~]#/check_redis.pl-h 10.168.13.230-p 6379
Ok:redis 2.8.19 on 10.168.13.230:6380 have 1 databases (DB0) with + keys, up 98 days 7 hours
Testing the time to connect to Redis
./check_redis.pl-h 10.168.13.230-p 6379-t 0.5,1
Test CPU
./check_redis.pl-h 10.168.13.230-p 6379-a ' Used_cpu_sys,used_cpu_user,used_cpu_user_children,used_cpu_sys_ Children '-W ~,~,~,~-C ~,~,~,~
Test memory
./check_redis.pl-h 10.168.13.230-p 6379-a ' Used_memory_human,used_memory_peak_human '-w ~,~-C ~,~
Test the number of connections
./check_redis.pl-h 10.168.13.230-p 6379-a ' Connected_clients,blocked_clients,client_longest_output_list,client_ Biggest_input_buf '-W 100,5,~,~-C 500,10,~,~
Started to formally monitor with Nagios.
Edit File
Vi/usr/local/nagios/etc/objects/commands.cfg
The last line adds the following:
# Check Redis
Define Command {
Command_name Check_redis
Command_line $USER 1$/check_redis.pl-h $HOSTADDRESS $-P $ARG 1$-a $ARG 2$-W $ARG 3$-C $ARG 4$-F
}
# Check Redis
Define Command {
Command_name Check_redis_conn_time
Command_line $USER 1$/check_redis.pl-h $HOSTADDRESS $-P $ARG 1$-T $ARG 2$
}
Edit Host File
At the end, add the following:
Define Service{
Use Generic-service
HOST_NAME Redis_1
Service_description REDIS_6379_CPU
Check_command check_redis!6379! ' Used_cpu_sys,used_cpu_user,used_cpu_sys_children,used_cpu_user_children '!~,~,~,~!~,~,~,~
}
Define Service{
Use Generic-service
HOST_NAME Redis_1
Service_description redis_6379_memory
Check_command check_redis!6379! ' Used_memory_human,used_memory_peak_human '!~,~!~,~
}
Define Service{
Use Generic-service
HOST_NAME Redis_1
Service_description redis_6379_memory
Check_command
check_redis!6379! ' Connected_clients,blocked_clients,client_longest_output_list,client_biggest_input_buf '!100,5,~,~!500,10,~,~
}
Define Service{
Use Generic-service
HOST_NAME Redis_1
Service_description Redis_6379_conn_number
Check_command check_redis!6379! ' Connected_clients,blocked_clients,client_longest_output_list,client_biggest_input_buf '!100,5,~,~!500,10,~,~
}
Define Service{
Use Generic-service
HOST_NAME Redis_1
Service_description Redis_6379_conn_time
Check_command check_redis_conn_time!6379!0.5,1
}
Restart Nagios
/etc/init.d/nagios restart
This article is from the "Falling Star" blog, make sure to keep this source http://xiao987334176.blog.51cto.com/2202382/1669330
Nagios Monitoring Redis