<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:10pt;font-family:Sans">
<p></p>
<p>Hello List </p>
<p></p>
<p>I am trying to write a <span style="color:#ff0000">plugin</span> to count the number of connection of a specific type on a port .</p>
<p>I wrote the script that gives me the output i require and running the script on the machine i need it it works well .</p>
<p></p>
<p>The problem is when i am trying to execute the script via <span style="color:#ff0000">NPRE</span> , i added the command and <span style="color:#ff0000">params</span> to the <span style="color:#ff0000">nrpe</span>.<span style="color:#ff0000">cfg</span> and run the test , and the result returning to the nagios server is always a numeric  "0" , when i put a text string  it returns the string no problem , but when i try to add a number from a <span style="color:#ff0000">variable</span> , it shows only 0 .</p>
<p></p>
<p>actuall script line :</p>
<p></p>
<p>if [ "$1" = "2598" ]; then</p>
<p>        W=`lsof -Pn -i | grep squid | grep ESTABLISHED | grep -v 127.0.0.1 | grep 2598 | wc -l`</p>
<p>        echo "Number of connections is "$W</p>
<p>        exit 0</p>
<p>fi</p>
<p></p>
<p>from the messages log :</p>
<p>Running command: /usr/lib/nagios/plugins/check_squid_citrix.sh 2598</p>
<p>Mar 18 14:18:46  host nrpe[3869]: Command completed with return code 3 and output: Number of connections is 0</p>
<p></p>
<p>running from the nagios server: </p>
<p></p>
<p>../libexec/check_nrpe -H X.X.X.X -c check_2598</p>
<p>Number of connections is 0</p>
<p></p>
<p>Manual execution on tartget server: </p>
<p>sh -x  /usr/lib/nagios/plugins/check_squid_citrix.sh 2598</p>
<p>+ '[' 2598 = 1494 ']'</p>
<p>+ '[' 2598 = 2598 ']'</p>
<p>++ lsof -Pn -i</p>
<p>++ grep squid</p>
<p>++ grep ESTABLISHED</p>
<p>++ grep -v 127.0.0.1</p>
<p>++ grep 2598</p>
<p>++ wc -l</p>
<p>+ W=83</p>
<p>+ echo 'Number of connections is 83'</p>
<p>Number of connections is 83</p>
<p>+ exit 0</p>
<p></p>
<p>Any ideas why i am only getting the  0 output ?</p>
<p></p>
<p>-- </p>
<p><span style="color:#ff0000">Assaf</span> <span style="color:#ff0000">Flatto</span></p>
<p><span style="color:#ff0000">SSP</span> Ops Team</p>
<p>Linux System Administrator</p>
<p>169 <span style="color:#ff0000">Euston</span> Road, London, NW1 2<span style="color:#ff0000">AE</span></p>
<p></p>
<p></p>

<br>
<font size=-2>
<br>
<br>
<br>
<p>IMPORTANT . this email and the information in it may be confidential, legally
privileged and/or protected by law. It is intended solely for the use of the
person to whom it is addressed. If you are not the intended recipient, please
notify the sender immediately and do not disclose the contents to any other
person, use it for any purpose, or store or copy the information in any medium.
Please also delete all copies of this email and any attachments from your
system.</p>

<p>We cannot guarantee the security or confidentiality of email communications. We
do not accept any liability for losses or damages that you may suffer as a
result of your receipt of this email including but not limited to computer
service or system failure, access delays or interruption, data non-delivery or
mis-delivery, computer viruses or other harmful components.</p>

<p>Copyright in this email and any attachments belong to Select Service Partner UK
Limited. Should you communicate with anyone at Select Service Partner UK Limited by
email, you consent to us monitoring and reading any such correspondence.</p>

<p>Nothing in this email shall be taken or read as suggesting, proposing or
relating to any agreement concerted practice or other practice that could
infringe UK or EC competition legislation.</p>

<p>Select Service Partner UK Limited is a company registered in England and Wales<br>
(company number 05687183) whose registered office is at 1 The Heights, Brooklands, Weybridge. Surrey. KT13 0NY</p>
<br> 
<br>
</body></html>