NRPE return values

Assaf Flatto assaf.flatto at ssp-intl.com
Wed Mar 18 16:05:19 CET 2009


The sudo was in place - but silly me - i forgot that the sudoers file has a specific list of 
commands that the nagios user have sudo permissions to run .

Adding the new script to the file did solve the issue.

But thank you for reminding me this slight oversight .

Assaf


On Wednesday 18 March 2009 14:56:11 you wrote:
> I am just guessing here, but is the command that works being run as
> root?  My guess is that the lsof command isn't working the same was as
> root when run by NRPE.  Try running the command as whatever users run
> NRPE and see if that makes any difference.
> --
> Bob Sloane, University of Kansas Computer Center, Lawrence, KS, 66045
> Email:sloane at ku.edu http://www.ku.edu/home/sloane Phone:(785)864-0444
>
> -----Original Message-----
> From: Assaf Flatto [mailto:assaf.flatto at ssp-intl.com]
> Sent: Wednesday, March 18, 2009 9:45 AM
> To: Nagios User list
> Subject: [Nagios-users] NRPE return values
>
>
> Hello List
> I am trying to write a plugin to count the number of connection of a
> specific type on a port .
> I wrote the script that gives me the output i require and running the
> script on the machine i need it it works well .
> The problem is when i am trying to execute the script via NPRE , i added
> the command and params to the nrpe.cfg and run the test , and the result
> returning to the nagios server is always a numeric "0" , when i put a
> text string it returns the string no problem , but when i try to add a
> number from a variable , it shows only 0 .
> actuall script line :
> if [ "$1" = "2598" ]; then
> W=`lsof -Pn -i | grep squid | grep ESTABLISHED | grep -v 127.0.0.1 |
> grep 2598 | wc -l`
> echo "Number of connections is "$W
> exit 0
> fi
> from the messages log :
> Running command: /usr/lib/nagios/plugins/check_squid_citrix.sh 2598
> Mar 18 14:18:46 host nrpe[3869]: Command completed with return code 3
> and output: Number of connections is 0
> running from the nagios server:
> ../libexec/check_nrpe -H X.X.X.X -c check_2598
> Number of connections is 0
> Manual execution on tartget server:
> sh -x /usr/lib/nagios/plugins/check_squid_citrix.sh 2598
> + '[' 2598 = 1494 ']'
> + '[' 2598 = 2598 ']'
> ++ lsof -Pn -i
> ++ grep squid
> ++ grep ESTABLISHED
> ++ grep -v 127.0.0.1
> ++ grep 2598
> ++ wc -l
> + W=83
> + echo 'Number of connections is 83'
> Number of connections is 83
> + exit 0
> Any ideas why i am only getting the 0 output ?


-- 
Assaf Flatto
SSP Ops Team
Linux System Administrator
169 Euston Road, London, NW1 2AE





IMPORTANT . this email and the information in it may be confidential, legally
privileged and/or protected by law. It is intended solely for the use of the
person to whom it is addressed. If you are not the intended recipient, please
notify the sender immediately and do not disclose the contents to any other
person, use it for any purpose, or store or copy the information in any medium.
Please also delete all copies of this email and any attachments from your
system.

We cannot guarantee the security or confidentiality of email communications. We
do not accept any liability for losses or damages that you may suffer as a
result of your receipt of this email including but not limited to computer
service or system failure, access delays or interruption, data non-delivery or
mis-delivery, computer viruses or other harmful components.

Copyright in this email and any attachments belong to Select Service Partner UK
Limited. Should you communicate with anyone at Select Service Partner UK Limited by
email, you consent to us monitoring and reading any such correspondence.

Nothing in this email shall be taken or read as suggesting, proposing or
relating to any agreement concerted practice or other practice that could
infringe UK or EC competition legislation.

Select Service Partner UK Limited is a company registered in England and Wales
(company number 05687183) whose registered office is at 1 The Heights, Brooklands, Weybridge. Surrey. KT13 0NY
 
 

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
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