aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/sensors.php
blob: ad43378960f6c70907b0de6c645af3d443888942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php

# Collectd Sensors plugin

require_once $CONFIG['webdir'].'/conf/config.php';
require_once $CONFIG['webdir'].'/type/Default.class.php';

## LAYOUT
# disk-XXXX/
# disk-XXXX/fanspeed-XXXX.rrd
# disk-XXXX/temerature-XXXX.rrd
# disk-XXXX/voltage-XXXX.rrd

# grouped
require_once $CONFIG['webdir'].'/inc/collectd.inc.php';
$tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type));

$obj = new Type_Default;
$obj->datadir = $CONFIG['datadir'];
$obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd';
$obj->args = array(
	'host' => $host,
	'plugin' => $plugin,
	'pinstance' => $pinstance,
	'type' => $type,
	'tinstance' => $tinstance,
);
$obj->data_sources = array('value');
$obj->ds_names = array(
	'value' => 'Value  ',
);
$obj->width = $width;
$obj->heigth = $heigth;
$obj->seconds = $seconds;
switch($type) {
	case 'fanspeed':
		$obj->colors = '00ff00';
		$obj->rrd_title = "Fanspeed ($pinstance) on $host";
		$obj->rrd_vertical = 'RPM';
		$obj->rrd_format = '%5.1lf';
	break;
	case 'temperature':
		$obj->colors = '0000ff';
		$obj->rrd_title = "Temperature ($pinstance) on $host";
		$obj->rrd_vertical = 'Celius';
		$obj->rrd_format = '%5.1lf%s';
	break;
	case 'voltage':
		$obj->colors = 'ff0000';
		$obj->rrd_title = "Voltage ($pinstance) on $host";
		$obj->rrd_vertical = 'Volt';
		$obj->rrd_format = '%5.1lf';
	break;
}

$obj->rrd_graph();

?>