Need pointer

Sumit Malhotra smalhotra at dataarmor.net
Wed Feb 8 11:45:32 CET 2006


With $value I meant, Write an exit status to be used by Nagios

 

#!/bin/sh 
output=`/usr/local/nagios/libexec/check_snmp -H $1 -o $2`
if [ $output = 0 ]
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>:





  _____

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060208/0b4beecb/attachment.html>


More information about the Users mailing list