-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
BEGIN:VCARD
VERSION:3.0
N:Brewster;Israel;;;
FN:Israel Brewster
ORG:Frontier Flying Service;MIS
TITLE:PC Support Tech II
EMAIL;type=INTERNET;type=WORK;type=pref:[email protected]
TEL;type=WORK;type=pref:907-450-7293
item1.ADR;type=WORK;type=pref:;;5245 Airport Industrial Wy;Fairbanks;AK;99701;
item1.X-ABADR:us
X-ABUID:36305438-95EA-4410-91AB-45D16CABCDDC\:ABPerson
END:VCARD
On Jul 16, 2009, at 2:26 PM, Marc Powell wrote:
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 --
Good suggestion, and it would certainly work. However, that would
muddy up (to some extent) my nagios configs. The way I have things set
up at the moment, there is one (ok, two actually, but same idea)
service for UPS checks, which is applied to the UPS host group. So to
add a new UPS all I need to do is add a new host with a "use generic-
UPS" directive, the name, ip, and parent. Keeps everything nice and
simple. Overriding that for a specific Host (or hosts) would add to
the complexity, something I would like to avoid as much as possible.
Thanks for the suggestion though.
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
[email protected]
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
------------------------------------------------------------------------------
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
[email protected]
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