[Xymon] XyMon client version

Jeremy Laidman jlaidman at rebel-it.com.au
Mon Aug 26 04:51:38 CEST 2013


On 23 August 2013 20:52, Andrey Chervonets <A.Chervonets at cominder.eu> wrote:

> Version can be easy detected at client side like with
> cmd:
>          echo `hostname`:`./xymon  2>&1 | grep "version"`
> out:
>         realhostname:Xymon version 4.3.5
>

You can also do "xymon --version".

so we just need to loop through all hosts and execute such call.
>
> But this is quite inconvenient (most target hosts will not have
> passwordless ssh connection setup).
>

You can do this automatically with a pseudo-file test in client-local.cfg.
 More on this below.


> May be XyMon developers can implement new metric test  "xymonver" which,
> depending on settings will show in web UI:
> a) just version of xymon client installed
>

This is available in the "info" status page, under "Client S/W".  It is
extracted by xymond from the [clientversion] section in the client message.
 In most installations, this isn't actually working, because it's part of
the automated client update process, although you should see it on your
Xymon server.  But it can be added by doing some tweaks on the client side,
either creating an entry in clientlaunch.cfg, or updating the
xymonclient.sh script to get its value of CLIENTVERSION from `$XYMON
--version` instead of the output of "clientupdate --level").  It can also
be simulated using the pseudo-file test I mentioned, and I prefer this
because it requires no adjustments on the client side.


> b) red, yellow or green depending on how old version is instaled compared
> with
>         * xymon server version
>         * or maximum version detected in all target servers
>

This could be a useful feature.  Although for some people, it's acceptable
to be behind one or two releases, rather than every client having exactly
the same version.  This could be implemented entirely server-side, as log
as the client is reporting its version in the client message.

The client update feature is facilitated by setting a client version string
in client-local.cfg.  So this version could be extracted and used to
compare the current version against the expected version, and warning when
it does not match.


> If this is too complex, may be add client version to "info" repost like
> this is done for OS?
>

To add the client version into "info" (via the client message), add the
following pseudo-file definition to the client-local.cfg file into a
suitable location in the file:

file:`( echo "client/xymonversion $MACHINE.$OSTYPE"; echo
"[clientversion]"; $XYMON --version ) | $XYMON $XYMSRV @ >/dev/null`

After 10 minutes or so, the client will start running the command in
backticks, attempting to get a dynamic filename to monitor.  It always
shows nothing so no additional file gets monitored.  But the side-effect of
running the command is to create a client message that populates the
[clientversion] section of the client data, with the output of "xymon
--version".  Once it runs, you should see something useful in the
[clientversion] section, and as a result, the "info" status page for the
server should start showing the client version string.

Note that this requires that Xymond support collector IDs (the bit after
the "client/" text - in this case "xymonversion" is the collector ID).
 This was introduced in Xymon version 4.3.0-beta3, when the "bb" binary
changed name to "xymon".  If your server is newer than this, you should be
OK to use this method.

Once you're getting the version number, you could turn it into an alarm
with a bit of scripting on the server side, getting the current version
with a "clientlog" message and the required version from client-local.cfg
with a dummy client message.  Something like this (mostly untested):

#!/bin/sh
[ "$XYMON" -a "$XYMSRV" -a "$MACHINE" ] || { echo "Run via xymoncmd or
xymonlaunch">&2; exit 1; }
REQVER=`$XYMON $XYMSRV "client/dummy $MACHINE.$SERVEROSTYPE $CONFIGCLASS" |
sed -n '/^clientversion:/s/^clientversion://p'`
CURVER=`$XYMON $XYMSRV "clientlog $MACHINE section=clientversion"|sed -n
'/^Xymon version/s/^Xymon version //p'`
if [ "$REQVER" = "" -o "$CURVER" = "" ]; then
  $XYMON $XYMSRV "status $MACHINE.ver clear Unable to get either current
version [$CURVER] or required version [$REQVER] of client"
elif [ "$REQVER" = "$CURVER" ]; then
  $XYMON $XYMSRV "status $MACHINE.ver green Client version $CURVER"
else
  $XYMON $XYMSRV "status $MACHINE.ver red Client version $CURVER does not
match $REQVER"
fi

Cheers
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20130826/310b5325/attachment.html>


More information about the Xymon mailing list