diff options
author | Pim van den Berg | 2011-09-25 19:34:19 +0200 |
---|---|---|
committer | Pim van den Berg | 2011-09-25 19:35:25 +0200 |
commit | 243cf90881f4ab5a75403511cd69c2c0af4941f0 (patch) | |
tree | 31a5ad758400ed79ad3b7b8a38a15b3acca9f8cc /plugin/interface.php | |
parent | plugin/cpu: default scale to 100% (diff) | |
download | apt-panopticon_cgp-243cf90881f4ab5a75403511cd69c2c0af4941f0.zip apt-panopticon_cgp-243cf90881f4ab5a75403511cd69c2c0af4941f0.tar.gz apt-panopticon_cgp-243cf90881f4ab5a75403511cd69c2c0af4941f0.tar.bz2 apt-panopticon_cgp-243cf90881f4ab5a75403511cd69c2c0af4941f0.tar.xz |
plugin/interface: fix empty instance descr. for collectd 5
Reported-by: Nikoli <Nikoli@lavabit.com>
Diffstat (limited to 'plugin/interface.php')
-rw-r--r-- | plugin/interface.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugin/interface.php b/plugin/interface.php index 6beee00..f200813 100644 --- a/plugin/interface.php +++ b/plugin/interface.php | |||
@@ -6,12 +6,17 @@ require_once 'conf/common.inc.php'; | |||
6 | require_once 'type/GenericIO.class.php'; | 6 | require_once 'type/GenericIO.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | 7 | require_once 'inc/collectd.inc.php'; |
8 | 8 | ||
9 | # LAYOUT | 9 | # LAYOUT - Collectd 4 |
10 | # interface/ | 10 | # interface/ |
11 | # interface/if_errors-XXXX.rrd | 11 | # interface/if_errors-XXXX.rrd |
12 | # interface/if_octets-XXXX.rrd | 12 | # interface/if_octets-XXXX.rrd |
13 | # interface/if_packets-XXXX.rrd | 13 | # interface/if_packets-XXXX.rrd |
14 | 14 | ||
15 | # LAYOUT - Collectd 5 | ||
16 | # interface-XXXX/if_errors.rrd | ||
17 | # interface-XXXX/if_octets.rrd | ||
18 | # interface-XXXX/if_packets.rrd | ||
19 | |||
15 | $obj = new Type_GenericIO($CONFIG); | 20 | $obj = new Type_GenericIO($CONFIG); |
16 | $obj->data_sources = array('rx', 'tx'); | 21 | $obj->data_sources = array('rx', 'tx'); |
17 | $obj->ds_names = array( | 22 | $obj->ds_names = array( |
@@ -26,17 +31,18 @@ $obj->width = $width; | |||
26 | $obj->heigth = $heigth; | 31 | $obj->heigth = $heigth; |
27 | $obj->rrd_format = '%5.1lf%s'; | 32 | $obj->rrd_format = '%5.1lf%s'; |
28 | 33 | ||
34 | $instance = $CONFIG['version'] < 5 ? 'tinstance' : 'pinstance'; | ||
29 | switch($obj->args['type']) { | 35 | switch($obj->args['type']) { |
30 | case 'if_errors': | 36 | case 'if_errors': |
31 | $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']); | 37 | $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args[$instance]); |
32 | $obj->rrd_vertical = 'Errors per second'; | 38 | $obj->rrd_vertical = 'Errors per second'; |
33 | break; | 39 | break; |
34 | case 'if_octets': | 40 | case 'if_octets': |
35 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); | 41 | $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args[$instance]); |
36 | $obj->rrd_vertical = 'Bytes per second'; | 42 | $obj->rrd_vertical = 'Bytes per second'; |
37 | break; | 43 | break; |
38 | case 'if_packets': | 44 | case 'if_packets': |
39 | $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['tinstance']); | 45 | $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args[$instance]); |
40 | $obj->rrd_vertical = 'Packets per second'; | 46 | $obj->rrd_vertical = 'Packets per second'; |
41 | break; | 47 | break; |
42 | } | 48 | } |