Return Code of 4

Andreas Ericsson ae at op5.se
Thu Apr 15 23:20:52 CEST 2010


On 04/15/2010 10:32 PM, Weiner, Michael wrote:
> 
> Its been awhile since I have posted anything here, mainly because I find
> for the most part Nagios just works and does so pretty much out of the
> box for most things. Lately I have been gathering up all the
> monitoring/scripting pieces that the Windows administrator has laying
> around on the floor and trying to put them into Nagios in some sensible
> way. So, I have been working on some scripts/plugins for Symantec
> NetBackup, in particular, we run the Master and Media Servers on Windows
> servers and I am trying to get Nagios which runs on a Linux box to check
> (for the first part of my exercise) certain pools. I have a shell script
> written based on Jurry's script that takes a few arguments from the
> command line and checks the remote server for the pool specified in the
> check command. An example is shown below:
> 
> 
> 
> $USER1$/check_pool my-backup-server 100 20 Scratch ALL
> 
> The check_pool script simply users vmquery via sudo in order to elevate
> the nagios users' rights to be that of root and run the appropriate
> command:
> 
> sudo -u nagios /usr/local/openv/volmgr/bin/vmquery -h my-backup-server
> -b -pn Scratch
> 
> Running this at the command line (even as user nagios) succeeds and
> gives me
> 
> Scratch OK : available tapes 121|Scratch=121;100;20
> 
> 
> 
> However once I add this as a service check to nagios I receive the
> following:
> 
> 
> 
> Warning: Return code of 4 for check of service 'Scratch_Pool_Check' on
> host 'my-backup-server' was out of bounds.
> 

Try this from your Nagios server:

true; echo $?
false; echo $?

Those are return codes. A numerical value the running program sets for
the master program to reap. The textual output has absolutely nothing
to do with that return code.

If you run the check exactly like Nagios does it and then, immediately
after having run the check, run the command

echo $?

you will get the return code of the check command. Note that you can
only inspect $? once, as it takes a new value for each command you run.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
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
_______________________________________________
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