From fd04134830d3111c137b47c7ba25a049ab597715 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Fri, 10 Aug 2012 18:56:30 +0200 Subject: introduce config option datasize to show graphs in bits or bytes Config setting $CONFIG['datasize'] can be set to bits or bytes to show graph data in bits or bytes. Inspired-by: Neptune Ning (Plan) --- plugin/vserver.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugin/vserver.php') diff --git a/plugin/vserver.php b/plugin/vserver.php index 57687e3..e51d97d 100644 --- a/plugin/vserver.php +++ b/plugin/vserver.php @@ -51,7 +51,8 @@ switch($obj->args['type']) { $obj->heigth = $heigth; $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; $obj->rrd_format = '%5.1lf%s'; collectd_flush($obj->identifiers); @@ -104,7 +105,8 @@ switch($obj->args['type']) { 'unspec-tx' => '000080', ); $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes per second'; + $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize'])); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; $obj->width = $width; $obj->heigth = $heigth; $obj->rrd_format = '%5.1lf%s'; -- cgit v1.1