Nagios uses check_mysql to monitor mysql

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.