[Xymon] export usage reports for management

Henrik Størner henrik at hswn.dk
Wed Jan 11 18:08:36 CET 2012


On 11-01-2012 17:43, Steve Holmes wrote:
> I know this isn't really what Xymon is designed to do, but I've been
> asked to produce data for a text based report of usage (cpu, memory, and
> disk weekly averages (which I've yet to convince them might not make
> sense)) from Xymon history or rrd data for management. The requester
> will put the data I provide into a spreadsheet.
>
> Before I go re-inventing the wheel I'm wondering if anyone has done
> something like this already.

perfdata.cgi - ships with Xymon 4.3.x. Dumps all of the data in the RRD 
files to a comma-separated file (CSV) that you can import into Excel for 
further processing.

Hmm, I see it isn't documented. Anyway, I do the extract once a month 
with this script:


#!/bin/sh

START=`date '+%Y%m01' --date="1 month ago"`
END=`date '+%Y%m01'`

xymoncmd perfdata.cgi $START $END 2>/dev/null | \
    gzip >~ftp/perfmonthly/data-$END.gz


If you only want to export data from a particular group of Xymon 
servers, perfdata.cgi takes a "--page=REGEXP" option to only extract 
data for hosts that appear on a page matching REGEXP (a regular 
expression). But it is surprisingly fast to export data from even a very 
large number of hosts.

There's also a "--csv=CHAR" option, in case your local Excel version 
uses another character than comma as the delimiter in CSV-files (around 
here, we use semi-colon...)

Here's an example of the data:

"hostname";"datasource";"rrdcolumn";"measurement";"time";"value"
"myserver01";"la.rrd";"la";"pctbusy";"20111201010000";2.753750
"myserver01";"la.rrd";"la";"pctbusy";"20111201030000";2.359861
"myserver01";"la.rrd";"la";"pctbusy";"20111201050000";3.428056
"myserver01";"la.rrd";"la";"pctbusy";"20111201070000";2.363194
"myserver01";"la.rrd";"la";"pctbusy";"20111201090000";3.246250

As you can see, it is a rather raw export of the RRD data with a 
timestamp on RRD datapoint - it doesn't do any aggregation/averaging 
over the past week. You'll have to do that yourself in Excel.

"pctbusy" means the "percent CPU busy". For Unix-systems, perfdata.cgi 
pulls data from the "vmstat" data, so you will also get a "percent busy" 
reading for those systems - not a "load average".

There are some other data items:

"myserver01";"memory.actual.rrd";"realmempct";"Virtual";"20111201010000";0.000000
"myserver01";"memory.real.rrd";"realmempct";"RAM";"20111201010000";49.708333
"myserver01";"memory.swap.rrd";"realmempct";"Swap";"20111201010000";23.416667

"Virtual", "RAM" and "Swap" correspond to the data-items you'll see on 
the "Memory" status in Xymon.

"myserver01";"disk,C.rrd";"pct";"/C";"20111201010000";77.000000

How full a disk is.


Note that since this pulls data directly from the RRD files, the 
granularity of the data depends on how old they are. If you pull data 
from the past week, you'll get 5-minute or 30-minute readings; if you 
pull data more than 48 days old, you'll only get 1-day averages.


Regards,
Henrik



More information about the Xymon mailing list