Nagios monitoring MySQL error: NRPE: Unabletoreadoutput detailed Solution Process

Source: Internet
Author: User
On the nagios page, the following error is displayed: Warning: NRPE: Unabletoreadoutput1. Go to the nagios monitoring server and check 1.1.

On the nagios page, the following error is displayed: Warning: NRPE: Unable to read output1. Go to the nagios monitoring server and check 1.1.

On the nagios page, the following error message is displayed:

Warning: NRPE: Unable to read output

1. Go to the nagios monitoring server and check

1.1. Execute the check_nrpe command to remotely call

On the nagios server on the monitoring side, the following error is returned when performing check_nrpe to check the mysql status:

[Root @ mysqlvm2 ~] #/Usr/lib/nagios/plugins/check_nrpe-H192.xx. 180.xx-c check_mysql_status

NRPE: Unable to read output

You have new mail in/var/spool/mail/root

[Root @ mysqlvm2 ~] #

1.2. check other check services.

Check other monitoring metrics such as check_users on the nagios server. The normal conditions are as follows:

[Root @ mysqlvm2 ~] #/Usr/lib/nagios/plugins/check_nrpe-H192.xx. 180.xx-c check_users

Users OK-2 users currently logged in | users = 2; 8; 15; 0

[Root @ mysqlvm2 ~] #

It is proved that the nagios process is normal and other monitoring items such as check_users can be detected. However, if the check_mysql fault reports an error, you still need to go to the mysql server to analyze the problem.

2. check the mysql server on the monitored end

2.1. when calling the local check_nrpe service, the same error is reported as follows:

[Root @ mysqldb ~] #/Usr/lib/nagios/plugins/check_nrpe-Hlocalhost-c check_mysql_status

NRPE: Unable to read output

[Root @ mysqldb ~] #

Run the check_mysql_status command in/etc/nagios/nrpe. cfg.

First use cat to find the check_mysql command line

[Root @ mysqldb ~] # Cat/etc/nagios/nrpe. cfg | grep check_mysql_status

Command [check_mysql_status] =/usr/bin/sudo/usr/lib/nagios/plugins/check_mysql-unagios-P3306-s/usr/local/mysql. sock-Hlocalhost -- password = 'nagiosq @ 0512 '-d test

Run the command. The result is displayed as follows:

[Root @ mysqldb ~] #/Usr/bin/sudo/usr/lib/nagios/plugins/check_mysql-unagios-P3306-s/usr/local/mysql. sock-Hlocalhost -- password = 'nagiosq @ 0512 '-d test

Uptime: 1122870 Threads: 108 Questions: 11559152 Slow queries: 1278 Opens: 3190 Flush tables: 1 Open tables: 395 Queries per second avg: 10.294 | Connections = 844188c ;;; open_files = 49; Open_tables = 395; Qcache_free_memory = 209024; Qcache_hits = 51724c; Qcache_inserts = 73877c; Signature = 5599c ;;; qcache_not_cached = 2572345c; Queries = 1985; Queries = 11559153c; Questions = 41524833c; Table_locks_waited = 0c; Threads_connected = 107 ;;; threads_running = 2; Uptime = bytes 2870c ;;;

[Root @ mysqldb ~] #

The check_mysql script is normal.

2.2. Check the execution permission of check_mysql.

[Root @ mysqldb ~] # Ll/usr/lib/nagios/plugins/check_mysql

-Rwxrwxr-x. 1 root 168272 July 8 14:54/usr/lib/nagios/plugins/check_mysql

[Root @ mysqldb ~] #

The last x indicates that you have the execution permission. Run sudo to the nagios account to check whether it can be executed, as shown below:

[Root @ mysqldb ~] # Su-nagios

-Bash-4.1 $/usr/lib/nagios/plugins/check_mysql-unagios-P3306-s/usr/local/mysql. sock-Hlocalhost -- password = 'nagiosq @ 0512 '-d test

Uptime: 1124403 Threads: 106 Questions: 11586454 Slow queries: 1278 Opens: 3190 Flush tables: 1 Open tables: 395 Queries per second avg: 10.304 | Connections = 846235c ;;; open_files = 49; Open_tables = 395; Qcache_free_memory = 211696; Qcache_hits = 51786c; Qcache_inserts = 73915c; Signature = 5732c ;;; qcache_not_cached = 2578541c; Queries = 1890; Queries = 11586455c; Questions = 10750088c; Table_locks_waited = 0c; Threads_connected = 105 ;;; threads_running = 2; Uptime = 1124403c ;;;

-Bash-4.1 $

It indicates that both the naigos account and the check_mysql script can be executed. The check_mysql script path and the execution permission are correct.

2.3. Check the nagios permission configuration in sudo.

The running principle of Nagios remote call is to execute all the check_xxx scripts through the nagios account, but my nrpe client is installed with the root account, so the check_xxx script is also owned by the root user, does nagios execute su-root by default during Remote calls and then execute the check_msyql script command? Modify the sudo configuration, comment out Defaults requiretty, and add a line of nagios ALL = (ALL) NOPASSWD:/usr/lib/nagios/plugins/check_mysql,

Vim/etc/sudoers


# No terminal control is required

# Defaults requiretty

# Indicates that the password is not required to run the check_mysql command using the nagios Command.

Nagios ALL = (ALL) NOPASSWD:/usr/lib/nagios/plugins/check_mysql

After modification, wq! Force save and exit vim edit, and then perform the check_npre operation check. The operation has returned to normal as follows:

[Root @ mysqldb ~] #/Usr/lib/nagios/plugins/check_nrpe-Hlocalhost-c check_mysql_status

Uptime: 1123659 Threads: 110 Questions: 11573270 Slow queries: 1278 Opens: 3190 Flush tables: 1 Open tables: 395 Queries per second avg: 10.299 | Connections = 845248c ;;; open_files = 49; Open_tables = 395; Qcache_free_memory = 227704; Qcache_hits = 51751c; Qcache_inserts = 73892c; Signature = 5656c ;;; qcache_not_cached = 2575554c; bytes = 1943; Queries = 11573271c; Questions = 41537891c; Table_locks_waited = 0c; Threads_connected = 109 ;;; threads_running = 2; Uptime = running 3659c ;;;

Go to the nagios server and run the check_nrpe check. The check result is as follows:

[Root @ mysqlvm2 ~] #/Usr/lib/nagios/plugins/check_nrpe-H192.xx. 180.xx-c check_mysql_status

Uptime: 1123673 Threads: 110 Questions: 11573464 Slow queries: 1278 Opens: 3190 Flush tables: 1 Open tables: 395 Queries per second avg: 10.299 | Connections = 845264c ;;; open_files = 49; Open_tables = 395; Qcache_free_memory = 227704; Qcache_hits = 51751c; Qcache_inserts = 73892c; Signature = 5656c ;;; qcache_not_cached = 2575596c; bytes = 1943; Queries = 11573465c; Questions = 10738069c; Table_locks_waited = 0c; Threads_connected = 109 ;;; threads_running = 2; Uptime = running 3C ;;;

[Root @ mysqlvm2 ~] #

2.4. Go to the nagios monitoring page and check that the mysql options have been restored, as shown in:

3. Additional reasons

There are many causes of errors caused by NRPE: Unable to read output. The following are some other causes for google:

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.