nagios and sendmail

Marc Powell marc at ena.com
Fri Jun 3 21:24:13 CEST 2005


> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Edward Ford
> Sent: Friday, June 03, 2005 2:01 PM
> To: nagios-users at lists.sourceforge.net
> Subject: RE: [Nagios-users] nagios and sendmail
> 
> These are examples that are indeed in the configuration files.. If you
can
> read them..

For each contact you specify two notification options --

(http://nagios.sourceforge.net/docs/1_0/xodtemplate.html#contact)

host_notification_commands	command_name
service_notification_commands	command_name

Using my examples below they would look like --

define contact{
        contact_name                    example
        alias                           Real Name
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    c,r
        host_notification_options       d,r
        service_notification_commands   service-notify-by-email
        host_notification_commands      host-notify-by-email
        email                           email at example.foo
        }

The command definitions themselves are extremely simple, consisting of
only two commands chained together. You have 'echo' and you have 'mail'.
Everything else is just filler that's included in the email. Use 'man
echo' and 'man mail' to understand those basic commands better. The
documentation on notifications might also be useful to you at
http://nagios.sourceforge.net/docs/1_0/notifications.html.

--
Marc

(p.s. top-posting makes email hard to read in context and discourages
responses).


 
> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net]On Behalf Of Marc
Powell
> Sent: Friday, June 03, 2005 2:45 PM
> To: nagios-users at lists.sourceforge.net
> Subject: RE: [Nagios-users] nagios and sendmail
> 
> 
> > -----Original Message-----
> > From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> > admin at lists.sourceforge.net] On Behalf Of Edward Ford
> > Sent: Friday, June 03, 2005 1:15 PM
> > To: nagios-users at lists.sourceforge.net
> > Subject: [Nagios-users] nagios and sendmail
> >
> > I finally got sendmail working on the computer that nagios is
> installed
> > on. Now how do I get nagios to talk to sendmail, is it with external
> > commands?
> 
> A couple of examples --
> 
> 
> # 'notify-by-email' command definition
> define command{
>         command_name    notify-by-email
>         command_line    /bin/echo -e 'Subject: ** $NOTIFICATIONTYPE$
> alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\n\n***** Nagios
> *****\n\nNotification Type: $NOT
> IFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress:
> $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
> $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$' | /bin/
> mail Service $SERVICEDESC$ $SERVICESTATE$ alert for $HOSTNAME
> $CONTACTEMAIL$
>         }
> 
> # 'host-notify-by-email' command definition
> define command{
>         command_name    host-notify-by-email
>         command_line    /bin/echo -e "Subject: $NOTIFICATIONTYPE$
alert
> - Host $HOSTNAME$ is $HOSTSTATE$\n\n***** Nagios *****\n\nNotification
> Type: $NOTIFICATIONTYPE$\nHos
> t: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:
> $OUTPUT$\n\nDate/Time: $DATETIME$\n" | /bin/mail $CONTACTEMAIL$
>         }
> 
> # 'service-notify-by-email' command definition
> define command{
>         command_name    service-notify-by-email
>         command_line    /bin/echo -e "Subject: Service $SERVICEDESC$
> $SERVICESTATE$ alert for $HOSTNAME$!\n\n***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHo
> st: $HOSTNAME$\nState: $SERVICESTATE$\nAddress:
> $HOSTADDRESS$\n\nService: $SERVICEDESC$\nInfo: $OUTPUT$\n\nDate/Time:
> $DATETIME$\n" | /bin/mail -s '** $NOTIFICATIONTYPE$ al
> ert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **' $CONTACTEMAIL$
>         }
> 
> > Any good and useful responses would be appreciated.
> 
> Unless I'm being very dense, these, and many other command definitions
> are created if you install the sample config files.
> 
> --
> Marc
> 


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r 
_______________________________________________
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