Nagios uses check_mysql to monitor mysql Nagios
BitsCN.com
Nagios monitoring mysql server:
1. create a dedicated database:
[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 123 qweasd
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 123 qweasd
Uptime: 970348 Threads: 1 Questions: 684584 Slow queries: 3 Opens: 672 Flush tables: 1 Open tables: 369 Queries per second avg: 0.705
Start setting decisively:
# Define a user
# Define a group and its affiliated users
# Adding users
Add the plug-in command. cfg:
# Check mysql
Define command {
Command_name check_mysql
Command_line $ USER1 $/check_mysql-H $ HOSTADDRESS $-u nagios-d nagios-p 123 qweasd
}
# Define a service:
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
Icationication_interval 5
Icationication_period 24x7
Notification_options w, u, c, r
Check_command check_mysql
}
Thank you, Miss Qiu Xiang. Your book has helped me a lot.
This article is from the "diving into the ocean of technology" blog
BitsCN.com