diff options
author | Pim van den Berg | 2011-07-04 21:07:22 +0200 |
---|---|---|
committer | Pim van den Berg | 2011-07-04 21:12:48 +0200 |
commit | f0db176e8c1e90bcce8da408648917d3e8243386 (patch) | |
tree | 8febb0056edf4e4975e8c45e61d85d2150de21b9 /plugin | |
parent | plugin: add libvirt plugin (diff) | |
download | apt-panopticon_cgp-f0db176e8c1e90bcce8da408648917d3e8243386.zip apt-panopticon_cgp-f0db176e8c1e90bcce8da408648917d3e8243386.tar.gz apt-panopticon_cgp-f0db176e8c1e90bcce8da408648917d3e8243386.tar.bz2 apt-panopticon_cgp-f0db176e8c1e90bcce8da408648917d3e8243386.tar.xz |
plugin/libvirt: collectd 5 compatibility
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/libvirt.php | 22 |
1 files changed, 16 insertions, 6 deletions
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 | ||
136 | if ($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 | |||
136 | collectd_flush($obj->identifiers); | 146 | collectd_flush($obj->identifiers); |
137 | $obj->rrd_graph(); | 147 | $obj->rrd_graph(); |