aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/disk.php
blob: a776abdc3d395c31b966e26dfb38868f27aa3913 (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
<?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',
);
$obj->width = $width;
$obj->heigth = $heigth;
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 = sprintf('%s per second', ucfirst($CONFIG['datasize']));
		$obj->rrd_format = '%5.1lf%s';
		$obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
	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();