aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/disk.php
blob: 45b5fde5b177297b64af654c890d97bdb628857f (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
64
65
<?php

# Collectd Disk plugin

require_once 'conf/common.inc.php';
require_once 'type/GenericIO.class.php';
require_once 'inc/collectd.inc.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->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;
}

collectd_flush(ident_from_args($obj->args));

$obj->rrd_graph();

?>