Xymon Mailing List Archive search

manually running custom script not changing the status

8 messages in this thread

list Deepak Deore · Thu, 2 May 2013 18:49:39 +0530 ·
I have a script which runs after 24 hrs interval, if we get an alert we
work on it and after resolving the issue I tried to run that custom script
manually but it didnt change the status into green.

I had to wait until its next run, i.e. after 24 hrs.

How can I run the custom script before its next run time which will change
the xymon status if the issue is resolved?
list Paul Root · Thu, 2 May 2013 13:28:33 +0000 ·
If you are running the script from tasks.cfg. You probably want to use xymoncmd to run the script, so you'll get the proper environment.
quoted from Deepak Deore

From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf Of deepak deore
Sent: Thursday, May 02, 2013 8:20 AM
To: xymon at xymon.com
Subject: [Xymon] manually running custom script not changing the status

I have a script which runs after 24 hrs interval, if we get an alert we work on it and after resolving the issue I tried to run that custom script manually but it didnt change the status into green.
I had to wait until its next run, i.e. after 24 hrs.
How can I run the custom script before its next run time which will change the xymon status if the issue is resolved?
list Deepak Deore · Thu, 2 May 2013 20:05:29 +0530 ·
ohh, forgot to mention. The script is set on client side so not related to
tasks.cfg
quoted from Paul Root


On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid>wrote:
 If you are running the script from tasks.cfg. You probably want to use
xymoncmd to run the script, so you’ll get the proper environment.****

** **

*From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] *On
Behalf Of *deepak deore
*Sent:* Thursday, May 02, 2013 8:20 AM
*To:* xymon at xymon.com
*Subject:* [Xymon] manually running custom script not changing the status*
***

** **

I have a script which runs after 24 hrs interval, if we get an alert we
work on it and after resolving the issue I tried to run that custom script
manually but it didnt change the status into green.****

I had to wait until its next run, i.e. after 24 hrs.****

How can I run the custom script before its next run time which will change
the xymon status if the issue is resolved?****
list Paul Root · Thu, 2 May 2013 16:05:48 +0000 ·
Well, if it runs outside of xymon, and that's how we do most of our custom scripts, then you need to make sure your environment is correct. So that the script knows the pertinent xymon information.

Did you possibly run the script as yourself vs root, and so it couldn't read the xymonclient.cfg file or something?

Without details and/or output of your hand running of the script, we can only guess. My guess is that you either didn't have path to the xymon command or you didn't have the server ip right in that command.
quoted from Deepak Deore

From: deepak deore [mailto:user-7b03b2a1ee70@xymon.invalid]
Sent: Thursday, May 02, 2013 9:35 AM
To: Root, Paul T
Cc: xymon at xymon.com
Subject: Re: [Xymon] manually running custom script not changing the status

ohh, forgot to mention. The script is set on client side so not related to tasks.cfg

On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid<mailto:user-76fdb6883669@xymon.invalid>> wrote:
If you are running the script from tasks.cfg. You probably want to use xymoncmd to run the script, so you'll get the proper environment.

From: xymon-bounces at xymon.com<mailto:xymon-bounces at xymon.com> [mailto:xymon-bounces at xymon.com<mailto:xymon-bounces at xymon.com>] On Behalf Of deepak deore
Sent: Thursday, May 02, 2013 8:20 AM
To: xymon at xymon.com<mailto:xymon at xymon.com>
Subject: [Xymon] manually running custom script not changing the status

I have a script which runs after 24 hrs interval, if we get an alert we work on it and after resolving the issue I tried to run that custom script manually but it didnt change the status into green.
I had to wait until its next run, i.e. after 24 hrs.
How can I run the custom script before its next run time which will change the xymon status if the issue is resolved?
list Michael Beatty · Thu, 02 May 2013 12:17:20 -0400 ·
Both the tasks.cfg and clientlaunch.cfg source in the xymon environment so any processes that are called they have access to the Xymon environement variables.  Your shell likely does not have access to those variables.  So when you run your script manually from the shell, if you are using the $XYMON, $XYMSRV, and $MACHINE environment variables in your script, the script will not have access to those variables.

In other words, the following command only works if called by xymon, not if executed from a shell:

$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`

My suggestion would be to add logic to the beginning of your script testing to make sure the $XYMON variable is not blank. If it is blank, come up with a way to set those variables, either by hard coding them, or by getting them from another location.

Michael Beatty
quoted from Deepak Deore

On 05/02/2013 10:35 AM, deepak deore wrote:
ohh, forgot to mention. The script is set on client side so not related to tasks.cfg


On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid <mailto:user-76fdb6883669@xymon.invalid>> wrote:

    If you are running the script from tasks.cfg. You probably want to
    use xymoncmd to run the script, so you'll get the proper environment.

    *From:*xymon-bounces at xymon.com <mailto:xymon-bounces at xymon.com>
    [mailto:xymon-bounces at xymon.com <mailto:xymon-bounces at xymon.com>]
quoted from Paul Root
    *On Behalf Of *deepak deore
    *Sent:* Thursday, May 02, 2013 8:20 AM

    *To:* xymon at xymon.com <mailto:xymon at xymon.com>
quoted from Paul Root
    *Subject:* [Xymon] manually running custom script not changing the
    status

    I have a script which runs after 24 hrs interval, if we get an
    alert we work on it and after resolving the issue I tried to run
    that custom script manually but it didnt change the status into green.

    I had to wait until its next run, i.e. after 24 hrs.

    How can I run the custom script before its next run time which
    will change the xymon status if the issue is resolved?

list Ralph Mitchell · Thu, 2 May 2013 19:26:23 -0400 ·
You can set up the environment properly by prefixing the script with
xymoncmd.  E.g.

/home/xymon/server/bin/xymoncmd  your_script,sh

Ralph Mitchell
quoted from Michael Beatty
On May 2, 2013 12:40 PM, "Root, Paul T" <user-76fdb6883669@xymon.invalid> wrote:
 Well, if it runs outside of xymon, and that’s how we do most of our
custom scripts, then you need to make sure your environment is correct. So
that the script knows the pertinent xymon information. ****

** **

Did you possibly run the script as yourself vs root, and so it couldn’t
read the xymonclient.cfg file or something?****

** **

Without details and/or output of your hand running of the script, we can
only guess. My guess is that you either didn’t have path to the xymon
command or you didn’t have the server ip right in that command.****

** **

*From:* deepak deore [mailto:user-7b03b2a1ee70@xymon.invalid]
*Sent:* Thursday, May 02, 2013 9:35 AM
*To:* Root, Paul T
*Cc:* xymon at xymon.com
*Subject:* Re: [Xymon] manually running custom script not changing the
status****

** **

ohh, forgot to mention. The script is set on client side so not related to
tasks.cfg****

** **

On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:****

If you are running the script from tasks.cfg. You probably want to use
xymoncmd to run the script, so you’ll get the proper environment.****

 ****

*From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] *On
Behalf Of *deepak deore
*Sent:* Thursday, May 02, 2013 8:20 AM
*To:* xymon at xymon.com
*Subject:* [Xymon] manually running custom script not changing the status*
***

 ****

I have a script which runs after 24 hrs interval, if we get an alert we
work on it and after resolving the issue I tried to run that custom script
manually but it didnt change the status into green.****

I had to wait until its next run, i.e. after 24 hrs.****

How can I run the custom script before its next run time which will change
the xymon status if the issue is resolved?****

** **

list Norbert Kriegenburg · Fri, 3 May 2013 09:34:32 +0200 ·
Hi,

what I always include in my scripts is a test mode snippet:

# Test-Mode ?
# TEST=0 => works in cooperation with Xymon agent (default)
# TEST=1 => for testing, results to stdout ("TEST=1 ./bb-testname.sh")
# TEST>1 => for testing, but sending results to Xymon server manually
TEST=${TEST:-"0"}
if [ "$TEST" != "0" ]
then
  # if TEST mode, we have to manually set the env
  BBHOME="$HOME/xymon/server"
  . $BBHOME/etc/xymonserver.cfg
  BBQUERYCMD=$BB
  [ "$TEST" = "1" ] && BB="echo"
fi

(based on my old BB scripts, read BBHOME=XYMONHOME)
Then I can easy do all manual testing with
TEST=1 $HOME/ext/testscript.sh
for stdout, and with TEST=2 for direct send to xymon server, if you want to
update the status manually, or check the html output.
(one line, no semicolon!)

Norbert


From:	Ralph Mitchell <user-00a5e44c48c0@xymon.invalid>
To:	Paul Root <user-76fdb6883669@xymon.invalid>,
Cc:	xymon at xymon.com
Date:	05/03/2013 01:26 AM
Subject:	Re: [Xymon] manually running custom script not changing the
            status
Sent by:	xymon-bounces at xymon.com
quoted from Ralph Mitchell


You can set up the environment properly by prefixing the script with
xymoncmd.  E.g.

/home/xymon/server/bin/xymoncmd  your_script,sh

Ralph Mitchell
On May 2, 2013 12:40 PM, "Root, Paul T" <user-76fdb6883669@xymon.invalid> wrote:

Well, if it runs outside of xymon, and that’s how we do most of our custom
scripts, then you need to make sure your environment is correct. So that
the script knows the pertinent xymon information.


Did you possibly run the script as yourself vs root, and so it couldn’t
read the xymonclient.cfg file or something?


Without details and/or output of your hand running of the script, we can
only guess. My guess is that you either didn’t have path to the xymon
command or you didn’t have the server ip right in that command.


From: deepak deore [mailto:user-7b03b2a1ee70@xymon.invalid]
Sent: Thursday, May 02, 2013 9:35 AM
To: Root, Paul T
Cc: xymon at xymon.com
Subject: Re: [Xymon] manually running custom script not changing the status


ohh, forgot to mention. The script is set on client side so not related to
tasks.cfg


On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:

If you are running the script from tasks.cfg. You probably want to use
xymoncmd to run the script, so you’ll get the proper environment.


From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf Of
deepak deore
Sent: Thursday, May 02, 2013 8:20 AM
To: xymon at xymon.com
Subject: [Xymon] manually running custom script not changing the status


I have a script which runs after 24 hrs interval, if we get an alert we
work on it and after resolving the issue I tried to run that custom script
manually but it didnt change the status into green.

I had to wait until its next run, i.e. after 24 hrs.

How can I run the custom script before its next run time which will change
the xymon status if the issue is resolved?
list Deepak Deore · Fri, 3 May 2013 18:32:46 +0530 ·
I ran xymon/server/bin/xymoncmd  your_script.sh which works for me (the
easiest way :-) )


On Fri, May 3, 2013 at 1:04 PM, Norbert Kriegenburg <
quoted from Norbert Kriegenburg
user-501bbe9c5409@xymon.invalid> wrote:
Hi,

what I always include in my scripts is a test mode snippet:

# Test-Mode ?
# TEST=0 => works in cooperation with Xymon agent (default)
# TEST=1 => for testing, results to stdout ("TEST=1 ./bb-testname.sh")
# TEST>1 => for testing, but sending results to Xymon server manually
TEST=${TEST:-"0"}
if [ "$TEST" != "0" ]
then
  # if TEST mode, we have to manually set the env
  BBHOME="$HOME/xymon/server"
  . $BBHOME/etc/xymonserver.cfg
  BBQUERYCMD=$BB
  [ "$TEST" = "1" ] && BB="echo"
fi

(based on my old BB scripts, read BBHOME=XYMONHOME)
Then I can easy do all manual testing with
TEST=1 $HOME/ext/testscript.sh
for stdout, and with TEST=2 for direct send to xymon server, if you want to
update the status manually, or check the html output.
(one line, no semicolon!)

Norbert


From:   Ralph Mitchell <user-00a5e44c48c0@xymon.invalid>
To:     Paul Root <user-76fdb6883669@xymon.invalid>,
Cc:     xymon at xymon.com
Date:   05/03/2013 01:26 AM
Subject:        Re: [Xymon] manually running custom script not changing the
            status
Sent by:        xymon-bounces at xymon.com


You can set up the environment properly by prefixing the script with
xymoncmd.  E.g.

/home/xymon/server/bin/xymoncmd  your_script,sh

Ralph Mitchell
On May 2, 2013 12:40 PM, "Root, Paul T" <user-76fdb6883669@xymon.invalid> wrote:

Well, if it runs outside of xymon, and that’s how we do most of our custom
scripts, then you need to make sure your environment is correct. So that
the script knows the pertinent xymon information.


Did you possibly run the script as yourself vs root, and so it couldn’t
read the xymonclient.cfg file or something?


Without details and/or output of your hand running of the script, we can
only guess. My guess is that you either didn’t have path to the xymon
command or you didn’t have the server ip right in that command.


From: deepak deore [mailto:user-7b03b2a1ee70@xymon.invalid]
Sent: Thursday, May 02, 2013 9:35 AM
To: Root, Paul T
Cc: xymon at xymon.com
Subject: Re: [Xymon] manually running custom script not changing the status


ohh, forgot to mention. The script is set on client side so not related to
tasks.cfg


On Thu, May 2, 2013 at 6:58 PM, Root, Paul T <user-76fdb6883669@xymon.invalid>
wrote:

If you are running the script from tasks.cfg. You probably want to use
xymoncmd to run the script, so you’ll get the proper environment.


From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf
Of
deepak deore
Sent: Thursday, May 02, 2013 8:20 AM
To: xymon at xymon.com
Subject: [Xymon] manually running custom script not changing the status


I have a script which runs after 24 hrs interval, if we get an alert we
work on it and after resolving the issue I tried to run that custom script
manually but it didnt change the status into green.

I had to wait until its next run, i.e. after 24 hrs.

How can I run the custom script before its next run time which will change
the xymon status if the issue is resolved?