nagios check_mysql uptime_nagios使用check_mysql监控mysql

如果没有check_mysql插件,需要安装Mysql数据库

1、建立专用数据库: [root@svr3 ~]#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)

2.测试check_mysql

[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 3.在command.cfg里增加插件命令: #check mysql define command{ command_name check_mysql command_line $USER1$/check_mysql -H $HOSTADDRESS$ -u nagios -d nagios -p 123qweasd }  4.在localhost.cfg里定义服务 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 }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值