aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorPeter Chiochetti2011-08-01 21:28:59 +0200
committerPim van den Berg2011-08-01 21:28:59 +0200
commite0b921c172febee979574cd12baa22ae5f4db166 (patch)
treec74883bfc64f61b639cb661e80c551e4283de872 /plugin
parentplugin/libvirt: collectd 5 compatibility (diff)
downloadapt-panopticon_cgp-e0b921c172febee979574cd12baa22ae5f4db166.zip
apt-panopticon_cgp-e0b921c172febee979574cd12baa22ae5f4db166.tar.gz
apt-panopticon_cgp-e0b921c172febee979574cd12baa22ae5f4db166.tar.bz2
apt-panopticon_cgp-e0b921c172febee979574cd12baa22ae5f4db166.tar.xz
plugin: add apcups plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/apcups.php80
1 files changed, 80 insertions, 0 deletions
diff --git a/plugin/apcups.php b/plugin/apcups.php
new file mode 100644
index 0000000..5fc3687
--- /dev/null
+++ b/plugin/apcups.php
@@ -0,0 +1,80 @@
1<?php
2
3# Collectd APC UPS plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/Default.class.php';
7require_once 'inc/collectd.inc.php';
8
9## LAYOUT
10# apcups/
11# apcups/charge.rrd
12# apcups/frequency-input.rrd
13# apcups/percent-load.rrd
14# apcups/temperature.rrd
15# apcups/timeleft.rrd
16# apcups/voltage-battery.rrd
17# apcups/voltage-input.rrd
18# apcups/voltage-output.rrd
19
20$obj = new Type_Default($CONFIG);
21$obj->width = $width;
22$obj->heigth = $heigth;
23
24switch($obj->args['type']) {
25 case 'charge':
26 $obj->data_sources = array('value');
27 $obj->ds_names = array('value' => 'Charge');
28 $obj->colors = array('value' => '0000f0');
29 $obj->rrd_title = sprintf('UPS Charge');
30 $obj->rrd_vertical = 'Ampere hours';
31 break;
32 case 'frequency':
33 $obj->data_sources = array('frequency');
34 $obj->ds_names = array('frequency' => 'Input Frequency');
35 $obj->colors = array('frequency' => '0000f0');
36 $obj->rrd_title = sprintf('UPS Input Frequency');
37 $obj->rrd_vertical = 'Hertz';
38 break;
39 case 'percent':
40 $obj->data_sources = array('percent');
41 $obj->ds_names = array('percent' => 'Load');
42 $obj->colors = array('percent' => '0000f0');
43 $obj->rrd_title = sprintf('UPS Load');
44 $obj->rrd_vertical = 'Percent';
45 break;
46 case 'temperature':
47 $obj->data_sources = array('value');
48 $obj->ds_names = array('value' => 'Temperature');
49 $obj->colors = array('value' => '0000f0');
50 $obj->rrd_title = sprintf('UPS Temperature');
51 $obj->rrd_vertical = 'Celsius';
52 break;
53 case 'timeleft':
54 $obj->data_sources = array('timeleft');
55 $obj->ds_names = array('timeleft' => 'Time Left');
56 $obj->colors = array('timeleft' => '0000f0');
57 $obj->rrd_title = sprintf('UPS Time Left');
58 $obj->rrd_vertical = 'Minutes';
59 break;
60 case 'voltage':
61 $obj->order = array('battery', 'input', 'output');
62 $obj->ds_names = array(
63 'battery' => 'Battery Voltage',
64 'input' => 'Input Voltage',
65 'output' => 'Output Voltage'
66 );
67 $obj->colors = array(
68 'battery' => '0000f0',
69 'input' => '00f000',
70 'output' => 'f00000'
71 );
72 $obj->rrd_title = sprintf('UPS Voltage');
73 $obj->rrd_vertical = 'Volt';
74 break;
75}
76$obj->rrd_format = '%5.1lf%s';
77
78collectd_flush($obj->identifiers);
79$obj->rrd_graph();
80