Fix iostat collectd plugin for OSP 16
The iostat collectd plugin does not work on OSP 16 due to changes in syntax between python2 and python3. This patch fixes the issue. The patch has been tested for iostat_undercloud_collectd_plugin, iostat_compute_collectd_plugin and iostat_controller_collectd_plugin, but should work for other roles too. Closes-Bug: 1954367 Change-Id: I6e5ec8bcefda4e6d7cc160150a8292ad030f43d7
This commit is contained in:
parent
54a7e7c3b1
commit
92e8ad402b
@ -29,6 +29,7 @@ ADD files/collectd_gnocchi_status.py /usr/local/bin/collectd_gnocchi_status.py
|
||||
ADD files/collectd_rabbitmq_monitoring.py /usr/local/bin/collectd_rabbitmq_monitoring.py
|
||||
ADD files/collectd_swift_stat.py /usr/local/bin/collectd_swift_stat.py
|
||||
ADD files/collectd_pacemaker_monitoring.py /usr/local/bin/collectd_pacemaker_monitoring.py
|
||||
ADD files/collectd_iostat_python.py /usr/local/bin/collectd_iostat_python.py
|
||||
ADD files/ovs_flows.sh /usr/local/bin/ovs_flows.sh
|
||||
ADD files/ovn_monitoring.sh /usr/local/bin/ovn_monitoring.sh
|
||||
|
||||
|
@ -96,7 +96,7 @@ class IOStat(object):
|
||||
See I{man iostat} for more details.
|
||||
"""
|
||||
dstats = {}
|
||||
dsi = input.rfind('Device:')
|
||||
dsi = input.rfind('Device')
|
||||
if dsi == -1:
|
||||
raise ParseError('Unknown input format: %r' % input)
|
||||
|
||||
@ -178,12 +178,12 @@ class IOStat(object):
|
||||
extdoptions.remove('N')
|
||||
dstats = self._run(options)
|
||||
extdstats = self._run(extdoptions)
|
||||
dsd = self._get_childs_data(dstats)
|
||||
edd = self._get_childs_data(extdstats)
|
||||
dsd = self._get_childs_data(dstats).decode("utf-8")
|
||||
edd = self._get_childs_data(extdstats).decode("utf-8")
|
||||
ds = self.parse_diskstats(dsd)
|
||||
eds = self.parse_diskstats(edd)
|
||||
|
||||
for dk, dv in ds.iteritems():
|
||||
for dk, dv in ds.items():
|
||||
if dk in eds:
|
||||
ds[dk].update(eds[dk])
|
||||
|
||||
@ -366,7 +366,7 @@ class IOMon(object):
|
||||
value *= self.names[name]['m']
|
||||
else:
|
||||
val_type = 'gauge'
|
||||
tbl = string.maketrans('/-%', '___')
|
||||
tbl = str.maketrans('/-%', '___')
|
||||
type_instance = name.translate(tbl)
|
||||
value = ds[disk][name]
|
||||
self.dispatch_value(
|
||||
@ -388,7 +388,7 @@ if __name__ == '__main__':
|
||||
|
||||
for disk in ds:
|
||||
for metric in ds[disk]:
|
||||
tbl = string.maketrans('/-%', '___')
|
||||
tbl = str.maketrans('/-%', '___')
|
||||
metric_name = metric.translate(tbl)
|
||||
print("%s.%s:%s" % (disk, metric_name, ds[disk][metric]))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user