diff options
author | Pim van den Berg | 2011-01-29 19:16:39 +0100 |
---|---|---|
committer | Pim van den Berg | 2011-01-29 19:16:39 +0100 |
commit | 42f95b39f4ec31b42f8e7e293c83d69938d84e7a (patch) | |
tree | 46103ddcf320c65f98c99db5c119be62815c8cbc /plugin | |
parent | plugin/apache: add support for lighttpd (diff) | |
download | apt-panopticon_cgp-42f95b39f4ec31b42f8e7e293c83d69938d84e7a.zip apt-panopticon_cgp-42f95b39f4ec31b42f8e7e293c83d69938d84e7a.tar.gz apt-panopticon_cgp-42f95b39f4ec31b42f8e7e293c83d69938d84e7a.tar.bz2 apt-panopticon_cgp-42f95b39f4ec31b42f8e7e293c83d69938d84e7a.tar.xz |
plugin: add dns plugin
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/dns.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugin/dns.php b/plugin/dns.php new file mode 100644 index 0000000..f0c1b85 --- /dev/null +++ b/plugin/dns.php | |||
@@ -0,0 +1,58 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd DNS plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/GenericStacked.class.php'; | ||
7 | require_once 'inc/collectd.inc.php'; | ||
8 | |||
9 | ## LAYOUT | ||
10 | # dns/ | ||
11 | # dns/dns_octets.rrd | ||
12 | # dns/dns_opcode-X.rrd | ||
13 | # dns/dns_qtype-X.rrd | ||
14 | |||
15 | $obj = new Type_GenericStacked($CONFIG); | ||
16 | $obj->width = $width; | ||
17 | $obj->heigth = $heigth; | ||
18 | switch($obj->args['type']) { | ||
19 | case 'dns_octets': | ||
20 | $obj->data_sources = array( | ||
21 | 'queries', | ||
22 | 'responses', | ||
23 | ); | ||
24 | $obj->ds_names = array( | ||
25 | 'queries' => 'Queries', | ||
26 | 'responses' => 'Responses', | ||
27 | ); | ||
28 | $obj->colors = array( | ||
29 | 'queries' => '0000ff', | ||
30 | 'responses' => '00ff00', | ||
31 | ); | ||
32 | $obj->rrd_title = 'DNS traffic'; | ||
33 | $obj->rrd_vertical = 'Bit/s'; | ||
34 | $obj->rrd_format = '%5.1lf%s'; | ||
35 | break; | ||
36 | case 'dns_opcode': | ||
37 | $obj->data_sources = array('value'); | ||
38 | $obj->ds_names = array( | ||
39 | 'value' => 'Queries/s', | ||
40 | ); | ||
41 | $obj->colors = array( | ||
42 | 'value' => '0000ff', | ||
43 | ); | ||
44 | $obj->rrd_title = 'DNS Opcode Query'; | ||
45 | $obj->rrd_vertical = 'Queries/s'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | break; | ||
48 | case 'dns_qtype': | ||
49 | $obj->data_sources = array('value'); | ||
50 | $obj->generate_colors(); | ||
51 | $obj->rrd_title = 'DNS QType'; | ||
52 | $obj->rrd_vertical = 'Queries/s'; | ||
53 | $obj->rrd_format = '%5.1lf%s'; | ||
54 | break; | ||
55 | } | ||
56 | |||
57 | collectd_flush($obj->identifiers); | ||
58 | $obj->rrd_graph(); | ||