<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial, Helvetica, sans-serif; font-size: 12pt; color: #000000'>You can build a new contact group that is gets alert only from this commands .<br><br>Or you can split the templates and build a new one that uses this alerting for the new service .<br><br>You need to think of the process of the alerts and define what alerts to send .<br><br>I know many people think that adding new (insert nagios item ) is trouble , but i found that if some thing "breaks" my conventions or is an exemption , it is best to "build" the templates for it and make it modular - as it is most likely will happen again , and that way you'll have the definition ready .<br><br><br>Assaf <br><br><br><hr id="zwchr"><div style="color: rgb(0, 0, 0); font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Andrew Thompson" <andrew@fulgent.co.uk><br><b>To: </b>nagios-users@lists.sourceforge.net<br><b>Sent: </b>Wednesday, 30 November, 2011 11:37:10 AM<br><b>Subject: </b>[Nagios-users] Can you add custom commands to the 2 standard "notify-host-by-xxx" and "notify-service-by-xxx" commands?<br><br>
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Hi all.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Is it possible to add your own custom commands to add to the 2 standard notify commands?</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">At the moment I have </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"># 'notify-host-by-email' command definition</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";">define command{</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"> command_name notify-host-by-email</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";"> 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$</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";"> }</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";"> </span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"># 'notify-service-by-email' command definition</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";">define command{</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"> command_name notify-service-by-email</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"> 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$</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";"> }</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">This is fine for the hosts that I manage by PING.</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">Now I have started to manage my websites for both availability and also to navigate through the site using 2 separate scripts.</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">Id like separate notifications for the website checks as id like to add more text into the subject line.
</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">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:</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"># 'notify-website-service-by-email' command definition</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";">define command{</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"> command_name notify-website-service-by-email</span></p>
<p class="MsoNormal" style=""><span style="font-family: "Courier New";"> 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$</span></p>
<p class="MsoNormal"><span style="font-family: "Courier New";"> }</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">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</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">Any way I can get around this.</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">Apologies if it’s a really simple answer by the way….</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"><span style="" lang="EN-US">Thankyou</span></p>
<p class="MsoNormal"><span style="" lang="EN-US"> </span></p>
<p class="MsoNormal"> </p>
</div>
<br>------------------------------------------------------------------------------<br>All the data continuously generated in your IT infrastructure <br>contains a definitive record of customers, application performance, <br>security threats, fraudulent activity, and more. Splunk takes this <br>data and makes sense of it. IT sense. And common sense.<br>http://p.sf.net/sfu/splunk-novd2d<br>_______________________________________________<br>Nagios-users mailing list<br>Nagios-users@lists.sourceforge.net<br>https://lists.sourceforge.net/lists/listinfo/nagios-users<br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. <br>::: Messages without supporting info will risk being sent to /dev/null</div><br></div></body></html>