Xymon Mailing List Archive search

SCRIPT running twice

list Japheth Cleaver
Thu, 10 Dec 2015 12:59:20 -0800
Message-Id: <user-9ade96e1052a@xymon.invalid>

On 12/10/2015 10:37 AM, Ampinder Singh wrote:
Hello,


I'm having an issue here. I want to run an external script in Xymon. So i follow the docs.


I'm trying to run a test script that will for now just to an echo to a logfile.


Here is what I have done.


* In analysis.cfg

HOST=qcdvap1096
LOG /home/xymon/client4.3.17/logfile "testword"

* In client-local.cfg
[qcdvap1096]
log:/home/xymon/client4.3.17/logfile:2048
trigger error
#The logfile is on the client

* In alerts.cfg
HOST=qcdvap1096 SERVICE=msgs COLOR=red,purple
  #MAIL user-2e48c259ec7a@xymon.invalid COLOR=red REPEAT=2h
  #SCRIPT /home/xymon/server/scripts/connect.sh MAIL user-2e48c259ec7a@xymon.invalid COLOR=red
  SCRIPT /home/xymon/server/scripts/connect.sh MAIL user-2e48c259ec7a@xymon.invalid COLOR=red


I have created my test script on the server:
#Name of the script: connect.sh
#!/bin/bash
#This script on the server where Xymon is installed will call another script ont the client (qcdvap1096)

ssh xymon at 142.101.131.45 /home/xymon/client4.3.17/ext/test.sh


This is my script on the client (qcdvap1096) that gets called
#!/bin/bash
#Name of the script: test.sh
#Working line
#echo "it's down again" >> /home/xymon/client4.3.17/loggenerated.txt
echo "`date` "Server" "went" "out"" >> /home/xymon/client4.3.17/ampinder.txt

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

Here is the output of the log generated (/home/xymon/client4.3.17/loggenerated.tx)
Thu Dec 10 13:12:55 EST 2015 Server went out
Thu Dec 10 13:12:56 EST 2015 Server went out

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.

Could you please help me resolve this issue?
Thanks
Ajay
Hi Ajay,

That's an interesting bug there.

The format for the SCRIPT line there is incorrect. The line:
     SCRIPT /home/xymon/server/scripts/connect.sh MAIL user-2e48c259ec7a@xymon.invalid COLOR=red
should just be:
     SCRIPT /home/xymon/server/scripts/connect.sh user-2e48c259ec7a@xymon.invalid COLOR=red

You should be able to run xymoncmd xymond_alert --dump-config before and after to see the difference.

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.

-jc