[Xymon] Client test script fails when run by xymon, works when run manually

Jeremy Laidman jlaidman at rebel-it.com.au
Wed May 18 23:19:21 CEST 2016


A few ideas:

Su to the xymon user first, then run bbcmd.

Run the command "env > /to/env" in the script and compare the file between
xymon running and you running.

Add "set -x" before the vboxmanage command and "set +x" after.

Cheers
Jeremy

On Wed, 18 May 2016, 14:31 More Grey <moregrey at gmail.com> wrote:

> Hello--
>
> I have a xymon client test script that runs fine, as scheduled, returning
> the appropriate results. I added an additional test to the script that
> fails when the script is run on schedule, but which succeeds when the
> script is run manually. The new test is a call to VirtualBox's VBoxManage
> command, to list the existing VMs. When run by xymon, it appears that the
> call to VBoxManage is not being sent all the parameters. If I change the
> command to just "VBoxManage", the command returns the help message for
> VBoxManage. If I change the command to "VBoxManage list", the command
> returns the help message for the "list" command. But the command
> "VBoxManage list vms" returns nothing. When the script is run manually or
> within bbcmd, the call to "VBoxManage list vms" works as expected.
>
> Below is a version of the script with just my new test (plus plenty of
> debugging info):
>
> #!/bin/sh
> # wrapper for firing off the client tests
>
> echo $(date) "!!! testing VBoxManage"
> echo $(date) "!!! HOBBITCLIENTHOME=$HOBBITCLIENTHOME"
> echo $(date) "!!! BBHOME=$BBHOME"
> echo $(date) "!!! calling VBoxManage:"
> /usr/lib/virtualbox/VBoxManage list vms
> echo $(date) "!!! return code = $?"
> echo $(date) "!!! after VBoxManage"
>
> When this script runs as part of normal xymon operation (every 5 minutes,
> in this case), I get the following output in my log file:
>
> Tue May 17 23:04:48 UTC 2016 !!! testing VBoxManage
> Tue May 17 23:04:48 UTC 2016 !!! HOBBITCLIENTHOME=/opt/mon/hobbit/client
> Tue May 17 23:04:48 UTC 2016 !!! BBHOME=/opt/mon/hobbit/client
> Tue May 17 23:04:48 UTC 2016 !!! calling VBoxManage:
> Tue May 17 23:04:48 UTC 2016 !!! return code = 0
> Tue May 17 23:04:48 UTC 2016 !!! after VBoxManage
>
> But when I run the script directly from the tests.d directory, or when I
> run it using bbcmd, I get the following output:
>
> 2016-05-17 23:08:46 Using default environment file
> /opt/mon/hobbit/client/etc/hobbitclient.cfg
> Tue May 17 23:08:46 UTC 2016 !!! testing VBoxManage
> Tue May 17 23:08:46 UTC 2016 !!! HOBBITCLIENTHOME=/opt/mon/hobbit/client
> Tue May 17 23:08:46 UTC 2016 !!! BBHOME=/opt/mon/hobbit/client
> Tue May 17 23:08:46 UTC 2016 !!! calling VBoxManage:
> "VM-00" {f428809a-e08e-2164-a52a-34405d323b18}
> "VM-01" {8d9d188f-3f80-4fe4-99b2-7b740b3bd841}
>     [ output omitted ]
> "VM-11" {77145415-2130-4280-84da-1b06e78a110f}
> "VM-12" {b91ae190-74a9-a4e7-9643-142fab9b29a9}
> Tue May 17 23:08:47 UTC 2016 !!! return code = 0
> Tue May 17 23:08:47 UTC 2016 !!! after VBoxManage
>
> I tried moving the VBoxManage command to a separate script and calling the
> script instead of the command; same behavior. I tried running the
> VBoxManage command in a subshell within the script; same behavior. Relying
> on the environment PATH or specifying the full path of the VBoxManage
> executable made no difference. If this were a permission problem, why would
> VBoxManage run at all (in the cases where it returns a help message)?
> What am I missing here?
> Thanks for any suggestions!
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20160518/cd2fbd8b/attachment.html>


More information about the Xymon mailing list