devil20 发表于 2019-1-15 13:03:43

nagios监控mysql状态

#被监控端



[*]mysql> create database test;
[*]mysql> grant select on test.* to 'nagiosmysql'@'%';
[*]mysql> flush privileges;

#监控端



[*]#/usr/local/nagios/libexec/check_mysql -H192.168.0.13 -unagiosmysql -d test
[*]Uptime: 591432Threads: 3Questions: 2957867Slow queries: 12Opens: 3063Flush tables: 1Open tables: 64Queries per second avg: 5.1
[*]-------------------------------------------------------------------------------
[*]
[*]#vi commands.cfg
[*]
[*]# check mysql
[*]define command{
[*]command_name check_mysql
[*]command_line $USER1$/check_mysql -H $HOSTADDRESS$ -unagiosmysql -d test
[*]}
[*]
[*]-------------------------------------------------------------------------------
[*]
[*]vi services.cfg
[*]define service{
[*]      host_name               155
[*]      service_description   mysql_status
[*]      check_command         check_mysql
[*]      max_check_attempts      2
[*]      normal_check_interval   3
[*]      retry_check_interval    2
[*]      check_period            24x7
[*]      notification_interval   10
[*]      notification_period   24x7
[*]      notification_options    w,u,c,r
[*]      contact_groups          admins
[*]      }
[*]
[*]# checknagios   
[*]# service nagios restart







页: [1]
查看完整版本: nagios监控mysql状态