It is working now.
The requiretty on sudoers solved it, I used added this to sudoers, to allow the
nagios user only:
Defaults:nagios !requiretty
Thanks Mark for the help
Ihab
> From: mark.el...@gmail.com
> Date: Tue, 7 Dec 2010 17:30:51 +0100
> To: nagios-users@lists.sourceforge.net
> Subject: Re: [Nagios-users] NRPE
>
> > Hi List
> >
> > I have a problem using check_nrpe:
> >
> > The script on the remote machine is running this command:
> >
> > #/bin/bash
> >
> > output=`sudo /usr/sbin/lsof -X |grep tomcat| wc -l`
> >
> > max=$1
> >
> > if [ "$output" -lt "$max" ]; then
> >
> > echo "OK |value is "$output""
> >
> > exit 0;
> >
> > else
> >
> > echo "CRITICAL value is "$output""
> >
> > exit 2;
> >
> > fi
> >
> > I have this line in sudoers file:
> >
> > nagios ALL=(ALL) NOPASSWD: /usr/sbin/lsof
> >
> > I have this in the nrpe.cfg:
> >
> > command[check_lsof]=/usr/local/nagios/libexec/check_lsof.sh 256
> >
> >
> > When I run the command from the nagios user on the remote machine:
> >
> > [nag...@serv_1]$ /usr/local/nagios/libexec/check_lsof.sh 256
> > OK |value is 132
> >
> > When I run it from the Nagios server (remotely):
> > [r...@healthy libexec]# ./check_nrpe -H 10.1.1.1 -c check_lsof
> > OK |value is 0
> >
> >
> > Ive set the user in /etc/xinetd.d/nrpe to "nagios", and all the other checks
> > are working fine.
> >
> > Any thoughts?
> >
> >
>
> - Search for 'sudo' in nrpe.cfg , make sure the sudo prefix is set,
> not commented.
>
> - Look for 'tty' in the sudoers file, make sure 'requiretty' is commented.
>
> M.
>
> ------------------------------------------------------------------------------
> What happens now with your Lotus Notes apps - do you make another costly
> upgrade, or settle for being marooned without product support? Time to move
> off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
> use, and manage than apps on traditional platforms. Sign up for the Lotus
> Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
> _______________________________________________
> 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 SF Dev2Dev email is sponsored by:
WikiLeaks The End of the Free Internet
http://p.sf.net/sfu/therealnews-com
_______________________________________________
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