graphs.cfg - Configuration of the showgraph CGI
$XYMONHOME/etc/graphs.cfg
showgraph.cgi(1) uses the configuration file $XYMONHOME/etc/graphs.cfg to build graphs from the RRD files collected by Xymon.
Each definition of a graph type begins with a "[SERVICE]" indicator, this is the name passed as the "service" parameter to showgraph.cgi(1). If the service name passed to showgraph.cgi is not found, it will attempt to match the service name to a graph via the TEST2RRD environment variable. So calling showgraph.cgi with "service=cpu" or "service=la" will end up producing the same graph.
A graph definition needs to have a TITLE and a YAXIS setting. (The X-axis is always time-based).
If a fixed set of RRD files are used for the graph, you just write those in the RRDtool definitions. Note that Xymon keeps all RRD files for a host in a separate directory per host, so you need not worry about the hostname being part of the RRD filename.
For graphs that use multiple RRD files as input:
When FNPATTERN is used, you can use
For a bundle viewed one service at a time (e.g. "tcp:conn"), FNPATTERN capture group 1 must be exactly the service component: showgraph uses it both as the legend (@RRDPARAM@) and to select the single service - see "[tcp]", where "^tcp.(.+).rrd" captures "conn" from tcp.conn.rrd.
The remainder of the lines in each definition are passed directly to the RRDtool rrd_graph() routine.
The following is an example of how the "la" (cpu) graph is defined. This is a simple definition that uses a single RRD-file, la.rrd:
[la]
TITLE CPU Load
YAXIS Load
DEF:avg=la.rrd:la:AVERAGE
CDEF:la=avg,100,/
AREA:la#00CC00:CPU Load Average
-u 1.0
GPRINT:la:LAST: \: %5.1lf (cur)
GPRINT:la:MAX: \: %5.1lf (max)
GPRINT:la:MIN: \: %5.1lf (min)
GPRINT:la:AVERAGE: \: %5.1lf (avg)\n
Here is an example of a graph that uses multiple RRD-files, determined automatically at run-time via the FNPATTERN setting. Note how it uses the @RRDIDX@ to define a unique RRD parameter per input-file, and the @COLOR@ and @RRDPARAM@ items to pick unique colors and a matching text for the graph legend:
[disk]
FNPATTERN ^disk(.*).rrd
TITLE Disk Utilization
YAXIS % Full
DEF:p@RRDIDX@=@RRDFN@:pct:AVERAGE
LINE2:p@RRDIDX@#@COLOR@:@RRDPARAM@
-u 100
-l 0
GPRINT:p@RRDIDX@:LAST: \: %5.1lf (cur)
GPRINT:p@RRDIDX@:MAX: \: %5.1lf (max)
GPRINT:p@RRDIDX@:MIN: \: %5.1lf (min)
GPRINT:p@RRDIDX@:AVERAGE: \: %5.1lf (avg)\n
Normally the title of a graph is a static text defined in the graphs.cfg file. However, there may be situations where you want to use different titles for the same type of graph, e.g. if you are incorporating RRD files from MRTG into Xymon. In that case you can setup the TITLE definition so that it runs a custom script to determine the graph title. Like this:
TITLE exec:/usr/local/bin/graphitle
The /usr/local/bin/graphtitle command is then called with the hostname, the graphtype, the period string, and all of the RRD files used as parameters. The script must generate one line of output, which is then used as the title of the graph. Each of the RRD pathname parameters will be enclosed in double quotes.
Most of the RRD graph definitions shipped with Xymon have been ported from the definitions in the larrd-grapher.cgi CGI from LARRD 0.43c.
xymonserver.cfg(5), rrdtool(1), rrdgraph(1)