diff options
author | Pim van den Berg | 2014-05-03 19:17:16 +0200 |
---|---|---|
committer | Pim van den Berg | 2014-05-12 21:32:24 +0200 |
commit | 0a547add2f4cc264380d2dab2c472efe5a1d7094 (patch) | |
tree | 55bb43a3e31c5814848d61eea92c8438e4a37886 /plugin/netlink.php | |
parent | type/base: set default title to "Plugin Type (PluginInstance) (Category)" (diff) | |
download | apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.zip apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.gz apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.bz2 apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.xz |
graph.php: use JSON plugins instead of including PHP plugin files
A couple of big changes here. A lot of logic moved to graph.php.
The PHP plugin files have been rewritten to JSON. In these JSON files
*everything* is optional. Also *NOT* having a JSON plugin file won't
block you from having a graph. The JSON will just make the graphs
prettier (by having a title, y-axis title, legend, colors, etc..).
The Collectd types.db file is parsed and used to determine RRD content.
When things are not defined in the JSON it will fallback to a default.
Diffstat (limited to 'plugin/netlink.php')
-rw-r--r-- | plugin/netlink.php | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/plugin/netlink.php b/plugin/netlink.php deleted file mode 100644 index 9ddaee8..0000000 --- a/plugin/netlink.php +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Netlink Plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/GenericStacked.class.php'; | ||
7 | |||
8 | $obj = new Type_GenericStacked($CONFIG, $_GET); | ||
9 | |||
10 | $obj->rrd_format = '%5.1lf%s'; | ||
11 | |||
12 | switch($obj->args['type']) { | ||
13 | case 'if_collisions': | ||
14 | $obj->data_sources = array('value'); | ||
15 | $obj->legend = array('value' => 'Collisions'); | ||
16 | $obj->colors = array('value' => '0000ff'); | ||
17 | $obj->rrd_title = sprintf('Collisions (%s)', $obj->args['pinstance']); | ||
18 | $obj->rrd_vertical = 'Collisions/s'; | ||
19 | break; | ||
20 | case 'if_dropped': | ||
21 | $obj->data_sources = array('rx', 'tx'); | ||
22 | $obj->legend = array( | ||
23 | 'rx' => 'Receive', | ||
24 | 'tx' => 'Transmit', | ||
25 | ); | ||
26 | $obj->colors = array( | ||
27 | 'rx' => '0000ff', | ||
28 | 'tx' => '00b000', | ||
29 | ); | ||
30 | $obj->rrd_title = sprintf('Dropped Packets (%s)', $obj->args['pinstance']); | ||
31 | $obj->rrd_vertical = 'Packets/s'; | ||
32 | break; | ||
33 | case 'if_errors': | ||
34 | $obj->data_sources = array('rx', 'tx'); | ||
35 | $obj->legend = array( | ||
36 | 'rx' => 'Receive', | ||
37 | 'tx' => 'Transmit', | ||
38 | ); | ||
39 | $obj->colors = array( | ||
40 | 'rx' => '0000ff', | ||
41 | 'tx' => '00b000', | ||
42 | ); | ||
43 | $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['pinstance']); | ||
44 | $obj->rrd_vertical = 'Errors/s'; | ||
45 | break; | ||
46 | case 'if_multicast': | ||
47 | $obj->data_sources = array('value'); | ||
48 | $obj->legend = array('value' => 'Packets'); | ||
49 | $obj->colors = array('value' => '0000ff'); | ||
50 | $obj->rrd_title = sprintf('Multicast Packets (%s)', $obj->args['pinstance']); | ||
51 | $obj->rrd_vertical = 'Packets/s'; | ||
52 | break; | ||
53 | case 'if_octets': | ||
54 | $obj->data_sources = array('rx', 'tx'); | ||
55 | $obj->legend = array( | ||
56 | 'rx' => 'Receive', | ||
57 | 'tx' => 'Transmit', | ||
58 | ); | ||
59 | $obj->colors = array( | ||
60 | 'rx' => '0000ff', | ||
61 | 'tx' => '00b000', | ||
62 | ); | ||
63 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['pinstance']); | ||
64 | $obj->rrd_vertical = sprintf('%s/s', ucfirst($CONFIG['network_datasize'])); | ||
65 | $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; | ||
66 | break; | ||
67 | case 'if_packets': | ||
68 | $obj->data_sources = array('rx', 'tx'); | ||
69 | $obj->legend = array( | ||
70 | 'rx' => 'Receive', | ||
71 | 'tx' => 'Transmit', | ||
72 | ); | ||
73 | $obj->colors = array( | ||
74 | 'rx' => '0000ff', | ||
75 | 'tx' => '00b000', | ||
76 | ); | ||
77 | $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['pinstance']); | ||
78 | $obj->rrd_vertical = 'Packets/s'; | ||
79 | break; | ||
80 | case 'if_rx_errors': | ||
81 | $obj->data_sources = array('value'); | ||
82 | $obj->legend = array( | ||
83 | 'crc' => 'CRC', | ||
84 | 'fifo' => 'FiFo', | ||
85 | 'frame' => 'Frame', | ||
86 | 'length' => 'Lenght', | ||
87 | 'missed' => 'Missed', | ||
88 | 'over' => 'Over', | ||
89 | ); | ||
90 | $obj->colors = array( | ||
91 | 'crc' => '00e000', | ||
92 | 'fifo' => 'f000c0', | ||
93 | 'frame' => 'ffb000', | ||
94 | 'length' => 'f00000', | ||
95 | 'missed' => '0000f0', | ||
96 | 'over' => '00e0ff', | ||
97 | ); | ||
98 | $obj->rrd_title = sprintf('Interface receive errors (%s)', $obj->args['pinstance']); | ||
99 | $obj->rrd_vertical = 'Errors/s'; | ||
100 | break; | ||
101 | case 'if_tx_errors': | ||
102 | $obj->data_sources = array('value'); | ||
103 | $obj->legend = array( | ||
104 | 'aborted' => 'Aborted', | ||
105 | 'carrier' => 'Carrier', | ||
106 | 'fifo' => 'FiFo', | ||
107 | 'heartbeat'=> 'Heartbeat', | ||
108 | 'window' => 'Window', | ||
109 | ); | ||
110 | $obj->colors = array( | ||
111 | 'aborted' => 'f00000', | ||
112 | 'carrier' => '00e0ff', | ||
113 | 'fifo' => '00e000', | ||
114 | 'heartbeat'=> 'ffb000', | ||
115 | 'window' => 'f000c0', | ||
116 | ); | ||
117 | $obj->rrd_title = sprintf('Interface transmit errors (%s)', $obj->args['pinstance']); | ||
118 | $obj->rrd_vertical = 'Errors/s'; | ||
119 | break; | ||
120 | } | ||
121 | |||
122 | $obj->rrd_graph(); | ||