Check_snmp -d & -s
Tristan Drinkwater
tristand at micro-p.com
Fri Feb 11 18:57:11 CET 2011
Hi,
Just in case anyone wanted to know..
I resolved my issue my created a wrap script for the check_snmp plugin.
Quite simple really :)
---- script
#!/bin/bash
# Run check_snmp with param
check=$(/usr/local/nagios/libexec/check_snmp -H $1 -o $2 -C nas-drive -P 2c)
# echo result (testing)
# echo $check
# return result if CRITICAL
if [[ $check == *dead* ]]
then
echo "Disk OFFLINE - CRITICAL";
exit 2
fi
# return result if OK
if [[ $check == *ok* ]]
then
echo "Disk Online - OK";
exit 0
fi
# end script
-----Original Message-----
From: Tristan Drinkwater [mailto:tristand at micro-p.com]
Sent: 11 February 2011 11:34
To: Nagios Users List
Subject: Re: [Nagios-users] Check_snmp -d & -s
Interesting.....
How do I go about a wrap script then?
I take it I call the script from the command_check line? Anything special about outputting the result so Nagios can see it?
thanks
-----Original Message-----
From: Yueh-Hung Liu [mailto:yuehung.liu at gmail.com]
Sent: 11 February 2011 11:24
To: Nagios Users List
Subject: Re: [Nagios-users] Check_snmp -d & -s
you can write a wrap script, which would be the check command, to deal the return string and report correct status to Nagios.
of course this script will use check_snmp in it.
On Fri, Feb 11, 2011 at 7:08 PM, Tristan Drinkwater <tristand at micro-p.com> wrote:
> Morning all,
>
>
>
> I'm trying to refine a few snmp checks I do.
>
>
>
> My command looks like this;
>
>
>
> ./check_snmp -H xx.xx.xx.xx -o READyNAS-MIB::diskState.1 -C nas-drive
> -P 2c -v
>
>
>
>
>
> This produces the following;
>
>
>
> /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c [authpriv] xx.xx.xx.xx
> READYNAS-MIB::diskState.1
>
> READYNAS-MIB::diskState.1 = STRING: "dead"
>
> SNMP OK - "dead" |
>
>
>
>
>
> Now, as you can see from above, my disk 2 is 'dead' but Nagios reports
> this as ok. I'm under the impression I need to use the '-s' switch to
> specify what is good and what is bad, based on matching a string from the output.
>
>
>
> To me, the output above would suggest that the returning string is
> "dead" so to get it to report that this is actually bad I should use "-s ok" as "ok"
> is the string returned on all the other disks that are working ok.
>
>
>
> ----- working disk---
>
> /usr/bin/snmpget -t 1 -r 5 -m ALL -v 2c [authpriv] xx.xx.xx.xx
> READYNAS-MIB::diskState.2
>
> READYNAS-MIB::diskState.2 = STRING: "ok"
>
> SNMP OK - "ok" |
>
> ----- working disk---
>
>
>
>
>
>
>
> Sadly, this doesn't work as it seems that "ok" and "dead" aren't the
> returning strings. Neither are 1 and 0 as stated in the readynas MIB
> documentation.
>
>
>
> Anyone got any ideas??
>
>
>
> Have I messed up the syntax??
>
>
>
> Thanks in advance,
>
>
>
> Tristan
>
>
>
>
>
>
>
> ________________________________
> Micro Peripherals Limited.
> Registered Office: Shorten Brook Way, Altham Business Park, Altham,
> Accrington, Lancs. BB5 5YJ. Tel: (01282) 776776 Fax: (01282) 858790
> Micro Peripherals Limited. Registered in England No. 1511931. VAT No.
> GB 864
> 4387 91
>
> DISCLAIMER:
> This e-mail and attachments are confidential and are intended solely
> for the use of the individual to whom it is addressed. Any views or
> opinions presented are solely those of the author and do not
> necessarily represent those of Micro Peripherals Limited.
> If you are not the intended recipient, be advised that you have
> received this Email in error and that any use, dissemination,
> forwarding, printing, or copying of this Email is strictly prohibited.
> If this transmission is received in error please notify the sender
> immediately and delete this message from your E-mail system.
> All electronic transmissions to and from Micro Peripherals Ltd are
> recorded and may be monitored.
>
> ----------------------------------------------------------------------
> -------- The ultimate all-in-one performance toolkit: Intel(R)
> Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> 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
>
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
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
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
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
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
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