<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
h3
{mso-style-priority:9;
mso-style-link:"Heading 3 Char";
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:13.5pt;
font-family:"Times New Roman","serif";}
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;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-priority:9;
mso-style-link:"Heading 3";
font-family:"Times New Roman","serif";
font-weight:bold;}
span.EmailStyle18
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
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]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<font style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Is be run on a remote host or local?</font><br>
<br>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<font style="font-size:10.0pt;font-family:"Tahoma","sans-serif""><b>From</b>: Parkman, Mikhail [mailto:Mikhail_Parkman@cable.comcast.com]
<br>
<b>Sent</b>: Friday, March 30, 2012 12:27 PM<br>
<b>To</b>: Nagios Users List <nagios-users@lists.sourceforge.net> <br>
<b>Subject</b>: Re: [Nagios-users] how to associate /bin/bash with shell script in Nagios
<br>
</font> <br>
</div>
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Sorry for confusion - I was just trying different combinations.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">But initially my command definition was following:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">define command{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> command_name dlg_notifications<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> command_line /usr/local/nagios/libexec/nagios-msg-broker.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I have </span><span style="color:#1F497D">"#!/bin/bash" in the top of my shell script, and shell script is set to be executable.</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">perfserver-10:/usr/local/nagios/libexec$ ls -l nagios-msg-broker.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">-rwxrwxrwx 1 nagios nagcmd 149 Mar 30 10:04 nagios-msg-broker.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Mikhail.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> James Pratt [mailto:jpratt@norwich.edu]
<br>
<b>Sent:</b> Friday, March 30, 2012 9:53 AM<br>
<b>To:</b> Nagios Users List<br>
<b>Subject:</b> Re: [Nagios-users] how to associate /bin/bash with shell script in Nagios<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">I'm slightly confused - Do you have "#!/bin/bash" in the top of your shell script, and is it set to be executable by (at least) the nagios user? (Not sure why you are calling bash then the script name as an
arg, that is odd to me, but maybe I'm missing something)?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Jamie<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Parkman, Mikhail
<a href="mailto:[mailto:Mikhail_Parkman@cable.comcast.com]">[mailto:Mikhail_Parkman@cable.comcast.com]</a>
<br>
<b>Sent:</b> Friday, March 30, 2012 12:43 PM<br>
<b>To:</b> <a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a><br>
<b>Subject:</b> [Nagios-users] how to associate /bin/bash with shell script in Nagios<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">Hello,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I have the following command:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">define command{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> command_name dlg_notifications<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> command_line /bin/bash /usr/local/nagios/libexec/nagios-msg-broker.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">And the following service<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">define service{<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> use mypc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> service_description dlg_Alerts_notifications<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> check_command dlg_notifications<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> max_check_attempts 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> retain_status_information 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> retain_nonstatus_information 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"> }<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">/bin/bash /usr/local/nagios/libexec/nagios-msg-broker.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">runs fine manually.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Service defined above can’t run it though.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">While googling around, I found out that apparently Nagios does not know that script should be executed by /bin/bash<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">How would I let Nagios know about /bin/bash<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal">Mikhail.<o:p></o:p></p>
</div>
</body>
</html>