Hi Jatin,

Don't try to run the sudo command using "root" while its configuration is made 
for "nagios" :)

Your issue looks like you can run check_mem.pl as root and get a reply locally, 
but nrpe is owned by user "nagios", and user "nagios" won't run this plugin 
correctly.

To allow the nagios user to run check_mem.pl as root, you have to configure a 
sudo command.

Make sure your check_mem.pl is owned by user "nagios", configure your sudo 
command via "visudo", and then run this sudo command as the "nagios" user.

As root, you could try : su - nagios -c "/usr/bin/sudo 
/usr/local/nagios/libexec/check_mem.pl -w 10 -c 5"

Or just wait to see the result on your nagios server.

Cheers,
Quentin


 -----Original Message-----
From: Jatin Davey [mailto:jasho...@cisco.com] 
Sent: 12 March 2010 10:45
To: Marquez, Quentin
Cc: Nagios Users List
Subject: Re: [Nagios-users] check_mem shows : "NRPE: Unable to read output"

Hi Marquez

I ran the command in the same as you said and i am getting the following 
error:

[r...@mcs-linux-2 etc]# /usr/bin/sudo 
/usr/local/nagios/libexec/check_mem.pl -w 10 -c 5
Sorry, user root is not allowed to execute 
'/usr/local/nagios/libexec/check_mem.pl -w 10 -c 5' as root on mcs-linux-2.

Please let me know what to do.

Thanks
Jatin

On 3/12/2010 3:03 PM, Marquez, Quentin wrote:
> Jatin,
>
> Here is how I use it with sudo :
>
> In my nrpe.cfg :
> command[check_mem]=/usr/bin/sudo
> /usr/local/nagios-plugins/current/libexec/check_mem.pl -w 10 -c 5
>
> visudo :
> User_Alias      SU_TO_NAGIOS_PLUGINS_USER = nagios
> Cmnd_Alias      SU_TO_NAGIOS_PLUGINS =
> /usr/local/nagios-plugins/current/libexec/check_mem.pl -w 10 -c 5
> SU_TO_NAGIOS_PLUGINS_USER ALL = NOPASSWD: SU_TO_NAGIOS_PLUGINS
>
> Root permissions will allow nagios to read memory attributes.
>
> ++
> Quentin
>
> -----Original Message-----
> From: Jatin Davey [mailto:jasho...@cisco.com]
> Sent: 12 March 2010 08:08
> To: Nagios Mailinglist
> Subject: [Nagios-users] check_mem shows : "NRPE: Unable to read output"
>
> Hi
>
> I had downloaded the perl file for check_mem plugin and copied in the
> libexec folder of the target machine that needs to be monitored. On the
> localhost it returns correct values but when i shoot the command from
> the nagios server using NRPE i am getting the following :
>
> NRPE: Unable to read output
>
> Is it an issue with NRPE or check_mem plugin.
>
> The output for check_mem on the localhost is :
>
> <b>CRITICAL: Memory Usage (W>  5, C>  6): 30%<br>Swap Usage (W>  5, C>  6):
>
> 1%</b>|MemUsed=30%;5;6 SwapUsed=1%;5;6
>
> I have defined the command also in the nrpe.cfg file. All other commands
>
> work fine except for the check_mem plugin.
>
> Please let me know what to do next.
>
> Thanks
> Jatin
>
> ------------------------------------------------------------------------
> ------
> Download Intel&#174; 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
> _______________________________________________
> Nagios-users mailing list
> Nagios-users@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
>
> 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
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; 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
> _______________________________________________
> Nagios-users mailing list
> Nagios-users@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
>
>    
------------------------------------------------------------------------------
Download Intel&#174; 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
_______________________________________________
Nagios-users mailing list
Nagios-users@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

Reply via email to