From 5fdefc84341422ee02510c44ce693eaf684e9968 Mon Sep 17 00:00:00 2001 From: Manuel CISSÉ Date: Fri, 26 Apr 2013 11:23:55 +0200 Subject: plugin/nut: collectd 5 compatibility + Add frequency graph --- plugin/nut.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugin/nut.php b/plugin/nut.php index b1016e6..e97233c 100644 --- a/plugin/nut.php +++ b/plugin/nut.php @@ -8,17 +8,29 @@ require_once 'inc/collectd.inc.php'; ## LAYOUT # nut-XXXX/ +# nut-XXXX/frequency-XXXX.rrd # nut-XXXX/percent-XXXX.rrd # nut-XXXX/temerature-XXXX.rrd -# nut-XXXX/voltage-XXXX.rrd # nut-XXXX/timeleft-XXXX.rrd +# nut-XXXX/voltage-XXXX.rrd $obj = new Type_Default($CONFIG); $obj->width = $width; $obj->heigth = $heigth; switch($obj->args['type']) { + case 'frequency': + $obj->data_sources = array('value'); + $obj->ds_names = array('output' => 'Output'); + $obj->rrd_title = sprintf('Frequency (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Hz'; + $obj->rrd_format = '%5.1lf%s'; + break; case 'percent': - $obj->data_sources = array('percent'); + if ($CONFIG['version'] < 5) { + $obj->data_sources = array('percent'); + } else { + $obj->data_sources = array('value'); + } $obj->ds_names = array('charge' => 'Charge', 'load' => 'Load'); $obj->rrd_title = sprintf('Charge & load (%s)', $obj->args['pinstance']); @@ -27,7 +39,7 @@ switch($obj->args['type']) { break; case 'temperature': $obj->data_sources = array('value'); - $obj->ds_names = array('value' => 'Temperature'); + $obj->ds_names = array('battery' => 'Battery'); $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']); $obj->rrd_vertical = '°C'; $obj->rrd_format = '%5.1lf%s'; -- cgit v1.1