aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/disk.php
blob: 763ae10c1bf3610bafcc36a2d0fea065ed2ef71c (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
<?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($CONFIG);
$obj->data_sources = array('read', 'write');
$obj->ds_names = array(
	'read' => 'Read',
	'write' => 'Written',
);
$obj->colors = array(
	'read' => '0000ff',
	'write' => '00b000',
);
switch($obj->args['type']) {
	case 'disk_merged':
		$obj->rrd_title = sprintf('Disk Merged Operations (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Merged operations/s';
		$obj->rrd_format = '%5.1lf%s';
	break;
	case 'disk_octets':
		$obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Bytes per second';
		$obj->rrd_format = '%5.1lf%s';
	break;
	case 'disk_ops':
		$obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Ops per second';
		$obj->rrd_format = '%5.1lf%s';
	break;
	case 'disk_time':
		$obj->rrd_title = sprintf('Disk time per operation (%s)', $obj->args['pinstance']);
		$obj->rrd_vertical = 'Avg. Time/Op';
		$obj->rrd_format = '%5.1lf%ss';
		$obj->scale = '0.001';
	break;
}

collectd_flush($obj->identifiers);
$obj->rrd_graph();