<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=us-ascii"><meta name=Generator content="Microsoft Word 12 (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:Garamond;
        panose-1:2 2 4 4 3 3 1 1 8 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
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.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Garamond","serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Garamond","serif";
        color:windowtext;}
.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;}
/* List Definitions */
@list l0
        {mso-list-id:475339419;
        mso-list-type:hybrid;
        mso-list-template-ids:1647085144 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:.75in;
        text-indent:-.25in;}
@list l1
        {mso-list-id:492179624;
        mso-list-type:hybrid;
        mso-list-template-ids:2136234190 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:.75in;
        text-indent:-.25in;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></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 bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'>Hi</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'>I wrote a Nagios plugin but am facing some problem while executing the same from nagios. Below are the steps followed:</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'> </span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>      </span></span></span><![endif]><span style='font-size:12.0pt;font-family:"Garamond","serif"'>I wrote a java program that will invoke a Web service and calculate the time taken. This java program then writes back the outout to a text file.</span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>       </span></span><![endif]><span style='font-size:12.0pt;font-family:"Garamond","serif"'>I have a shell script which is executing the java program, read the text file generated and echo the output.</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'>       </span></span><![endif]><span style='font-size:12.0pt;font-family:"Garamond","serif"'>Defined a .cfg file to execute the shell script </span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.0in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>      define service{</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.5in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>     use                                local-service</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.5in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>     host_name                    localhost</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.5in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>     service_description       SHELL SCRIPT<br>check_command         check_search_time<br>normal_check_interval 1</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.0in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>}<br>define command{</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.0in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>    </span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>              </span><span style='font-size:12.0pt;font-family:"Garamond","serif"'> command_name check_search_time</span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:1.0in;text-indent:-.25in'><span style='font-size:12.0pt;font-family:"Garamond","serif"'>    </span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>              </span><span style='font-size:12.0pt;font-family:"Garamond","serif"'> command_line    </span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>$USER1$</span><span style='font-size:12.0pt;font-family:"Garamond","serif"'>/ws_search.sh<br>}<br><br></span><o:p></o:p></p><p class=MsoListParagraph style='margin-left:.75in;text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'>       </span></span><![endif]><span style='font-size:12.0pt;font-family:"Garamond","serif"'>Added above .cfg file entry in nagios.cfg file as<br>cfg_file=/usr/local/nagios/etc/objects/wssearch.cfg</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'>This shell script works file when execute</span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>d</span><span style='font-size:12.0pt;font-family:"Garamond","serif"'> the same as ‘Nagios’ User. But when check</span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>ed</span><span style='font-size:12.0pt;font-family:"Garamond","serif"'> the above configured service from ‘Nagios UI’. It says ‘<b>No output returned by plugin’</b> as well as there is no txt file generated by java program. </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'> </span><o:p></o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'>Please let us know </span><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'>I am</span><span style='font-size:12.0pt;font-family:"Garamond","serif"'> missing anything.</span><br><br><span style='font-size:12.0pt;font-family:"Garamond","serif";color:windowtext'><o:p></o:p></span></p><p class=MsoNormal><b><span style='color:windowtext'>Thanks In Advance<o:p></o:p></span></b></p><p class=MsoNormal><span style='color:windowtext'>Amarpal<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Garamond","serif"'> </span><o:p></o:p></p><p class=MsoNormal><br><br><o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p></div></body></html>