您好,欢迎访问一九零五行业门户网

nagios使用check_mysql监控mysql_MySQL

nagios
bitscn.com nagios监控mysql服务器:
1、建立专用数据库:
[root@svr3 ~]# /usr/local/webserver/mysql/bin/mysql -u root -p
enter password: 
welcome to the mysql monitor.  commands end with ; or /g.
your mysql connection id is 51910
server version: 5.5.3-m3-log source distribution
type 'help;' or '/h' for help. type '/c' to clear the current input statement.
mysql> create database nagios;
query ok, 1 row affected (0.00 sec)
mysql> grant select on nagios.* to nagios@'%' identified by '123qweasd';
query ok, 0 rows affected (0.00 sec)
mysql> flush privileges;
query ok, 0 rows affected (0.00 sec)
mysql> select user,password,host from user;
+----------------+-------------------------------------------+------------------+
| user           | password                                  | host             |
+----------------+-------------------------------------------+------------------+
| root           | *84bb5df4823da319bbf86c99624479a198e6eee9 | localhost        |
| nagios         | *a1f1cb851d62f002c09a0c9c4a76262473432f55 | %                |
+----------------+-------------------------------------------+------------------+
14 rows in set (0.00 sec)
12 rows in set (0.00 sec)
[root@svr3 ~]# /usr/local/nagios/libexec/check_mysql -h 10.1.1.30 -u nagios -d nagios -p 123qweasd
uptime: 970046  threads: 1  questions: 684583  slow queries: 3  opens: 672  flush tables: 1  open tables:
369  queries per second avg: 0.705
[root@svr4 nrpe_install]# /usr/local/nagios/libexec/check_mysql -h 10.1.1.30 -u nagios -d nagios -p 123qweasd
uptime: 970348  threads: 1  questions: 684584  slow queries: 3  opens: 672  flush tables: 1  open tables: 369  queries per second avg: 0.705
果断开始设置:
#定义用户
#定义组,及隶属用户
#用户增加
在command.cfg里增加插件命令:
#check mysql
define command{
command_name check_mysql
command_line $user1$/check_mysql -h $hostaddress$ -u nagios -d nagios -p 123qweasd
}
#定义服务:
define service {
        host_name svr3.labexam.com
        service_description mysqldb
        check_period 24x7
        max_check_attempts 2
        normal_check_interval 1
        retry_check_interval 1
        contact_groups sagroup,dbagroup
        notification_interval 5
        notification_period 24x7
        notification_options w,u,c,r
        check_command check_mysql
}
感谢秋香老师,你的书给了我很大帮助。
本文出自 “潜入技术的海洋” 博客
bitscn.com
其它类似信息

推荐信息