Question

getting error "NRPE: Unable to read output"

Posted February 4, 2021 884 views
MonitoringInfrastructure

I am using nagios for monitoring my infrastructure. the nagios server is on OEL 7 whereas the client is OEL 6. After setting up both the servers, i’m getting error “NRPE: Unable to read output”. The port 5666 is open from client. I am able connect the client as well using command “/usr/local/nagios/libexec/checknrpe -H <IPAddress>” and getting the output as well.

please help!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there @joshimithilesh02,

There is a good article on the Nagios website with steps on how to troubleshoot that error:

https://support.nagios.com/kb/article/nrpe-nrpe-unable-to-read-output-620.html

In most cases, I believe that it is the plugin that requires sudo privileges. To allow that you could use the visudo command and add the following:

nagios   ALL = NOPASSWD:/usr/local/nagios/libexec/<plugin>

Let me know how it goes!
Regards,
Bobby

  • Hi Bobby,

    Thanks for replying. I tried the above solution but it didn’t work.

    I hit command “/usr/local/nagios/libexec/checknrpe -H x.x.x.x -c checkusers” and got same error “NRPE: Unable to read output”.
    after running above command, i check the messages in client server and found the following error “audispd: node=node2 type=USER_AUTH msg=audit(1612799167.089:3007461): pid=15621 uid=497 auid=4294967295 ses=4294967295 msg=‘op=PAM:authentication acct="nagios” exe=“/usr/bin/sudo” hostname=? addr=? terminal=? res=failed’ “ .

    Any idea?

    Thanks and Regards,
    Mithilesh Joshi

    • Hi there @joshimithilesh02,

      If you connect to your remote server, is the check_users plugin available:

      ls -l /usr/local/nagios/libexec/
      

      Regards,
      Bobby

      • Hi,

        Yes, It is available.

        libexec]# ll -lrth
        total 5.8M
        -rwxr-xr-x 1 nagios nagios 177K Feb  2 21:46 check_apt
        -rwxr-xr-x 1 nagios nagios 136K Feb  2 21:46 check_cluster
        -rwxr-xr-x 1 nagios nagios 192K Feb  2 21:46 check_disk
        -rwxr-xr-x 1 nagios nagios  86K Feb  2 21:46 check_dummy
        -rwxr-xr-x 1 nagios nagios 278K Feb  2 21:46 check_http
        -rwxr-xr-x 1 nagios nagios 157K Feb  2 21:46 check_load
        -rwxr-xr-x 1 nagios nagios 143K Feb  2 21:46 check_mrtg
        -rwxr-xr-x 1 nagios nagios 144K Feb  2 21:46 check_mrtgtraf
        -rwxr-xr-x 1 nagios nagios 181K Feb  2 21:46 check_ntp
        -rwxr-xr-x 1 nagios nagios 173K Feb  2 21:46 check_ntp_peer
        -rwxr-xr-x 1 nagios nagios 209K Feb  2 21:46 check_nwstat
        -rwxr-xr-x 1 nagios nagios 158K Feb  2 21:46 check_overcr
        -rwxr-xr-x 1 nagios nagios 181K Feb  2 21:46 check_ping
        -rwxr-xr-x 1 nagios nagios 155K Feb  2 21:46 check_real
        -rwxr-xr-x 1 nagios nagios 187K Feb  2 21:46 check_smtp
        -rwxr-xr-x 1 nagios nagios 154K Feb  2 21:46 check_ssh
        -rwxr-xr-x 1 nagios nagios 168K Feb  2 21:46 check_tcp
        -rwxr-xr-x 1 nagios nagios 156K Feb  2 21:46 check_time
        -rwxr-xr-x 1 nagios nagios 169K Feb  2 21:46 check_ntp_time
        -rwxr-xr-x 1 nagios nagios 166K Feb  2 21:46 check_ups
        -rwxr-xr-x 1 nagios nagios 135K Feb  2 21:46 check_users
        -rwxr-xr-x 1 nagios nagios 130K Feb  2 21:46 negate
        -rwxr-xr-x 1 nagios nagios 125K Feb  2 21:46 urlize
        -rwxr-xr-x 1 nagios nagios 144K Feb  2 21:46 check_ide_smart
        -rwxr-xr-x 1 nagios nagios 137K Feb  2 21:46 check_uptime
        -rwxr-xr-x 1 nagios nagios 185K Feb  2 21:46 check_procs
        
        edited by bobbyiliev
        • Hi there @joshimithilesh02,

          This is quite interesting, if you try with check_ping does it work?

          Regards,
          Bobby

          • Hi Bobby,

            No, getting the same error.

            First i tried checkping without defining checkping command in client’s nrpe.cfg file, and got the following error:

            [root@monitorser servers]# /usr/local/nagios/libexec/checknrpe -H 10.0.0.18 -c checkping
            NRPE: Command ‘check_ping’ not defined

            Then i add the definition, tried again and got the same error

            [root@monitorser servers]# /usr/local/nagios/libexec/checknrpe -H 10.0.0.18 -c checkping
            NRPE: Unable to read output

            Regards,
            Mithilesh

          • Hi there,

            This is indeed quite interesting, is NRPE running on the remote server?

            sudo systemctl status nrpe.service
            

            Regards,
            Bobby

          • Hi Bobby,

            Yes, the nrpe agent is running on client server. please find the output below:

            [root@client opc]# status nrpe
            nrpe start/running, process 24917

            i also test the nrpe connection, it’s also getting connected.

            [root@monitorser servers]# /usr/local/nagios/libexec/check_nrpe -H X.X.X.X

            NRPE v4.0.3

          • Hi there,

            So far everything that you have looks very good.

            On the client server, in your /usr/local/nagios/etc/nrpe.cfg do you have the Nagios server address in the allowed hosts configured?

            allowed_hosts=127.0.0.1,::1,your_nagios_server_private_ip
            

            Regards,
            Bobby

          • Hi Bobby,

            yes, i have added nagios server IP in allowed address.

            #
            # NOTE: This option is ignored if NRPE is running under either inetd or xinetd
            
            allowed_hosts=127.0.0.1,::1,10.0.7.11
            

            Regards,
            Mithilesh Joshi

            edited by bobbyiliev
        • Hi there @joshimithilesh02,

          Everything seems to be set up correctly actually, I was reading this thread on the Nagios support forum here:

          https://support.nagios.com/forum/viewtopic.php?f=7&t=37806&sid=8d8a3ee4f11639d8ac11a5988cfcaad8&start=20

          The person was facing the same problem and managed to get it fixed by a simple reboot of the servers. Maybe something worth giving it a try.

          Let me know how it goes.
          Regards,
          Bobby