aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2010-09-11 12:09:25 +0200
committerPim van den Berg2010-09-12 10:14:55 +0200
commit0e3b0266946942ee1bc787af075399e426b26568 (patch)
tree437d8d6c079622f66014e7ae94811f0a0ed88c19
parenttype/default: dont strip 1st char from instance name when there is no type in... (diff)
downloadapt-panopticon_cgp-0e3b0266946942ee1bc787af075399e426b26568.zip
apt-panopticon_cgp-0e3b0266946942ee1bc787af075399e426b26568.tar.gz
apt-panopticon_cgp-0e3b0266946942ee1bc787af075399e426b26568.tar.bz2
apt-panopticon_cgp-0e3b0266946942ee1bc787af075399e426b26568.tar.xz
plugin: add netlink plugin
-rw-r--r--plugin/netlink.php128
1 files changed, 128 insertions, 0 deletions
diff --git a/plugin/netlink.php b/plugin/netlink.php
new file mode 100644
index 0000000..f9b4fa6
--- /dev/null
+++ b/plugin/netlink.php
@@ -0,0 +1,128 @@
1<?php
2
3# Collectd Netlink Plugin
4
5require_once 'conf/common.inc.php';
6require_once 'type/GenericStacked.class.php';
7require_once 'inc/collectd.inc.php';
8
9$obj = new Type_GenericStacked($CONFIG);
10
11$obj->width = $width;
12$obj->heigth = $heigth;
13$obj->rrd_format = '%5.1lf%s';
14
15switch($obj->args['type']) {
16 case 'if_collisions':
17 $obj->data_sources = array('value');
18 $obj->ds_names = array('value' => 'Collisions');
19 $obj->colors = array('value' => '0000ff');
20 $obj->rrd_title = sprintf('Collisions (%s)', $obj->args['pinstance']);
21 $obj->rrd_vertical = 'Collisions/s';
22 break;
23 case 'if_dropped':
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->rrd_title = sprintf('Dropped Packets (%s)', $obj->args['pinstance']);
34 $obj->rrd_vertical = 'Packets/s';
35 break;
36 case 'if_errors':
37 $obj->data_sources = array('rx', 'tx');
38 $obj->ds_names = array(
39 'rx' => 'Receive ',
40 'tx' => 'Transmit',
41 );
42 $obj->colors = array(
43 'rx' => '0000ff',
44 'tx' => '00b000',
45 );
46 $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['pinstance']);
47 $obj->rrd_vertical = 'Errors/s';
48 break;
49 case 'if_multicast':
50 $obj->data_sources = array('value');
51 $obj->ds_names = array('value' => 'Packets');
52 $obj->colors = array('value' => '0000ff');
53 $obj->rrd_title = sprintf('Multicast Packets (%s)', $obj->args['pinstance']);
54 $obj->rrd_vertical = 'Packets/s';
55 break;
56 case 'if_octets':
57 $obj->data_sources = array('rx', 'tx');
58 $obj->ds_names = array(
59 'rx' => 'Receive ',
60 'tx' => 'Transmit',
61 );
62 $obj->colors = array(
63 'rx' => '0000ff',
64 'tx' => '00b000',
65 );
66 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['pinstance']);
67 $obj->rrd_vertical = 'Bytes/s';
68 break;
69 case 'if_packets':
70 $obj->data_sources = array('rx', 'tx');
71 $obj->ds_names = array(
72 'rx' => 'Receive ',
73 'tx' => 'Transmit',
74 );
75 $obj->colors = array(
76 'rx' => '0000ff',
77 'tx' => '00b000',
78 );
79 $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['pinstance']);
80 $obj->rrd_vertical = 'Packets/s';
81 break;
82 break;
83 case 'if_rx_errors':
84 $obj->data_sources = array('value');
85 $obj->ds_names = array(
86 'crc' => 'CRC ',
87 'fifo' => 'FiFo ',
88 'frame' => 'Frame ',
89 'length' => 'Lenght',
90 'missed' => 'Missed',
91 'over' => 'Over ',
92 );
93 $obj->colors = array(
94 'crc' => '00e000',
95 'fifo' => 'f000c0',
96 'frame' => 'ffb000',
97 'length' => 'f00000',
98 'missed' => '0000f0',
99 'over' => '00e0ff',
100 );
101 $obj->rrd_title = sprintf('Interface receive errors (%s)', $obj->args['pinstance']);
102 $obj->rrd_vertical = 'Errors/s';
103 break;
104 case 'if_tx_errors':
105 $obj->data_sources = array('value');
106 $obj->ds_names = array(
107 'aborted' => 'Aborted ',
108 'carrier' => 'Carrier ',
109 'fifo' => 'FiFo ',
110 'heartbeat'=> 'Heartbeat',
111 'window' => 'Window ',
112 );
113 $obj->colors = array(
114 'aborted' => 'f00000',
115 'carrier' => '00e0ff',
116 'fifo' => '00e000',
117 'heartbeat'=> 'ffb000',
118 'window' => 'f000c0',
119 );
120 $obj->rrd_title = sprintf('Interface transmit errors (%s)', $obj->args['pinstance']);
121 $obj->rrd_vertical = 'Errors/s';
122 break;
123}
124
125collectd_flush($obj->identifiers);
126$obj->rrd_graph();
127
128?>