<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 12/10/2015 10:37 AM, Ampinder Singh
wrote:<br>
</div>
<blockquote
cite="mid:SN1PR13MB0368FF44E583A0DAF507407192E90@SN1PR13MB0368.namprd13.prod.outlook.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hello,</p>
<p><br>
</p>
<p>I'm having an issue here. I want to run an external script in
Xymon. So i follow the docs. </p>
<p><br>
</p>
<p>I'm trying to run a test script that will for now just to an
echo to a logfile. </p>
<p><br>
</p>
<p>Here is what I have done. </p>
<p><br>
</p>
<p>* In analysis.cfg </p>
<div><span style="background-color: rgb(255, 255, 0);">HOST=qcdvap1096</span></div>
<div><span style="background-color: rgb(255, 255, 0);">
LOG /home/xymon/client4.3.17/logfile "testword"</span></div>
<div><span style="background-color: rgb(255, 255, 0);"><br>
</span></div>
<div>* In client-local.cfg</div>
<div>
<div><span style="background-color: rgb(255, 255, 0);">[qcdvap1096]</span></div>
<div><span style="background-color: rgb(255, 255, 0);">log:/home/xymon/client4.3.17/logfile:2048</span></div>
<div><span style="background-color: rgb(255, 255, 0);">trigger
error<br>
</span></div>
<div><span style="background-color: rgb(255, 255, 0);">#The
logfile is on the client </span></div>
<div><span style="background-color: rgb(255, 255, 0);"><br>
</span></div>
<div><span style="background-color: rgb(255, 255, 255);">* In
alerts.cfg</span></div>
<div><span style="background-color: rgb(255, 255, 0);"><span
style="font-size: 12pt;">HOST=qcdvap1096 SERVICE=msgs
COLOR=red,purple</span><br>
</span></div>
<div>
<div><span style="background-color: rgb(255, 255, 0);">
#MAIL <a class="moz-txt-link-abbreviated" href="mailto:ampinder.singh@cgi.com">ampinder.singh@cgi.com</a> COLOR=red REPEAT=2h</span></div>
<div><span style="background-color: rgb(255, 255, 0);">
#SCRIPT /home/xymon/server/scripts/connect.sh MAIL
<a class="moz-txt-link-abbreviated" href="mailto:ampinder.singh@cgi.com">ampinder.singh@cgi.com</a> COLOR=red</span></div>
<div><span style="background-color: rgb(255, 255, 0);">
SCRIPT /home/xymon/server/scripts/connect.sh MAIL
<a class="moz-txt-link-abbreviated" href="mailto:ampinder.singh@cgi.com">ampinder.singh@cgi.com</a> COLOR=red</span></div>
<div><span style="background-color: rgb(255, 255, 0);"><br>
</span></div>
<div><span style="background-color: rgb(255, 255, 0);"><br>
</span></div>
<div><span style="background-color: rgb(255, 255, 255);">I
have created my test script on the server: </span></div>
<div><span style="background-color: rgb(255, 255, 0);">#Name
of the script: connect.sh</span></div>
<div>
<div><span style="background-color: rgb(255, 255, 0);">#!/bin/bash</span></div>
<div><span style="background-color: rgb(255, 255, 0);">#This
script on the server where Xymon is installed will
call another script ont the client (qcdvap1096)</span></div>
<div><span style="background-color: rgb(255, 255, 0);"><br>
</span></div>
<div style=""><span style="background-color: rgb(255, 255,
0);">ssh <a class="moz-txt-link-abbreviated" href="mailto:xymon@142.101.131.45">xymon@142.101.131.45</a>
/home/xymon/client4.3.17/ext/test.sh</span></div>
<div style=""><span style="background-color: rgb(255, 255,
0);"><br>
</span></div>
<div style=""><span style="background-color: rgb(255, 255,
0);"><br>
</span></div>
<div style=""><span style="background-color: rgb(255, 255,
255);">This is my script on the client (qcdvap1096)
that gets called</span></div>
<div style="">
<div><span style="background-color: rgb(255, 255, 0);">#!/bin/bash</span></div>
<div><span style="background-color: rgb(255, 255, 0);">#Name
of the script: test.sh</span></div>
<div><span style="background-color: rgb(255, 255, 0);">#Working
line</span></div>
<div><span style="background-color: rgb(255, 255, 0);">#echo
"it's down again" >>
/home/xymon/client4.3.17/loggenerated.txt</span></div>
<div style=""><span style="background-color: rgb(255,
255, 0);">echo "`date` "Server" "went" "out""
>> /home/xymon/client4.3.17/ampinder.txt</span></div>
<div style=""><span style="background-color: rgb(255,
255, 0);"><br>
</span></div>
<div style=""><span style="background-color: rgb(255,
255, 255);">So I manually add the word "testword" on
logfile and it works my script gets called. But my
only issue is that the script gets run twice. Like a
second of eachother</span></div>
<div style=""><span style="background-color: rgb(255,
255, 255);"><br>
</span></div>
Here is the output of the log generated (/<span
style="font-family: Calibri, Arial, Helvetica,
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
NotoColorEmoji, 'Segoe UI Symbol', 'Android Emoji',
EmojiSymbols; font-size: 16px; background-color:
rgb(255, 255, 0);">home/xymon/client4.3.17/loggenerated.tx)</span></div>
<div style="">
<div>Thu Dec 10 13:12:55 EST 2015 Server went out</div>
<div>Thu Dec 10 13:12:56 EST 2015 Server went out</div>
<br>
</div>
<div style="">I dont know why it runs twice. I only want
it to run once. As soon, it's see the word "testword" it
should run it once. </div>
<div style=""><br>
</div>
<div style="">Could you please help me resolve this issue?</div>
<div style="">Thanks</div>
<div style="">Ajay</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Hi Ajay,<br>
<br>
That's an interesting bug there.<br>
<br>
The format for the SCRIPT line there is incorrect. The line:<br>
<span style="background-color: rgb(255, 255, 0);"> SCRIPT
/home/xymon/server/scripts/connect.sh MAIL <a class="moz-txt-link-abbreviated" href="mailto:ampinder.singh@cgi.com">ampinder.singh@cgi.com</a>
COLOR=red</span><br>
should just be:<br>
<span style="background-color: rgb(255, 255, 0);"> SCRIPT
/home/xymon/server/scripts/connect.sh <a class="moz-txt-link-abbreviated" href="mailto:ampinder.singh@cgi.com">ampinder.singh@cgi.com</a>
COLOR=red</span><br>
<br>
You should be able to run xymoncmd xymond_alert --dump-config before
and after to see the difference.<br>
<br>
That being said, that mis-parsing shouldn't be causing commented
lines to be read in improperly... So this is definitely a bug
*somewhere*. Thanks for catching it.<br>
<br>
-jc<br>
</body>
</html>