From: Andrew T. <an...@fu...> - 2011-11-30 11:39:01
|
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 |