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/processes.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'plugin/processes.php') diff --git a/plugin/processes.php b/plugin/processes.php index dca00b7..c66d3fb 100644 --- a/plugin/processes.php +++ b/plugin/processes.php @@ -63,7 +63,8 @@ switch($obj->args['type']) 'value' => '0000ff', ); $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; break; case 'ps_count': @@ -105,7 +106,8 @@ switch($obj->args['type']) 'write' => '00b000', ); $obj->rrd_title = sprintf('Disk Traffic (%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; break; case 'ps_disk_ops': @@ -130,7 +132,8 @@ switch($obj->args['type']) 'value' => '0000ff', ); $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; break; case 'ps_pagefaults': @@ -155,7 +158,8 @@ switch($obj->args['type']) 'value' => '0000ff', ); $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; break; case 'ps_stacksize': @@ -166,7 +170,8 @@ switch($obj->args['type']) 'value' => '0000ff', ); $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; break; case 'ps_vm': @@ -177,7 +182,8 @@ switch($obj->args['type']) 'value' => '0000ff', ); $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']); - $obj->rrd_vertical = 'Bytes'; + $obj->rrd_vertical = ucfirst($CONFIG['datasize']); + $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; break; } -- cgit v1.1