I customezed notify-service-by-email command and saved it as notify-service-by-email-GDF :
/usr/bin/printf "%b" "***** Gestion de Flota*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** GDF ** $SERVICESTATE$ -- $SERVICEDESC$" $CONTACTEMAIL$
How can I send this email when a service is alerted and send the command notify-service-by-email to the same contact or Contact-group, when other services are alerted?
Different notifications for the same contact
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Different notifications for the same contact
This isn't possible how you described it, however you can write a script that does some processing to match the $SERVICEDESC$ against this service and then change the message, then use this script as the notification handler.
Re: Different notifications for the same contact
Thanks for your help scott wilkerson. Really, I am not a great programmer. In my work, there are different services are monitored, when they are alerted, users want to recive emails whit your subjet specific. I don't belive I have to create a diferent contact (same address email)
for each service. Thanks again.
for each service. Thanks again.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Different notifications for the same contact
Unfortunately there isn't a builtin way to change the subject for just one service without creating a custom notification handleragotzin wrote:Thanks for your help scott wilkerson. Really, I am not a great programmer. In my work, there are different services are monitored, when they are alerted, users want to recive emails whit your subjet specific. I don't belive I have to create a diferent contact (same address email)
for each service. Thanks again.