aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorPim van den Berg2011-08-01 22:06:34 +0200
committerPim van den Berg2011-08-01 22:06:34 +0200
commit854c6274fc2849194ec2cc68664d6354d68eb73d (patch)
treebbb74ff9aadb8652e6b1339f9eb6796599e005c4 /plugin
parentplugin: add apcups plugin (diff)
downloadapt-panopticon_cgp-854c6274fc2849194ec2cc68664d6354d68eb73d.zip
apt-panopticon_cgp-854c6274fc2849194ec2cc68664d6354d68eb73d.tar.gz
apt-panopticon_cgp-854c6274fc2849194ec2cc68664d6354d68eb73d.tar.bz2
apt-panopticon_cgp-854c6274fc2849194ec2cc68664d6354d68eb73d.tar.xz
plugin/apcups: collectd 5 compatibility
Diffstat (limited to 'plugin')
-rw-r--r--plugin/apcups.php31
1 files changed, 22 insertions, 9 deletions
diff --git a/plugin/apcups.php b/plugin/apcups.php
index 5fc3687..07498f0 100644
--- a/plugin/apcups.php
+++ b/plugin/apcups.php
@@ -30,16 +30,16 @@ switch($obj->args['type']) {
30 $obj->rrd_vertical = 'Ampere hours'; 30 $obj->rrd_vertical = 'Ampere hours';
31 break; 31 break;
32 case 'frequency': 32 case 'frequency':
33 $obj->data_sources = array('frequency'); 33 $obj->data_sources = array('value');
34 $obj->ds_names = array('frequency' => 'Input Frequency'); 34 $obj->ds_names = array('value' => 'Input Frequency');
35 $obj->colors = array('frequency' => '0000f0'); 35 $obj->colors = array('value' => '0000f0');
36 $obj->rrd_title = sprintf('UPS Input Frequency'); 36 $obj->rrd_title = sprintf('UPS Input Frequency');
37 $obj->rrd_vertical = 'Hertz'; 37 $obj->rrd_vertical = 'Hertz';
38 break; 38 break;
39 case 'percent': 39 case 'percent':
40 $obj->data_sources = array('percent'); 40 $obj->data_sources = array('value');
41 $obj->ds_names = array('percent' => 'Load'); 41 $obj->ds_names = array('value' => 'Load');
42 $obj->colors = array('percent' => '0000f0'); 42 $obj->colors = array('value' => '0000f0');
43 $obj->rrd_title = sprintf('UPS Load'); 43 $obj->rrd_title = sprintf('UPS Load');
44 $obj->rrd_vertical = 'Percent'; 44 $obj->rrd_vertical = 'Percent';
45 break; 45 break;
@@ -51,9 +51,9 @@ switch($obj->args['type']) {
51 $obj->rrd_vertical = 'Celsius'; 51 $obj->rrd_vertical = 'Celsius';
52 break; 52 break;
53 case 'timeleft': 53 case 'timeleft':
54 $obj->data_sources = array('timeleft'); 54 $obj->data_sources = array('value');
55 $obj->ds_names = array('timeleft' => 'Time Left'); 55 $obj->ds_names = array('value' => 'Time Left');
56 $obj->colors = array('timeleft' => '0000f0'); 56 $obj->colors = array('value' => '0000f0');
57 $obj->rrd_title = sprintf('UPS Time Left'); 57 $obj->rrd_title = sprintf('UPS Time Left');
58 $obj->rrd_vertical = 'Minutes'; 58 $obj->rrd_vertical = 'Minutes';
59 break; 59 break;
@@ -75,6 +75,19 @@ switch($obj->args['type']) {
75} 75}
76$obj->rrd_format = '%5.1lf%s'; 76$obj->rrd_format = '%5.1lf%s';
77 77
78# backwards compatibility
79if ($CONFIG['version'] < 5 &&
80 in_array($obj->args['type'], array('frequency', 'percent', 'timeleft'))) {
81
82 $obj->data_sources = array($obj->args['type']);
83
84 $obj->ds_names[$obj->args['type']] = $obj->ds_names['value'];
85 unset($obj->ds_names['value']);
86
87 $obj->colors[$obj->args['type']] = $obj->colors['value'];
88 unset($obj->colors['value']);
89}
90
78collectd_flush($obj->identifiers); 91collectd_flush($obj->identifiers);
79$obj->rrd_graph(); 92$obj->rrd_graph();
80 93