Alert based on response?

Marc Powell marc at ena.com
Thu Mar 19 18:13:05 CET 2009


On Mar 19, 2009, at 11:29 AM, Jason Frisvold wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all,
>
> 	I have a number of UPS devices to monitor.  We're looking to alert on
> conditions such as On Battery, On Bypass, and possibly others.  I can
> create service entries for each condition, but that causes multiple  
> SNMP
> queries to be sent to the same device.  So I'm wondering if there is a
> way to query once and alert based on the response.

Not without writing a custom plugin but this would be a pretty simple/ 
straightforward plugin to write in just about any language. In  
pseudocode --

Get IP to poll from command line
$output = snmp query of On Battery OID on IP #can be check_snmp  
command or snmpget or whatever
if ($output = bad value) {
	print "On Battery Status is bad"
	exit (2) #CRITICAL Status
}
$output = snmp query of On Bypass OID on IP
if ($output = bad value) {
	print "On Bypass Status is bad:"
	exit (2)
}
$output = snmp query of other status on IP
if ($output = bad value) {
	print "Other status is bad"
	exit (2)
}
(rinse, wash, repeat)
#nothing bad detetected, let's exit OK.
exit (0) # OK Status.

As part of your testing for bad values you'll probably want to make  
sure that the snmp query actually worked but in general, that's the  
core of the process above.

--
Marc

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
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