aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/sensors.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/sensors.php')
-rw-r--r--plugin/sensors.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugin/sensors.php b/plugin/sensors.php
new file mode 100644
index 0000000..ad43378
--- /dev/null
+++ b/plugin/sensors.php
@@ -0,0 +1,58 @@
1<?php
2
3# Collectd Sensors plugin
4
5require_once $CONFIG['webdir'].'/conf/config.php';
6require_once $CONFIG['webdir'].'/type/Default.class.php';
7
8## LAYOUT
9# disk-XXXX/
10# disk-XXXX/fanspeed-XXXX.rrd
11# disk-XXXX/temerature-XXXX.rrd
12# disk-XXXX/voltage-XXXX.rrd
13
14# grouped
15require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
16$tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type));
17
18$obj = new Type_Default;
19$obj->datadir = $CONFIG['datadir'];
20$obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd';
21$obj->args = array(
22 'host' => $host,
23 'plugin' => $plugin,
24 'pinstance' => $pinstance,
25 'type' => $type,
26 'tinstance' => $tinstance,
27);
28$obj->data_sources = array('value');
29$obj->ds_names = array(
30 'value' => 'Value ',
31);
32$obj->width = $width;
33$obj->heigth = $heigth;
34$obj->seconds = $seconds;
35switch($type) {
36 case 'fanspeed':
37 $obj->colors = '00ff00';
38 $obj->rrd_title = "Fanspeed ($pinstance) on $host";
39 $obj->rrd_vertical = 'RPM';
40 $obj->rrd_format = '%5.1lf';
41 break;
42 case 'temperature':
43 $obj->colors = '0000ff';
44 $obj->rrd_title = "Temperature ($pinstance) on $host";
45 $obj->rrd_vertical = 'Celius';
46 $obj->rrd_format = '%5.1lf%s';
47 break;
48 case 'voltage':
49 $obj->colors = 'ff0000';
50 $obj->rrd_title = "Voltage ($pinstance) on $host";
51 $obj->rrd_vertical = 'Volt';
52 $obj->rrd_format = '%5.1lf';
53 break;
54}
55
56$obj->rrd_graph();
57
58?>