RES: Add information in notification

Marc Powell marc at ena.com
Wed Mar 5 19:01:16 CET 2008



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Hari Sekhon
> Sent: Wednesday, March 05, 2008 11:34 AM
> To: "Bráulio H. Soares"
> Cc: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] RES: Add information in notification
> 
> Bráulio H. Soares wrote:
> > Thanks for the help, Hari. But I need to add information possibly
> different for each host and/or service notification, understand?
> >
> > By this way, I cannot insert static parameter in the command_line, into
> the commands file.
> >
> > I think another method to do this, but is no functional. I think the
> following:
> >
> > - Create a contact template with a specific service and host notifies
> command.
> > - Create a command to send e-mail to each contact template, so I would
> have customized commands to each situation I need.
> >
> > The problem rises when creating the contacts, because the same contact
> should be assigned to several contact template, but is not possible.
> >
> > Anymore idea!?
> >
> > Thanks.
> >
> > Sds,
> >
> If you are trying to do something too complicated, you might be trying
> to push a square peg in to a round hole by forcing Nagios to work in a
> way it normally doesn't do.
> 
> Have you considered just having one notification command which calls a
> script. You can then program in all the logic in to this script.
> 
> The script can accept lots and lots of Nagios macros and change the
> output depending of conditional testing and outputting certain macros
> with information depending on which host or service it is.

I agree, changing your notification script is the way to go. In a very simple case, the script can perform a normal notification, including the contents of a file that contains your special instructions, if it exists. Using standard naming conventions should help this greatly.

For host notifications, include the contents of the file that matches the value of /path/to/instructions/$HOSTALIAS$.txt if it exists.

For service notifications, include the contents of the file that matches the value of /path/to/instructions/$HOSTALIAS$-$SERVICEDESC$.txt if it exists.

--
Marc

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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