check_nt diskusage query no status returned ... checking return status

xavier renaut list.nagios-users=W+vduneg5OqcvWdFBKKxig at public.gmane.org
Mon Jul 21 16:37:01 CEST 2003


On Thu, Jul 17, 2003 at 01:53:13PM -0400, Tim Shouldice wrote:
|The order of the switches does not actually matter. The text of the output will always be 
|the same, however the status code returned by the plugin should be 0 for ok, 1 for 
|warning and 2 for error. To check that it is working, simply create a simple perl wrapper 
|to see the return code
|
|#!/usr/bin/perl
|$ret=system(/usr/local/nagios/check_nt -H somehost -w 80 -c 90 -v USEDDISKSPACE -l C");
|print "$ret\n";
|
|You'll see the returned text of the command on one line and the return code on the other. 
|The return code from Perl needs to be divided by 256. So you'll see 0 for OK, 256 for 
|WARNING and 512 for CRITICAL.
|
|Tim Shouldice
|http://support.tsmgsoftware.com
|



another way to get the return status is 
$ echo $?

ex : 
$ ls /eoau
$ echo $?
1

yet another way (coolest !) is to use zsh 
and a prompt like this :
export PROMPT="$(echo '%B%(?..[%?] )%b%n@%U%m%u> ')" 

xavier=RBUIKZetp+8 at public.gmane.org> ls /eoau                                                     
ls: /eoau: No such file or directory
[1] xavier=RBUIKZetp+8 at public.gmane.org>


that way the return value is always printed in the prompt
if different from 0.

bye


-- 
xavier


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
Nagios-users mailing list
Nagios-users=5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f at public.gmane.org
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