From f0db176e8c1e90bcce8da408648917d3e8243386 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Mon, 4 Jul 2011 21:07:22 +0200 Subject: plugin/libvirt: collectd 5 compatibility --- plugin/libvirt.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'plugin') diff --git a/plugin/libvirt.php b/plugin/libvirt.php index 0d5071a..829c592 100644 --- a/plugin/libvirt.php +++ b/plugin/libvirt.php @@ -103,12 +103,12 @@ switch($obj->args['type']) { require_once 'type/Default.class.php'; $obj = new Type_Default($CONFIG); - $obj->data_sources = array('ns'); + $obj->data_sources = array('value'); $obj->ds_names = array( - 'ns' => 'CPU time', + 'value' => 'CPU time', ); $obj->colors = array( - 'ns' => '0000ff', + 'value' => '0000ff', ); $obj->rrd_title = 'CPU usage'; $obj->rrd_vertical = 'CPU time'; @@ -117,12 +117,12 @@ switch($obj->args['type']) { require_once 'type/Default.class.php'; $obj = new Type_Default($CONFIG); - $obj->data_sources = array('ns'); + $obj->data_sources = array('value'); $obj->ds_names = array( - 'ns' => 'VCPU time', + 'value' => 'VCPU time', ); $obj->colors = array( - 'ns' => '0000ff', + 'value' => '0000ff', ); $obj->rrd_title = 'VCPU usage'; $obj->rrd_vertical = 'VCPU time'; @@ -133,5 +133,15 @@ $obj->width = $width; $obj->heigth = $heigth; $obj->rrd_format = '%5.1lf%s'; +if ($CONFIG['version'] < 5 && count($obj->data_sources) == 1) { + $obj->data_sources = array('ns'); + + $obj->ds_names['ns'] = $obj->ds_names['value']; + unset($obj->ds_names['value']); + + $obj->colors['ns'] = $obj->colors['value']; + unset($obj->colors['value']); +} + collectd_flush($obj->identifiers); $obj->rrd_graph(); -- cgit v1.1