Nagios NRPE: Unable to read output

Marquez, Quentin Quentin.Marquez at experian.com
Mon Mar 29 12:11:05 CEST 2010


Hi Alen, Hi list,

 

Your issue is related to the knowledge about configuring and using sudo commands, not with Nagios.

Although, this knowledge is required for every Nagios plugins containing commands that need root permissions to be allowed to get executed.

I know the “check_mem.pl” plugin requires the same kind of configuration.

 

Setting up a sudo command means editing a user alias, a command alias, and then allow your user alias to run your command alias with some other user permission, ie the root user.

 

The file you want to edit is /etc/sudoers, edit it with your vi editor by typing as root :    visudo

(should be located in /usr/sbin/ ) 

On AIX, you need the “rpm.rte” AIX package, and the sudo rpm coming from your “AIX toolbox for Linux Applications” CD or ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/

 

Edit this file as follow : Be carefull about the syntax, it has to be strictly respected :

 

Add a user alias such as :

User_Alias          SU_TO_NAGIOS_PLUGINS_USER = nagios

Make sure you are using a tabulation between User_Alias and the alias name, also make sure the U and A of User_Alias are uppercase.

 

Add a command alias such as :

Cmnd_Alias        SU_TO_NAGIOS_PLUGINS = /usr/local/nagios/current/libexec/tsmonitor db

(seems your path uses nagios instead of “nagios-plugins”)

Again, make sure you are using a tabulation between Cmnd_Alias and the alias name, and that the C and A of Cmnd_Alias are uppercase.

 

Then add the authorization such as :

SU_TO_NAGIOS_PLUGINS_USER ALL = NOPASSWD: SU_TO_NAGIOS_PLUGINS

This line will let the command “/usr/local/nagios/current/libexec/tsmonitor db “ run with root permissions.

 

Save and exit, AIX will let you know if you have a syntax issue in your /etc/sudoers file, if this is the case, edit the file again to fix it.

 

Now you can check user Nagios gained this permission by entering :

su – nagios –c sudo –l

-          sudo –l    (Lower L option to list your configured sudo commands)

-          su – nagios –c   (to run the following command using nagios identity)

you should see something like :

User nagios may run the following commands on this host:

    (root) NOPASSWD: /usr/local/nagios/current/libexec/tsmonitor db

 

Which means user nagios may run :

sudo /usr/local/nagios/current/libexec/tsmonitor db

 

Now you have to use this sudo command in your nrpe.cfg such as :

command[tsmonitor_db]=sudo /usr/local/nagios/libexec/tsmonitor db

 

Hope this helps!!

 

Cheers,

 

Quentin Marquez

Unix / linux admin

Global Technology Services

Experian - Monaco

Tel : (377) 97 98 54 27

 

 

 

From: Grizonic Alen [mailto:Alen.Grizonic at comparex.si] 
Sent: 29 March 2010 09:48
To: Marquez, Quentin
Subject: RE: [Nagios-users] Nagios NRPE: Unable to read output

 

Thank you very much!

 

I changed the command in my nrpe.cfg file, but now looks like there is something else blocking the response.

Even with a log timeout I get ... CHECK_NRPE: Socket timeout after XY seconds.

 

I would think of a firewall blocking, but the other commands work and run very fast ... and apparently there is no firewall on that AIX machine.

 

p.s. Maybe I missed something out ... what did you mean with »you would need to setup a sudo command«?

 

Just change the command to ...

 

command[tsmonitor_db]=sudo /usr/local/nagios/libexec/tsmonitor db

 

... or something else?

 

If you have any idea I wuold be more than thankful!

 

But really J

 

 

Best regards, 

 

Alen

 

 

From: Marquez, Quentin [mailto:Quentin.Marquez at experian.com] 
Sent: Friday, March 26, 2010 3:57 PM
To: Nagios Users List
Subject: Re: [Nagios-users] Nagios NRPE: Unable to read output

 

Hi Alen,

 

I don’t know much about this plugin, but it looks like your command requires root permission.

Thus you would need to setup a sudo command to run /usr/local/nagios/libexec/tsmonitor db

Then use your new sudo command in your nrpe.cfg :

command[tsmonitor_db]=sudo /usr/local/nagios/libexec/tsmonitor db

 

Cheers,

Quentin

 

From: Grizonic Alen [mailto:Alen.Grizonic at comparex.si] 
Sent: 26 March 2010 15:17
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Nagios NRPE: Unable to read output

 

Hello!

 

I know that this post is nothing new, but I still didn't find any solution for it.

 

I am working on a AIX 5.3 machine with NRPE running under inetd.

 

On the local AIX machine the command for TSM works fine ...

 

# ./tsmonitor db

db - database utilization 0%, OK

 

But when I start if from the Nagios server ... 

 

# ./check_nrpe -n -t 60 -H 172.21.100.121 -c tsmonitor_db

NRPE: Unable to read output

 

or from the AIX machine with the NRPE I get ...

 

# ./check_nrpe -n -t 60 -H localhost -c tsmonitor_db

NRPE: Unable to read output

 

The nrpe.cfg file is properly configured with the commands

 

command[tsmonitor_db]=/usr/local/nagios/libexec/tsmonitor db

command[check_disk/]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /

 

Where check_disk/ works fine, but tsmonitor_db NOT!

 

Any suggestions?

 

 

Best regards, 

 

Alen

This e-mail has come from Experian, the only business to have been twice named the UK's 'Business of the Year’ 

 

===================================================================================

Information in this e-mail and any attachments is confidential, and may not be copied or used by anyone other than the addressee, nor disclosed to any third party without our permission. There is no intention to create any legally binding contract or other binding commitment through the use of this electronic communication unless it is issued in accordance with the Experian Limited standard terms and conditions of purchase or other express written agreement between Experian Limited and the recipient. 

Although Experian has taken reasonable steps to ensure that this communication and any attachments are free from computer virus, you are advised to take your own steps to ensure that they are actually virus free. 

Companies Act information:

Registered name: Experian Limited 

Registered office: Landmark House, Experian Way, NG2 Business Park, Nottingham, NG80 1ZZ, United Kingdom

Place of registration: England and Wales 

Registered number: 653331

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20100329/e60c94fa/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list