way to pass additional info from check to environment?

Frost, Mark {PBG} mark.frost1 at pepsi.com
Fri Jan 5 20:38:31 CET 2007


I have a somewhat unusual situation.  I have a lot of unique service
checks in my Nagios config (2.6).  When a check fails, I need to have it
notify contacts, but also run a program.  I have done this by creating a
command that a contact runs (something other than the nromal "send some
mail" commands).

What I was hoping to do was to somehow pass information to the program
that run about that service.  I see that I can pull a lot of the fields
out via the nagios-provided shell environment, but nothing really
strikes me as an ideal solution.  One can think of this as categorizing
the services into various types such as production, development,
priority level, application type, etc.

Possibilities I've seen are:

1) Attach some parsable string to each service description.  So a
service description might go from being "HTTP_FOO" to "HTTP_FOO [P7WL]"
which I could parse from the $NAGIOS_SERVICEDESC variable.  This isn't
too good for us as I didn't want to add what appeared to be garbage to a
servicename.  Also, I have a number of these services tied into
nagios_graph which I thought used that service description for the RRD
database (I could be wrong there).

2) I could create some servicegroup names that described the
type/priority/environment that the checks runs in.  I had thought I
could parse that out of $NAGIOS_SERVICEGROUP in my program.  However,
from the documentation (and from my tests) if you have a check in
multiple groups, it will only put one of them into $NAGIOS_SERVICEGROUP.
>From my tests, you can't even predict which one of the servicegroups
will be put into $NAGIOS_SERVICEGROUP which makes it seems somewhat
useless.

3) I can just invoke my program with a variety of command line arguments
(i.e. multiple commands) that represent all the permutations of service
checks that I need to represent.  Then based on that, I add the type of
contactgroup, which maps to a single contact which maps to a specific
invocation of my program for that particular type of service check.  I
really hate this option as it makes for somewhat complex configuration,
but I can't see that there's any other nicer way.

It would be great if I could have some kind of user definable field as
part of the service definition, but it doesn't look like Nagios supports
that.

Has anyone else come up against this type of problem and lived to tell
the tale?  :-)

thanks

Mark

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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