On Wed, Jul 23, 2008 at 11:53 AM, Arno Lehmann <[EMAIL PROTECTED]> wrote: > Hello, > > 23.07.2008 11:20, Marc Torres wrote: >> Hi all, >> >> I'm quite newbe to nagios, and I'm trying to configure notifications >> for services according to host contacts. I mean, I would like to >> configure contacts (or contact groups) only in the hosts definitions, >> and then when a monitorized service at that host has a hard state >> change, the notification gets send to the contact configured at the >> host definition. > > You could do this with custom variables. > > You set the data you need for the notifications in the host as, for > example, > > _NOTIFICATIONMAIL > > and create a new notification script that uses this address (if > defined) instead of the default supplied by the Nagios configuration. > > Arno
Many thanks! It works like a charm. What I've done: I've added a custom variable in the hosts definition as follows: define host{ host_name mpk1 alias mpk1 address 192.168.21.193 use mpk-host-template display_name mpk1 max_check_attempts 1 _notification_mail mail1,mail2,mail3 #coma separated _hid 5 } Then added a fake contact to be the receiver of all the services notification at nagio's eyes: define contact{ contact_name no-contact alias no-contact host_notification_options d,u,r service_notification_options w,c,r host_notification_commands notify-host-by-email service_notification_commands notify-service-by-email-custom email mail_here host_notification_period 24x7 service_notification_period 24x7 } Next, I've added a new command for notifications: (the same as the original, but I've changed the destination define command{ command_name notify-service-by-email-custom command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $_HOSTNOTIFICATION_MAIL$ } Finally I've configured the contact services with no-contact. And that's all! Thanks again. Cheers, Marc. -- "I'm unique, just like everyone else". Read it out there ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Nagios-users mailing list Nagios-users@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