Can you add custom commands to the 2 standard "notify-host-by-xxx" and "notify-service-by-xxx" commands?

Andrew Thompson andrew at fulgent.co.uk
Wed Nov 30 12:37:10 CET 2011


Hi all.

Is it possible to add your own custom commands to add to the 2 standard notify commands?

At the moment I have

# 'notify-host-by-email' command definition
define command{
     command_name    notify-host-by-email
     command_line    /usr/bin/printf "%b" "***** Nagios says its broken *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\n$HOSTOUTPUT$\n\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $HOSTSTATE$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
     }

# 'notify-service-by-email' command definition
define command{
     command_name    notify-service-by-email
     command_line    /usr/bin/printf "%b" "***** Nagios says its broken *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nInfo :$SERVICEOUTPUT$\n\n Service: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$ is $SERVICESTATE$ **" $CONTACTEMAIL$
     }

This is fine for the hosts that I manage by PING.

Now I have started to manage my websites for both availability and also to navigate through the site using 2 separate scripts.

Id like separate notifications for the website checks as id like to add more text into the subject line.

For eg if 1 of my sites has an issues and 1 of the pages it navigates for is not available or returns something different to what it should id like:

# 'notify-website-service-by-email' command definition
define command{
     command_name    notify-website-service-by-email
     command_line    /usr/bin/printf "%b" "***** Nagios says its broken *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nInfo :$SERVICEOUTPUT$\n\n Service: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: Website content cannot be found at $HOSTALIAS$ and is in a $SERVICESTATE$ state**" $CONTACTEMAIL$
     }

But if I create this and add it to my Critical website template which tells it to to email the admin email contact group which has me and another admin in it then its going to send both the original "notify-service-by-email" and the new "notify-website-service-by-email

Any way I can get around this.

Apologies if it's a really simple answer by the way....

Thankyou


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20111130/119181eb/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at 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


More information about the Users mailing list