From 69dbd9d549b7a285ef3ffceee8e368680b756bf4 Mon Sep 17 00:00:00 2001 From: Edmondo Tommasina Date: Wed, 12 May 2010 14:39:03 +0200 Subject: Allow to define alternate options for rrdtool in config file Since I'm using a non standard installation of rrdtool, I always have to define the --font options when colling the rrdtool binary. I tried to implement this change in a general way to define locally rrdtool options in the config.local.php. Signed-off-by: Edmondo Tommasina --- conf/config.php | 3 +++ type/Default.class.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/conf/config.php b/conf/config.php index d31b129..a36c083 100644 --- a/conf/config.php +++ b/conf/config.php @@ -9,6 +9,9 @@ $CONFIG['datadir'] = '/var/lib/collectd/rrd'; # rrdtool executable $CONFIG['rrdtool'] = '/usr/bin/rrdtool'; +# rrdtool special options +$CONFIG['rrdtool_opts'] = ''; + # category of hosts to show on main page #$CONFIG['cat']['category1'] = array('host1', 'host2'); diff --git a/type/Default.class.php b/type/Default.class.php index 20b2745..c08745d 100644 --- a/type/Default.class.php +++ b/type/Default.class.php @@ -5,6 +5,7 @@ class Type_Default { var $datadir; var $rrdtool; + var $rrdtool_opts; var $cache; var $args; var $seconds; @@ -26,6 +27,7 @@ class Type_Default { function __construct($config) { $this->datadir = $config['datadir']; $this->rrdtool = $config['rrdtool']; + $this->rrdtool_opts = $config['rrdtool_opts']; $this->cache = $config['cache']; $this->parse_get(); $this->rrd_files(); @@ -156,6 +158,8 @@ class Type_Default { function rrd_options() { $rrdgraph[] = $this->rrdtool; $rrdgraph[] = 'graph - -a PNG'; + if ($this->rrdtool_opts != '') + $rrdgraph[] = $this->rrdtool_opts; $rrdgraph[] = sprintf('-w %d', is_numeric($this->width) ? $this->width : 400); $rrdgraph[] = sprintf('-h %d', is_numeric($this->heigth) ? $this->heigth : 175); $rrdgraph[] = '-l 0'; -- cgit v1.1