温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

nagios中如何使用check_mysql监控mysql

发布时间:2021-08-04 17:36:40 来源:亿速云 阅读:135 作者:Leah 栏目:数据库

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  identified by '123qweasd';
Query OK, 0 rows affected (0.00 sec)
 
> 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
}

看完上述内容,你们掌握nagios中如何使用check_mysql监控mysql的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI