aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorManuel CISSÉ2010-02-23 17:44:22 +0100
committerPim van den Berg2010-03-01 21:05:33 +0100
commit51f5d8d4be186e90c5c4b748e292b9f75add5585 (patch)
treeacbc65cd181ada6c10a2bb58b5275e48f50ff40a /plugin
parentadd ping plugin (diff)
downloadapt-panopticon_cgp-51f5d8d4be186e90c5c4b748e292b9f75add5585.zip
apt-panopticon_cgp-51f5d8d4be186e90c5c4b748e292b9f75add5585.tar.gz
apt-panopticon_cgp-51f5d8d4be186e90c5c4b748e292b9f75add5585.tar.bz2
apt-panopticon_cgp-51f5d8d4be186e90c5c4b748e292b9f75add5585.tar.xz
add nut plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/nut.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/plugin/nut.php b/plugin/nut.php
new file mode 100644
index 0000000..82b967e
--- /dev/null
+++ b/plugin/nut.php
@@ -0,0 +1,57 @@
1<?php
2
3# Collectd NUT plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/Default.class.php';
7require_once 'inc/collectd.inc.php';
8
9## LAYOUT
10# nut-XXXX/
11# nut-XXXX/percent-XXXX.rrd
12# nut-XXXX/temerature-XXXX.rrd
13# nut-XXXX/voltage-XXXX.rrd
14# nut-XXXX/timeleft-XXXX.rrd
15
16$obj = new Type_Default($CONFIG);
17$obj->width = $width;
18$obj->heigth = $heigth;
19$obj->generate_colors();
20switch($obj->args['type']) {
21 case 'percent':
22 $obj->data_sources = array('percent');
23 $obj->ds_names = array('charge' => 'Charge',
24 'load' => 'Load');
25 $obj->rrd_title = sprintf('Charge & load (%s)', $obj->args['pinstance']);
26 $obj->rrd_vertical = '%';
27 $obj->rrd_format = '%5.1lf';
28 break;
29 case 'temperature':
30 $obj->data_sources = array('value');
31 $obj->ds_names = array('value' => 'Temperature');
32 $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']);
33 $obj->rrd_vertical = '°C';
34 $obj->rrd_format = '%5.1lf%s';
35 break;
36 case 'timeleft':
37 $obj->data_sources = array('timeleft');
38 $obj->ds_names = array('timeleft' => 'Timeleft');
39 $obj->rrd_title = sprintf('Timeleft (%s)', $obj->args['pinstance']);
40 $obj->rrd_vertical = 'Seconds';
41 $obj->rrd_format = '%5.1lf';
42 break;
43 case 'voltage':
44 $obj->data_sources = array('value');
45 $obj->ds_names = array('battery' => 'Battery',
46 'input' => 'Input',
47 'output' => 'Output');
48 $obj->rrd_title = sprintf('Voltage (%s)', $obj->args['pinstance']);
49 $obj->rrd_vertical = 'Volts';
50 $obj->rrd_format = '%5.1lf';
51 break;
52}
53
54collectd_flush($obj->identifiers);
55$obj->rrd_graph();
56
57?>