-2

I have 2 centos server

Server 1 - centos 6.8

Server 2 - centos 6.7

Originaly I had the issue on Server 1 but was able to fix the issue I had with the fix explained here

NRPE unable to read output, but why?

When I try to the same fix on Server 2 i get the following error as explained in the above link.

root@server2 [/usr/local/nagios/libexec]# ./check_nrpe -H 127.0.0.1 -c check_exim
NRPE: Unable to read output

But if I run the command locally it works

root@server2 [/usr/local/nagios/libexec]#
/usr/local/nagios/libexec/check_exim_queue -c 20 -w 40 Mailqueue OK -
0 messages on queue

So to test I ran it as the user itself and it works

nagios@cloud-03 [/usr/local/nagios/libexec]# sudo /usr/local/nagios/libexec/check_exim_queue -c 20 -w 40
Mailqueue OK - 0 messages on queue

Any ideas will help

2 Answers2

0

Enable debug in nrpe agent

From:https://assets.nagios.com/downloads/nagioscore/docs/nrpe/NRPE.pdf

How to go about debugging other problems... When debugging problems it may be useful to edit the NRPE configuration file and change the debug=0 entry to debug=1. Once you do that, restart the NRPE daemon if it is running as a standalone daemon. After you try using the check_nrpe plugin again, you should be able to see some debugging information in the log files of the remote host. Check your logs carefully – they should be able to help provide clues as to where the problem lies...

NoNoNo
  • 1,999
  • 15
  • 21
0

I was able to find the issue. The problem was with the check_mailq plugin. So after digging a bit and looking at it I was able to fix it.

The fix was adding the sudo command withing the script.

BEFORE

elsif ( $mailq eq "exim" ) {
        ## open mailq
        if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
                if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) )

After

elsif ( $mailq eq "exim" ) {
        ## open mailq
        if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
                if (! open (MAILQ, "/usr/bin/sudo $utils::PATH_TO_MAILQ | " ) )

So after making that change

    root@server2 [/usr/local/nagios/libexec]# ./check_nrpe -H 127.0.0.1 -c check_exim    
OK: mailq (0) is below threshold (20/40)|unsent=0;20;40;0

Thanks for the help