aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorManuel CISSÉ2013-04-26 11:23:55 +0200
committerManuel CISSÉ2013-04-26 11:23:55 +0200
commit5fdefc84341422ee02510c44ce693eaf684e9968 (patch)
treecf7c16e58a072ba705051611b867d7937e112a96 /plugin
parentplugin: Add MD plugin (diff)
downloadapt-panopticon_cgp-5fdefc84341422ee02510c44ce693eaf684e9968.zip
apt-panopticon_cgp-5fdefc84341422ee02510c44ce693eaf684e9968.tar.gz
apt-panopticon_cgp-5fdefc84341422ee02510c44ce693eaf684e9968.tar.bz2
apt-panopticon_cgp-5fdefc84341422ee02510c44ce693eaf684e9968.tar.xz
plugin/nut: collectd 5 compatibility + Add frequency graph
Diffstat (limited to 'plugin')
-rw-r--r--plugin/nut.php18
1 files 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';
8 8
9## LAYOUT 9## LAYOUT
10# nut-XXXX/ 10# nut-XXXX/
11# nut-XXXX/frequency-XXXX.rrd
11# nut-XXXX/percent-XXXX.rrd 12# nut-XXXX/percent-XXXX.rrd
12# nut-XXXX/temerature-XXXX.rrd 13# nut-XXXX/temerature-XXXX.rrd
13# nut-XXXX/voltage-XXXX.rrd
14# nut-XXXX/timeleft-XXXX.rrd 14# nut-XXXX/timeleft-XXXX.rrd
15# nut-XXXX/voltage-XXXX.rrd
15 16
16$obj = new Type_Default($CONFIG); 17$obj = new Type_Default($CONFIG);
17$obj->width = $width; 18$obj->width = $width;
18$obj->heigth = $heigth; 19$obj->heigth = $heigth;
19switch($obj->args['type']) { 20switch($obj->args['type']) {
21 case 'frequency':
22 $obj->data_sources = array('value');
23 $obj->ds_names = array('output' => 'Output');
24 $obj->rrd_title = sprintf('Frequency (%s)', $obj->args['pinstance']);
25 $obj->rrd_vertical = 'Hz';
26 $obj->rrd_format = '%5.1lf%s';
27 break;
20 case 'percent': 28 case 'percent':
21 $obj->data_sources = array('percent'); 29 if ($CONFIG['version'] < 5) {
30 $obj->data_sources = array('percent');
31 } else {
32 $obj->data_sources = array('value');
33 }
22 $obj->ds_names = array('charge' => 'Charge', 34 $obj->ds_names = array('charge' => 'Charge',
23 'load' => 'Load'); 35 'load' => 'Load');
24 $obj->rrd_title = sprintf('Charge & load (%s)', $obj->args['pinstance']); 36 $obj->rrd_title = sprintf('Charge & load (%s)', $obj->args['pinstance']);
@@ -27,7 +39,7 @@ switch($obj->args['type']) {
27 break; 39 break;
28 case 'temperature': 40 case 'temperature':
29 $obj->data_sources = array('value'); 41 $obj->data_sources = array('value');
30 $obj->ds_names = array('value' => 'Temperature'); 42 $obj->ds_names = array('battery' => 'Battery');
31 $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']); 43 $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']);
32 $obj->rrd_vertical = '°C'; 44 $obj->rrd_vertical = '°C';
33 $obj->rrd_format = '%5.1lf%s'; 45 $obj->rrd_format = '%5.1lf%s';