Xymon Mailing List Archive search

How to retrieve the global state of Xymon?

5 messages in this thread

list Wim Nelis · Fri, 16 Feb 2024 15:48:14 +0100 ·

Hello,


my current project is (trying to) display the global state of Xymon, that is the state (colour) shown in the main view. A sort of a traffic light is used, which is controlled by an ESP8266 micro controller running microPython.


This state must be determined from the states of all the tests, which can be retrieved using the 'xymondboard' command. As far as I know, there is no other way of retrieving the global state of Xymon. Is this correct?


The NOPROP* tags seem complicate things. One can retrieve the tag(s) per host, using f.i. 'xymondboard fields=...,XMH_NOPROPRED', but the tag is shown, not the result of combining it with the command line parameters of xymongen. Is there another way of retrieving this information?


Kind regards,

  Wim Nelis.

list Tom Schmidt · Fri, 16 Feb 2024 09:09:46 -0700 ·
You could simply look for the '<BODY class="green">' line in the
~xymon/server/www/nongreen.html or xymon.html file.  The color shown for
the "class" will match the overall state.  A simple script could be written
to run on your xymon server to gather this and send it to your monitor.

Tom

On Fri, Feb 16, 2024 at 8:16?AM Wim Nelis via Xymon <xymon at xymon.com> wrote:
---------- Forwarded message ----------
From: Wim Nelis <user-5c5b902249f8@xymon.invalid>
To: xymon at xymon.com
Cc:
Bcc:
Date: Fri, 16 Feb 2024 15:48:14 +0100
Subject: How to retrieve the global state of Xymon?
quoted from Wim Nelis

Hello,


my current project is (trying to) display the global state of Xymon, that
is the state (colour) shown in the main view. A sort of a traffic light is
used, which is controlled by an ESP8266 micro controller running
microPython.


This state must be determined from the states of all the tests, which can
be retrieved using the 'xymondboard' command. As far as I know, there is no
other way of retrieving the global state of Xymon. Is this correct?


The NOPROP* tags seem complicate things. One can retrieve the tag(s) per
host, using f.i. 'xymondboard fields=...,XMH_NOPROPRED', but the tag is
shown, not the result of combining it with the command line parameters of
xymongen. Is there another way of retrieving this information?


Kind regards,

  Wim Nelis.


---------- Forwarded message ----------
From: Wim Nelis via Xymon <xymon at xymon.com>
To: xymon at xymon.com
Cc:
Bcc:
Date: Fri, 16 Feb 2024 15:48:14 +0100
Subject: [Xymon] How to retrieve the global state of Xymon?

list Jeremy Laidman · Sun, 18 Feb 2024 15:30:29 +1100 ·
It's also possible to get the colour from the <TITLE> tag in the <HEAD>
section. The colour is shown immediately after <TITLE>. This is how the old
BBTray tool finds the colour to display in the Windows system tray. I'd
recommend using Tom's technique, but there's a chance your ESP-based client
might (for some reason?) find it easier to parse <TITLE> rather than <BODY>.

In case it wasn't clear, the overall Xymon status is reflected in the
colour of (and tagged within) the main page ("/index.html" or "/") as well
as the non-green page ("/nongreen.html"). If you only want the colour, then
fetching one of these pages and parsing out the colour from the TITLE or
BODY tags is going to be the simplest way.

J
quoted from Tom Schmidt

On Sat, 17 Feb 2024 at 03:10, Tom Schmidt <user-d34f6118b459@xymon.invalid> wrote:
You could simply look for the '<BODY class="green">' line in the
~xymon/server/www/nongreen.html or xymon.html file.  The color shown for
the "class" will match the overall state.  A simple script could be written
to run on your xymon server to gather this and send it to your monitor.

Tom

On Fri, Feb 16, 2024 at 8:16?AM Wim Nelis via Xymon <xymon at xymon.com>
wrote:
---------- Forwarded message ----------
From: Wim Nelis <user-5c5b902249f8@xymon.invalid>
To: xymon at xymon.com
Cc:
Bcc:
Date: Fri, 16 Feb 2024 15:48:14 +0100
Subject: How to retrieve the global state of Xymon?

Hello,


my current project is (trying to) display the global state of Xymon, that
is the state (colour) shown in the main view. A sort of a traffic light is
used, which is controlled by an ESP8266 micro controller running
microPython.


This state must be determined from the states of all the tests, which can
be retrieved using the 'xymondboard' command. As far as I know, there is no
other way of retrieving the global state of Xymon. Is this correct?


The NOPROP* tags seem complicate things. One can retrieve the tag(s) per
host, using f.i. 'xymondboard fields=...,XMH_NOPROPRED', but the tag is
shown, not the result of combining it with the command line parameters of
xymongen. Is there another way of retrieving this information?


Kind regards,

  Wim Nelis.


---------- Forwarded message ----------
From: Wim Nelis via Xymon <xymon at xymon.com>
To: xymon at xymon.com
Cc:
Bcc:
Date: Fri, 16 Feb 2024 15:48:14 +0100
Subject: [Xymon] How to retrieve the global state of Xymon?

list Wim Nelis · Sun, 18 Feb 2024 11:56:33 +0100 ·
Thanks for the quick replies.

In the initial version of this (small) project, only the global status (colour) is of interest. An idea for a next version is to encode the 'life time' of the current status roughly in the blinking frequency of the traffic light. In this case the 'life time' will be defined as the time elapsed since the (currently) last test entering the current colour state. The latter function is almost certain not doable within the limited resources of the micro controller.

As for the initial version: trying to retrieve the global status on such a small machine (probably using a regular expression to find and extract the state) is part of the fun. The non-green page will probably be the shortest of the pages which contain the global status of Xymon and thus the best candidate for retrieval of the status.

Kind regards,
  Wim Nelis.


On 2024.02.18 05:30, Jeremy Laidman wrote:
It's also possible to get the colour from the
list Henrik Størner · Sun, 18 Feb 2024 12:19:15 +0100 ·

Another possibility is to fetch the Xymon "board" data from xymond. If you run a command

   xymon XYMONSERVERIP "xymondboard color=red"

it will retrieve all of the "status red" items. Similar with yellow (and the other colors). Add a "| wc -l" and you get the number of items.


Regards,

Henrik


Den 18.02.2024 kl. 11.56 skrev Wim Nelis via Xymon:

Xymon@xymon.com