aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--inc/collectd.inc.php5
-rw-r--r--plugin/libvirt.php22
2 files changed, 19 insertions, 8 deletions
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 51aedba..11dc91f 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -107,8 +107,9 @@ function group_plugindata($plugindata) {
107 # type instances should be grouped in 1 graph 107 # type instances should be grouped in 1 graph
108 foreach ($plugindata as $item) { 108 foreach ($plugindata as $item) {
109 # backwards compatibility 109 # backwards compatibility
110 if ($CONFIG['version'] >= 5 || !preg_match('/^(df|interface|libvirt)$/', $item['p'])) 110 if ($CONFIG['version'] >= 5 || !preg_match('/^(df|interface)$/', $item['p']))
111 unset($item['ti']); 111 if($item['p'] != 'libvirt')
112 unset($item['ti']);
112 $data[] = $item; 113 $data[] = $item;
113 } 114 }
114 115
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']) {
103 require_once 'type/Default.class.php'; 103 require_once 'type/Default.class.php';
104 $obj = new Type_Default($CONFIG); 104 $obj = new Type_Default($CONFIG);
105 105
106 $obj->data_sources = array('ns'); 106 $obj->data_sources = array('value');
107 $obj->ds_names = array( 107 $obj->ds_names = array(
108 'ns' => 'CPU time', 108 'value' => 'CPU time',
109 ); 109 );
110 $obj->colors = array( 110 $obj->colors = array(
111 'ns' => '0000ff', 111 'value' => '0000ff',
112 ); 112 );
113 $obj->rrd_title = 'CPU usage'; 113 $obj->rrd_title = 'CPU usage';
114 $obj->rrd_vertical = 'CPU time'; 114 $obj->rrd_vertical = 'CPU time';
@@ -117,12 +117,12 @@ switch($obj->args['type']) {
117 require_once 'type/Default.class.php'; 117 require_once 'type/Default.class.php';
118 $obj = new Type_Default($CONFIG); 118 $obj = new Type_Default($CONFIG);
119 119
120 $obj->data_sources = array('ns'); 120 $obj->data_sources = array('value');
121 $obj->ds_names = array( 121 $obj->ds_names = array(
122 'ns' => 'VCPU time', 122 'value' => 'VCPU time',
123 ); 123 );
124 $obj->colors = array( 124 $obj->colors = array(
125 'ns' => '0000ff', 125 'value' => '0000ff',
126 ); 126 );
127 $obj->rrd_title = 'VCPU usage'; 127 $obj->rrd_title = 'VCPU usage';
128 $obj->rrd_vertical = 'VCPU time'; 128 $obj->rrd_vertical = 'VCPU time';
@@ -133,5 +133,15 @@ $obj->width = $width;
133$obj->heigth = $heigth; 133$obj->heigth = $heigth;
134$obj->rrd_format = '%5.1lf%s'; 134$obj->rrd_format = '%5.1lf%s';
135 135
136if ($CONFIG['version'] < 5 && count($obj->data_sources) == 1) {
137 $obj->data_sources = array('ns');
138
139 $obj->ds_names['ns'] = $obj->ds_names['value'];
140 unset($obj->ds_names['value']);
141
142 $obj->colors['ns'] = $obj->colors['value'];
143 unset($obj->colors['value']);
144}
145
136collectd_flush($obj->identifiers); 146collectd_flush($obj->identifiers);
137$obj->rrd_graph(); 147$obj->rrd_graph();