2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Update plugins/mongodb/mongo_lag

fixed bug for python 2.6 and for replica sets with arbiters
This commit is contained in:
jdponomarev 2012-09-25 12:51:21 +04:00
parent bac376c23e
commit ea5dde3fb4

View file

@ -30,6 +30,7 @@ def _get_members():
members = {} members = {}
for member in repl_status['members']: for member in repl_status['members']:
if member['stateStr'] != 'ARBITER' :
name = member['name'].split('.')[0] name = member['name'].split('.')[0]
members[name] = {'state': member['state'], 'optimeDate': member['optimeDate']} members[name] = {'state': member['state'], 'optimeDate': member['optimeDate']}
return members return members
@ -42,7 +43,7 @@ def run():
for member in members: for member in members:
lag = (primary_optime - members[member]['optimeDate']).seconds lag = (primary_optime - members[member]['optimeDate']).seconds
print "{}.value {}".format(member, lag) print "{0}.value {1}".format(member, lag)
def config(): def config():
print """graph_title MongoDB replication lag print """graph_title MongoDB replication lag