Page 1 of 1

Different notifications for the same contact

Posted: Wed Aug 14, 2019 8:43 pm
by agotzin
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?

Re: Different notifications for the same contact

Posted: Thu Aug 15, 2019 7:07 am
by scottwilkerson
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

Posted: Thu Aug 15, 2019 1:46 pm
by agotzin
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.

Re: Different notifications for the same contact

Posted: Thu Aug 15, 2019 2:09 pm
by scottwilkerson
agotzin 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.
Unfortunately there isn't a builtin way to change the subject for just one service without creating a custom notification handler