1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

change Python iteritems by items

This commit is contained in:
Pierre-Alain TORET 2020-04-18 12:35:32 +02:00 committed by Lars Kruse
parent 168f6f924f
commit 71f9280576

View file

@ -134,11 +134,11 @@ class TorPlugin(object):
@staticmethod @staticmethod
def conf_from_dict(graph, labels): def conf_from_dict(graph, labels):
# header # header
for key, val in graph.iteritems(): for key, val in graph.items():
print('graph_{} {}'.format(key, val)) print('graph_{} {}'.format(key, val))
# values # values
for label, attributes in labels.iteritems(): for label, attributes in labels.items():
for key, val in attributes.iteritems(): for key, val in attributes.items():
print('{}.{} {}'.format(label, key, val)) print('{}.{} {}'.format(label, key, val))
@staticmethod @staticmethod
@ -253,7 +253,7 @@ class TorConnections(TorPlugin):
states = dict((state, 0) for state in stem.ORStatus) states = dict((state, 0) for state in stem.ORStatus)
for connection in connections: for connection in connections:
states[connection.rsplit(None, 1)[-1]] += 1 states[connection.rsplit(None, 1)[-1]] += 1
for state, count in states.iteritems(): for state, count in states.items():
print('{}.value {}'.format(state.lower(), count)) print('{}.value {}'.format(state.lower(), count))
except stem.connection.AuthenticationFailure as e: except stem.connection.AuthenticationFailure as e:
print('Authentication failed ({})'.format(e)) print('Authentication failed ({})'.format(e))