aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/interface.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/interface.php')
-rw-r--r--plugin/interface.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugin/interface.php b/plugin/interface.php
new file mode 100644
index 0000000..2f345f9
--- /dev/null
+++ b/plugin/interface.php
@@ -0,0 +1,54 @@
1<?php
2
3# Collectd Interface plugin
4
5require_once $CONFIG['webdir'].'/conf/config.php';
6require_once $CONFIG['webdir'].'/type/GenericIO.class.php';
7
8# LAYOUT
9# interface/
10# interface/if_errors-XXXX.rrd
11# interface/if_octets-XXXX.rrd
12# interface/if_packets-XXXX.rrd
13
14$obj = new Type_GenericIO;
15$obj->datadir = $CONFIG['datadir'];
16$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd';
17$obj->args = array(
18 'host' => $host,
19 'plugin' => $plugin,
20 'pinstance' => $pinstance,
21 'type' => $type,
22 'tinstance' => $tinstance,
23);
24$obj->data_sources = array('rx', 'tx');
25$obj->ds_names = array(
26 'rx' => 'Receive ',
27 'tx' => 'Transmit',
28);
29$obj->colors = array(
30 'rx' => '0000ff',
31 'tx' => '00b000',
32);
33$obj->width = $width;
34$obj->heigth = $heigth;
35$obj->seconds = $seconds;
36$obj->rrd_format = '%5.1lf%s';
37switch($type) {
38 case 'if_errors':
39 $obj->rrd_title = "Interface Errors ($tinstance) on $host";
40 $obj->rrd_vertical = 'Errors per second';
41 break;
42 case 'if_octets':
43 $obj->rrd_title = "Interface Traffic ($tinstance) on $host";
44 $obj->rrd_vertical = 'Bits per second';
45 break;
46 case 'if_packets':
47 $obj->rrd_title = "Interface Packets ($tinstance) on $host";
48 $obj->rrd_vertical = 'Packets per second';
49 break;
50}
51
52$obj->rrd_graph();
53
54?>