[Xymon] Automated Reports

Henrik Størner henrik at hswn.dk
Thu Dec 8 18:30:45 CET 2011


On 08-12-2011 16:10, David Cunningham wrote:

> we need an automated system that once per month will send an email with the event history for EACH circuit we monitor.  I can see how to generate reports that give a percentage of the overall uptime.  However, I need the actual history.
>
> For example, on connectivity monitoring, if the site went down for 5 minutes on the 5th of the month and for 10 minutes on the 15th of the month, I need the report to basically show exactly this information.
>
> If there were no events for that month, the entry should still be listed, just with no events.

The standard Xymon report provides a text-based report - I think you 
could use that. It looks like this: 
http://www.xymon.com/xymon/rep/avail-newark.hswn.dk-ssh-1323364609-30162.txt

There is a "xymonreports.sh" script included with Xymon, that you can 
run from cron to generate these reports automatically each month.

If that is not enough, then you need to do some work yourself. The 
historical data can be found in the ~xymon/data/hist/HOSTNAME.COLUMNNAME 
file (with any dots in the hostname changed into commas) - this is a 
text file. Here is a snippet of the data from the same "ssh" status that 
is in the report-link above:

Thu Oct 20 04:35:04 2011 green 1319078104 1486891
Sun Nov  6 08:36:35 2011 red 1320564995 204
Sun Nov  6 08:39:59 2011 green 1320565199 19702
Sun Nov  6 14:08:21 2011 red 1320584901 150
Sun Nov  6 14:10:51 2011 green 1320585051 208142
Tue Nov  8 23:59:53 2011 red 1320793193 26870
Wed Nov  9 07:27:43 2011 green 1320820063 1809
Wed Nov  9 07:57:52 2011 red 1320821872 121486891
Wed Nov  9 07:58:04 2011 green 1320821884 1794

The file is updated whenever the status-color changes; so there is a 
timestamp, the new color, an epoch timestamp (same as the human-readable 
one, but in Unix epoch form), and the duration (in seconds) of the 
status. So the first line says that the status went green on Oct 20 
04:35:04, and it stayed green for 1486891 seconds. If you add this up:
    $ date --date="Oct 20 04:35:04 2011 + 1486891 seconds"
    Sun Nov  6 08:36:35 CET 2011
which matches the next timestamp. So Sunday morning Nov 6 at 08:36:35 
the status changed to red, and this lasted 204 seconds. Etc. etc. etc.


Regards,
Henrik



More information about the Xymon mailing list