Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
GRAFFER(8)		    System Manager's Manual		    GRAFFER(8)

NAME
       graffer -- collect numeric values and generate graphs

SYNOPSIS
       graffer	 [-c   config]	 [-C   configdir]   [-d	 database]  [-f	 file]
	       [-g number:timeframe] [-q] [-p] [-t -days[:days]]

DESCRIPTION
       The graffer utility can collect numeric values from  external  programs
       and produce graphs from the collected data.

       The options are as follows:

       -q	    Query  the current values from described external programs
		    and	store them in the database.  This is usually done from
		    a crontab(5) like this:

		    * *	* * * /usr/local/bin/graffer -q

		    Note that without  regular	truncating  (see  below),  the
		    database will grow continually.

       -p	    Produce  the  configured  set of graph images based	on the
		    statistics collected beforehand.

       -g number:timeframe
		    Get	stored values from the database	for collect number ac-
		    cording to the time	frame and print	them to	stdout.	 Shows
		    queue  with	last 16	or less	calculated records, time frame
		    maximum value, time	frame average value,  current  maximum
		    value  and	current	 average value according to the	queue.
		    Examples:

		    graffer -c /usr/local/etc/graffer/graffer.conf -g '7:from 3	hours to now'
		    graffer -c /usr/local/etc/graffer/graffer.conf -g '12:from 50 minutes to 30	minutes'
		    graffer -c /usr/local/etc/graffer/graffer.conf -g '23:from 52 weeks	to 40 weeks'

       -t days:[days]
		    Truncate the database, removing  entries  older  than  the
		    specified  number of days.	The first value	applies	to un-
		    compressed entries which constitute	roughly	90 percent  of
		    the	database, the second value to compressed entries.  Un-
		    compressed	entries	 are  needed  only for high-resolution
		    graphs over	short time periods.

		    Assuming statistics	are queried every  I  seconds,	and  a
		    graph  of  width W pixels covering a time period of	T sec-
		    onds is generated, then uncompressed entries are only used
		    when T/I < W*10.

		    In other words, removing uncompressed entries earlier than
		    compressed ones drastically	 reduces  the  database	 size.
		    Graphs  can	 be  generated	over the entire	time range the
		    compressed entries cover (monthly or yearly	 graphs),  and
		    high  resolution graphs over short time periods in the re-
		    cent past don't lose  any  precision.   The	 precision  is
		    gradually lost for older periods.

		    A typical invokation would be

		    graffer -t 31:365

		    This  removes  uncompressed	entries	older than a month and
		    compressed entries older than a year, allowing  generation
		    of graphs up to one	year into the past, while keeping full
		    precision for one month.

		    Note  that truncating the database does not	usually	shrink
		    the	size of	the database file.  Removed entries  are  only
		    marked  as deleted and their space is later	reused for new
		    entries.

       -f file	    Copy the database into a new file,	skipping  removed  and
		    invalid  entries.	This operation takes longer than trun-
		    cating, but	produces a smaller database  file.   This  can
		    also  be  used  to recover data from a corrupted database,
		    indicated by the following error during truncating:

		    data_truncate: db->del() returned 1
		    main: data_truncate() failed

       -c config    Use	the specified configuration file instead  of  the  de-
		    fault /usr/local/etc/graffer/graffer.conf.	Syntax:

		    collect = "collect"	number = coldef	.
		    coldef  = (	"path to external program" ) [ "tdiff" | "vdiff"].
		    image   = "image" filename "{"
				  time theme size [ left ] [ right ] "}" .
		    time    = "from" number [ unit ] [ "to" number [ unit ] ] .
		    unit    = "minutes"	| "hours" | "days" | "weeks" | "months"	|
					  "years" .
		    theme   = "theme" (	"white"	| "black" ) .
		    size    = "width" number "height" number .
		    left    = "left" graphs .
		    right   = "right" graphs .
		    graphs  = graph [ "," graphs ] .
		    graph   = "graph" number [ "bps" ] [ "avg" | "min" | "max" ]
				      label unit "color" red green blue	[ "filled" ] .

		    collect lines define what values to	store in the database.
		    Each  definition should use	a unique number, which is used
		    in graph lines to reference	those values.

		    The	tdiff option causes  differential  values  (change  of
		    value per second) to be stored instead of absolute values.
		    For	 example, storing interface byte counters (which count
		    the	number of bytes	since last reset) differentially  pro-
		    duces  values  representing	 current speed (bytes per sec-
		    ond).

		    Several images can be defined in the same config file.  An
		    image can include two independent y-axes,  both  of	 which
		    auto-scale	independently  to the maximum value in the se-
		    lected range.  Each	axis can display an  arbitrary	number
		    of graphs.

		    The	vdiff option causes absolute differential values to be
		    stored  instead  of	absolute values.  For example, storing
		    interface packet counters (which count the number of pack-
		    ets	since last reset).

		    When the bps option	is  used,  values  are	multiplied  by
		    eight,  and	the unit prefixes 'k' (kilo), 'm' (mega), etc.
		    are	multiples of 1024, instead of 1000.

       -C configdir
		    Config directory. Use all files from  this	directory  in-
		    stead of the default /usr/local/etc/graffer/graffer.conf.

       -d database  Database file.  Default is /var/db/graffer.db.

EXAMPLES
       collect 1 = "/usr/local/bin/statgrab -u net.sis0.rx" tdiff
       collect 2 = "/usr/local/bin/statgrab -u net.sis0.tx" tdiff
       image "/var/www/htdocs/bandwidth.png" {
	       from 7 days to now
	       width 1000 height 400
	       left
		       graph 1 bps "in"	"bits/s" color 0 192 0 filled
	       right
		       graph 2 bps "out" "bits/s" color	0 0 255
       }
       collect 3 = "/usr/local/etc/graffer/scripts/freebsd/netstat.sh rl0 in" tdiff
       collect 4 = "/usr/local/etc/graffer/scripts/freebsd/disk.sh /dev/ad0 temp"
       image "/var/www/htdocs/rl0.png" {
	       from 12 months to now
	       theme black
	       width 800 height	200
	       left
		       graph 3 bps "states" "entries" color 200	0 0 filled,
	       right
		       graph 4 "ad0" "temperature" color 0 0 255
       }

SEE ALSO
       crontab(5)

FreeBSD	ports 15.quarterly    September	16, 2025		    GRAFFER(8)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=graffer&sektion=8&manpath=FreeBSD+Ports+15.1.quarterly>

home | help