SNMP Monitoring conundrum
Marc Powell
marc at ena.com
Fri Jul 17 00:26:00 CEST 2009
On Jul 16, 2009, at 4:50 PM, Israel Brewster wrote:
> I have a number of scripts I have developed to monitor our UPS units
> via SNMP - I found the included plugins didn't give me enough power/
> flexibility with the monitoring, so I made my own. Unfortunately, we
> have just added a new UPS to the system which, although made by the
> same company, uses different OID's for the data I am pulling. Thus
> the issue: I want the same data, so other than the OID's the
> existing scripts would work. But how do I deal with different OID's
> on different devices?
>
> So far I've thought of the following:
> 1) Make a second copy of my scripts with the new OID's. Also implies
> creating new contacts to use the new script (the notification script
> pulls data such as estimated run time via snmp) and maintaining two
> copies of each check/notification script
>
> 2) Somehow pass the OID's to the scripts from nagios. Not quite sure
> how I would manage this, as the OID's would need to be associated
> with the hosts, and further complicated by the fact that some
> scripts use 3 or more OID's - for example, the main script looks at
> UPS state(On battery, on line power, etc) estimated run time (if on
> battery) and time on battery - so it would need to be passed three
> separate OIDS. Perhaps this approach could be simplified by simply
> passing a code identifying which set of OID's the script should use,
> at the expense of a more complicated script. Still need to find some
> way of getting that into Nagios so it can pass the appropriate value
> to the script though.
Beyond what you've received so far, you can pass arguments to the
command from the service definitions too so there are a number of ways
that you can pass information for your script to act on. The only part
you really need to figure out is what 'standard' information you want
to pass to the script and what tools the language it's written is
provides to parse those arguments --
http://nagios.sourceforge.net/docs/3_0/macros.html (Command Argument
Macros)
define service {
host_name fancyups1
service_description SNMPCHECK
check_command my_check_command!APC!.1.3.1.6.1.3!.1.3.1.7.5.4
}
define service {
host_name fancyups1
service_description SNMPCHECK
check_command my_check_command!APC!.1.3.1.6.1.3!.1.3.1.7.5.4
}
define service {
host_name fancyups2
service_description SNMPCHECK
check_command my_check_command!MGE!.1.3.1.6.1.3.10.17!.
1.3.1.6.1.4.3.2.4
}
define command {
command_name my_check_command
command_line $USER1$/my_custom_script --type $ARG1$ --oid $ARG2$ --
oid $ARG3$ ; assumes your script can parse opts or
# command_line $USER1$/my_custom_script $ARG1$ $ARG2$ $ARG3$
}
The two above then become
/path/to/my_custom_script --type APC --oid .1.3.1.6.1.3 --oid .
1.3.1.7.5.4
/path/to/my_custom_script --type MGE --oid .1.3.1.6.1.3.10.17 --oid .
1.3.1.6.1.4.3.2.4
or
/path/to/my_custom_script APC .1.3.1.6.1.3 .1.3.1.7.5.4
/path/to/my_custom_script MGE .1.3.1.6.1.3.10.17 .1.3.1.6.1.4.3.2.4
--
MArc
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
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