Different notifications for the same contact

Discuss new project and feature ideas here.
See labs.nagios.com for new projects under development.

Different notifications for the same contact

Postby agotzin » Wed Aug 14, 2019 8:43 pm

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?
agotzin
 
Posts: 2
Joined: Thu Jun 13, 2019 6:47 pm

Re: Different notifications for the same contact

Postby scottwilkerson » Thu Aug 15, 2019 7:07 am

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: Different notifications for the same contact

Postby agotzin » Thu Aug 15, 2019 1:46 pm

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.
agotzin
 
Posts: 2
Joined: Thu Jun 13, 2019 6:47 pm

Re: Different notifications for the same contact

Postby scottwilkerson » Thu Aug 15, 2019 2:09 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 15796
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Nagios Ideas

Who is online

Users browsing this forum: No registered users and 1 guest