设为首页 加入收藏

TOP

nagios使用check_mysql监控mysql
2014-11-24 03:24:04 来源: 作者: 【 】 浏览:0
Tags:nagios 使用 check_mysql 监控 mysql

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
}
感谢秋香老师,你的书给了我很大帮助。

本文出自 “潜入技术的海洋” 博客

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇NoSql--Mongodb简介 下一篇mysql command line client打不开..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·MySQL 安装及连接-腾 (2025-12-25 06:20:28)
·MySQL的下载、安装、 (2025-12-25 06:20:26)
·MySQL 中文网:探索 (2025-12-25 06:20:23)
·Shell脚本:Linux Sh (2025-12-25 05:50:11)
·VMware虚拟机安装Lin (2025-12-25 05:50:08)