diff options
-rw-r--r-- | plugin/nut.php | 18 |
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; |
19 | switch($obj->args['type']) { | 20 | switch($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'; |