Description of the Check_mysql_query plugin that comes with Nagios

Source: Internet
Author: User

If you have MySQL installed in your system, when you install Nagios plugins, there will be 2 plug-ins check_mysql and check_mysql_query to monitor MySQL. Which Check_mysql needless to say that the use of the most, can be used to monitor the running state of MySQL, including the status of Master-slave replication, the usual use is also more, remember to find a good Nagios default plugin introduction Inside there are detailed instructions, need to see:/http jim123.blog.51cto.com/4763600/1955618, but there is a default plug-in Check_mysql_query, its overall parameters are similar to Check_mysql, but there is one:

-Q,--query=string SQL query to run. Only first column in first row would be read

Many people do not have a more detailed explanation of it, and the official Help information is written too simple, and the explanation that is seen from it is a bit confusing: Read the first column of the first row. Generally we go to the SQL will have a lot of information, it can only read the first row of the contents of the first column? In fact, it is used to return the number of records in a table in a SQL query to verify that there are N records in the table, and if the values of warning and critical are defined, alarms when the number of record bars is large or equal, for example:

There are a total of 7 users in the MySQL used and can get results by querying the system table Mysql.user

Mysql> SELECT COUNT (1) from mysql.user;+----------+|        COUNT (1) |+----------+| 7 |+----------+1 row in Set (0.00 sec)

Note that you must use super users here, or you will not see the mysql.user table, the definition of the MySQL database used can only have up to 7 users, when the 8th user to send an alarm, so use:

[Email protected] libexec]#./check_mysql_query-h localhost-u root-p ' youpassword '-Q ' select COUNT (1) from Mysql.use R; "-W 8

This will send an alarm message when a 8th user is created in MySQL.

In summary, Nagios's Check_mysql_query plugin is used to monitor the number of records in a table, such as a user table or error information table, for a more constant number of records, However, if you want to further monitor the MySQL table information can be done by self-written script or the official Perl script Check_mysql_health.

This article from "Jim's Technical Essay" blog, declined to reprint!

Description of the Check_mysql_query plugin that comes with Nagios

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.