#被监控端
- mysql> create database test;
- mysql> grant select on test.* to 'nagiosmysql'@'%';
- mysql> flush privileges;
#监控端
- [root@cacti libexec]#/usr/local/nagios/libexec/check_mysql -H192.168.0.13 -unagiosmysql -d test
- Uptime: 591432 Threads: 3 Questions: 2957867 Slow queries: 12 Opens: 3063 Flush tables: 1 Open tables: 64 Queries per second avg: 5.1
- -------------------------------------------------------------------------------
- [root@cacti objects]# 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
- }
- [root@cacti objects]# checknagios
- [root@cacti objects]# service nagios restart