From 243cf90881f4ab5a75403511cd69c2c0af4941f0 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 25 Sep 2011 19:34:19 +0200 Subject: plugin/interface: fix empty instance descr. for collectd 5 Reported-by: Nikoli --- plugin/interface.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'plugin/interface.php') 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'; require_once 'type/GenericIO.class.php'; require_once 'inc/collectd.inc.php'; -# LAYOUT +# LAYOUT - Collectd 4 # interface/ # interface/if_errors-XXXX.rrd # interface/if_octets-XXXX.rrd # interface/if_packets-XXXX.rrd +# LAYOUT - Collectd 5 +# interface-XXXX/if_errors.rrd +# interface-XXXX/if_octets.rrd +# interface-XXXX/if_packets.rrd + $obj = new Type_GenericIO($CONFIG); $obj->data_sources = array('rx', 'tx'); $obj->ds_names = array( @@ -26,17 +31,18 @@ $obj->width = $width; $obj->heigth = $heigth; $obj->rrd_format = '%5.1lf%s'; +$instance = $CONFIG['version'] < 5 ? 'tinstance' : 'pinstance'; switch($obj->args['type']) { case 'if_errors': - $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']); + $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args[$instance]); $obj->rrd_vertical = 'Errors per second'; break; case 'if_octets': - $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); + $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args[$instance]); $obj->rrd_vertical = 'Bytes per second'; break; case 'if_packets': - $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['tinstance']); + $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args[$instance]); $obj->rrd_vertical = 'Packets per second'; break; } -- cgit v1.1