Need pointer
Arno Lehmann
al at its-lehmann.de
Wed Feb 8 12:29:43 CET 2006
Hi,
On 2/8/2006 11:45 AM, Sumit Malhotra wrote:
>
>
> With $value I meant, Write an exit status to be used by Nagios
>
without having the time to produce a complete script, I just wanted to
point out...
> #!/bin/sh
> output=`/usr/local/nagios/libexec/check_snmp -H $1 -o $2`
> if [ $output = 0 ]
that these are Bit numbers, so you have to compare against 1, 2, 4 and
either do it with a bitwise and or by comparing with -ge.
Like
if [ $output -ge 1 ] ; then
# add something to output string
# store marker for problem
fi
and in the end you return after you checked all status.
Toto: Try understanding existing shell scripts first before you try your
own. Also, read and nderstand the manual, like 'man bash'.
Arno
> echo "low paper"
>
> Exit(1)
> if [ $output = 1 ]
> echo "no Paper"
> Exit(2)
> if [ $output = 2 ]
>
> echo "low Toner"
>
> ----------
>
> 0 will return OK
>
> 1 will return WARNING
>
> 2 will return CRITICAL
>
> --------
>
>
>
> Also, check you shell script there is error on line 3 (NO $output – us
> output instead).
>
> I guess, it’s a good time to read some shell scripting.
>
>
>
> Thanks
>
> Sumit
>
>
>
>
>
>
>
> * From: * nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net] *On Behalf Of *Toto
> Capuccino
> *Sent:* Wednesday, February 08, 2006 3:53 PM
> *To:* Nagios
> *Subject:* Re: [Nagios-users] Need pointer
>
>
>
> I have tried this
>
> #!/bin/sh
>
> $output=`/usr/local/nagios/libexec/check_snmp -H $1 -o $2`
>
> if [ $output = 0 ]
>
> echo "low paper"
>
> if [ $output = 1 ]
>
> echo "no Paper"
>
> if [ $output = 2 ]
>
> echo "low Toner"
> .
> .
> .
> exit ($value)
>
> i get this errors :
> ../libexec/check_Xerox_Status: line 3: =SNMP: command not found
> ../libexec/check_Xerox_Status: line 65: syntax error near unexpected
> token `$value'
> ../libexec/check_Xerox_Status: line 65: `exit ($value)'
>
> I am totally walking blind there as i could say it is my first script,
> can you give a hand?
>
> Thanks
> and i get this error
>
> 2006/2/8, Sumit Malhotra <smalhotra at dataarmor.net
> <mailto:smalhotra at dataarmor.net>>:
>
>
>
>
>
> _____
>
> From: nagios-users-admin at lists.sourceforge.net
> <mailto:nagios-users-admin at lists.sourceforge.net>
> [mailto:nagios-users-admin at lists.sourceforge.net
> <mailto:nagios-users-admin at lists.sourceforge.net>] On Behalf Of Toto
> Capuccino
> Sent: Wednesday, February 08, 2006 2:52 PM
> To: Nagios
> Subject: [Nagios-users] Need pointer
>
>
>
> Hi,
>
> I need a pointer to do the following :
> i am checking the staus of printers with check_snmp -H x.x.x.x -o OID
> the snmp check returns a value between 0 and 14 that corresponds to a state
> Condition Bit #
> lowPaper 0
> noPaper 1
> lowToner 2
> noToner 3
> doorOpen 4
> jammed 5
> offline 6
> serviceRequested 7
> inputTrayMissing 8
> outputTrayMissing 9
> markerSupplyMissing 10
> outputNearFull 11
> outputFull 12
> inputTrayEmpty 13
> overduePreventMaint 14
>
> What i want to do is to make appear the value in the output of the check.
> How can i do that ?
>
> Write a wrapper script which instead of returning OID in output returns the
> State instead of NUMBERIC value.
>
>
>
> The script could be like
>
>
>
> #!/bin/sh
>
> output= `/usr/bin/local/Nagios/check_snmp -H $1 -o $2`
>
>
>
> if [ $output = 0 ]
>
> echo "lowpaper"
>
> exit ($value)
>
>
>
>
> --
> Le bon sens est la chose du monde la mieux partagée.
>
--
IT-Service Lehmann al at its-lehmann.de
Arno Lehmann http://www.its-lehmann.de
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
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