[Nagiosplug-help] Notification sent to two different recipients?

Jason Lee leejm_ca at yahoo.com
Tue Oct 20 15:01:19 CEST 2009


Hi Thomas,

Thanks for the suggestion.  I'll try it out.


Jason



----- Original Message ----
From: Thomas Guyot-Sionnest <dermoth at aei.ca>
To: Nagios Plugin Help List <nagiosplug-help at lists.sourceforge.net>
Sent: Sat, October 17, 2009 2:51:05 PM
Subject: Re: [Nagiosplug-help] Notification sent to two different recipients?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16/10/09 07:57 PM, Jason Lee wrote:
> Hi everyone,
> 
> 
> I'd like to enable Nagios host and service alert notifications to be sent to different e-mail recipients.  Meaning, when a nagios monitored host/service goes down, it sends an e-mail to one recipient.  When a host/service goes into a recovery state, an e-mail is sent to a different e-mail recipient.
> 
> I have added two different groups in my contacts.cfg file.
> 
> 
> define contact{
>        contact_name                    nagiosadmin            ; Short name of user
>        use                            generic-contact        ; Inherit default values from generic-contact in template.cfg
>        alias                          Nagios Admin            ; Full name of user
>        email                          nagiosadmin            ; Email nagiosadmin
>        host_notification_options      d                      ; Notify Nagios admin when host goes down
>        service_notification_options    c,w                    ; Notify Nagios admin when service becomes critical or warning
>        }
> 
> define contact{
>        contact_name              nagiosrecover          ; Short name of user
>        use                            generic-contact        ; Inherit default values from generic-contact in template.cfg
>        alias                          nagiosrecover          ; Full name of user
>        email                          nagiosrecover          ; Email nagiosrecover
>        host_notification_options      r                      ;Email nagiosrecover when host recovers
>        service_notification_options    r                      ; Email nagiosrecover when service recovers
>        }
> 
>  
> When run /root/nagios to check my configuration I receive the errors:
> 
> Warning: Host recovery notification option for contact 'nagiosrecover' doesn't make any sense - specify down and/or unreachable options as well
> Warning: Service recovery notification option for contact 'nagiosrecover' doesn't make any sense - specify critical and/or warning options as well
> 
> If I specify host_notification_options "d,u,r,f,s" I have no problems.  But that defeats the purpose of notify two different e-mail distribution lists.

Recovery notifications are sent only when a problem notification was
sent for the same contact. If there's no other option there's no point
of selecting recoveries.

In my setup for instance, pagers get only down/critical emails, while
the distribution list gets all down/critical/warning + recoveries. It is
pretty odd to have only recoveries going to an email without any
matching alert (i.e. no way to see when it went down).

> Does anyone have any suggestions on how to resolve this?    Should I use a different cfg file other than the contacts.cfg file.

Have a special command for sending the recoveries that filter them out.
Maybe even this may do it:

in contacts:
  service_notification_commands notify-recoveries-by-email
  host_notification_commands    host-notify-recoveries-by-email

define command{
  command_name  host-notify-recoveries-by-email
  command_line  [ x"$NOTIFICATIONTYPE$" == xRECOVERY ] && <command>
  }

define command{
  command_name  notify-recoveries-by-email
  command_line  [ x"$NOTIFICATIONTYPE$" == xRECOVERY ] && <command>
  }

where <command> is your usual host/service notification command.

I haven't tested though, if it doesn't work you may have to wrap it up
in a shell script.

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFK2hIZ6dZ+Kt5BchYRAhQuAKDTWXkSVzCLyAamBp0kl9zz982T5gCfbXJt
ZbuKJLAFxLgmqkU8iMShkV4=
=emmA
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagiosplug-help mailing list
Nagiosplug-help at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Help mailing list