diff options
author | Pim van den Berg | 2012-08-10 18:56:30 +0200 |
---|---|---|
committer | Pim van den Berg | 2012-08-10 19:00:16 +0200 |
commit | fd04134830d3111c137b47c7ba25a049ab597715 (patch) | |
tree | c2390f06640f2127ab3e987cd3bdaf1d639b3dc2 /plugin/vserver.php | |
parent | type: add scale support to default/generic stacked types (diff) | |
download | apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.zip apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.gz apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.bz2 apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.xz |
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) <frostyplanet@gmail.com>
Diffstat (limited to 'plugin/vserver.php')
-rw-r--r-- | plugin/vserver.php | 6 |
1 files changed, 4 insertions, 2 deletions
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']) { | |||
51 | $obj->heigth = $heigth; | 51 | $obj->heigth = $heigth; |
52 | 52 | ||
53 | $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); | 53 | $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); |
54 | $obj->rrd_vertical = 'Bytes'; | 54 | $obj->rrd_vertical = ucfirst($CONFIG['datasize']); |
55 | $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; | ||
55 | $obj->rrd_format = '%5.1lf%s'; | 56 | $obj->rrd_format = '%5.1lf%s'; |
56 | 57 | ||
57 | collectd_flush($obj->identifiers); | 58 | collectd_flush($obj->identifiers); |
@@ -104,7 +105,8 @@ switch($obj->args['type']) { | |||
104 | 'unspec-tx' => '000080', | 105 | 'unspec-tx' => '000080', |
105 | ); | 106 | ); |
106 | $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); | 107 | $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); |
107 | $obj->rrd_vertical = 'Bytes per second'; | 108 | $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize'])); |
109 | $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1; | ||
108 | $obj->width = $width; | 110 | $obj->width = $width; |
109 | $obj->heigth = $heigth; | 111 | $obj->heigth = $heigth; |
110 | $obj->rrd_format = '%5.1lf%s'; | 112 | $obj->rrd_format = '%5.1lf%s'; |