aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/dns.php
blob: 0c4409709cfe80bd3786746d50463eeb8a9bd5ff (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 DNS plugin

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

## LAYOUT
# dns/
# dns/dns_octets.rrd
# dns/dns_opcode-X.rrd
# dns/dns_qtype-X.rrd

$obj = new Type_GenericStacked($CONFIG, $_GET);
$obj->rrd_format = '%5.1lf%s';

switch($obj->args['type']) {
	case 'dns_octets':
		$obj->data_sources = array(
			'queries',
			'responses',
		);
		$obj->legend = array(
			'queries'   => 'Queries',
			'responses' => 'Responses',
		);
		$obj->colors = array(
			'queries'   => '0000ff',
			'responses' => '00ff00',
		);
		$obj->rrd_title = 'DNS traffic';
		$obj->rrd_vertical = 'Bit/s';
	break;
	case 'dns_opcode':
		$obj->data_sources = array('value');
		$obj->rrd_title = 'DNS Opcode Query';
		$obj->rrd_vertical = 'Queries/s';
	break;
	case 'dns_qtype':
		$obj->data_sources = array('value');
		$obj->rrd_title = 'DNS QType';
		$obj->rrd_vertical = 'Queries/s';
	break;
	case 'dns_rcode':
		$obj->data_sources = array('value');
		$obj->rrd_title = 'DNS Reply code';
		$obj->rrd_vertical = 'Queries/s';
	break;
}

$obj->rrd_graph();