aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/disk.php
blob: e73cbac1119268b9c24bc1d24bf8a67e957575e8 (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
59
60
61
62
63
<?php

# Collectd Disk plugin

require_once 'conf/common.inc.php';
require_once 'type/GenericIO.class.php';

## LAYOUT
# disk-XXXX/
# disk-XXXX/disk_merged.rrd
# disk-XXXX/disk_octets.rrd
# disk-XXXX/disk_ops.rrd
# disk-XXXX/disk_time.rrd

$obj = new Type_GenericIO;
$obj->datadir = $CONFIG['datadir'];
$obj->path_format = '{host}/{plugin}-{pinstance}/{type}.rrd';
$obj->args = array(
	'host' => $host,
	'plugin' => $plugin,
	'pinstance' => $pinstance,
	'type' => $type,
	'tinstance' => $tinstance,
);
$obj->data_sources = array('read', 'write');
$obj->ds_names = array(
	'read' => 'Read   ',
	'write' => 'Written',
);
$obj->colors = array(
	'read' => '0000ff',
	'write' => '00b000',
);
$obj->width = $width;
$obj->heigth = $heigth;
$obj->seconds = $seconds;
switch($type) {
	case 'disk_merged':
		$obj->rrd_title = "Disk Merged Operations ($pinstance) on $host";
		$obj->rrd_vertical = 'Merged operations/s';
		$obj->rrd_format = '%5.1lf';
	break;
	case 'disk_octets':
		$obj->rrd_title = "Disk Traffic ($pinstance) on $host";
		$obj->rrd_vertical = 'Bytes per second';
		$obj->rrd_format = '%5.1lf%s';
	break;
	case 'disk_ops':
		$obj->rrd_title = "Disk Operations ($pinstance) on $host";
		$obj->rrd_vertical = 'Ops per second';
		$obj->rrd_format = '%5.1lf';
	break;
	case 'disk_time':
		$obj->rrd_title = "Disk time per operation ($pinstance) on $host";
		$obj->rrd_vertical = 'Avg. Time/Op';
		$obj->rrd_format = '%5.1lf%ss';
		$obj->scale = '0.001';
	break;
}

$obj->rrd_graph();

?>