Fixing mongo repl set lag munin graph.

This commit is contained in:
Samuel Clay 2016-11-11 11:34:52 -08:00
parent 05a6dd2bab
commit 5d6c2ba9aa
3 changed files with 7 additions and 4 deletions

View file

@ -23,7 +23,7 @@ class MongoDBConnectionsPlugin(MuninMongoDBPlugin):
value = status['connections']['current']
except KeyError:
value = "U"
return dict(heap_usage=value)
return dict(connections=value)
if __name__ == "__main__":
MongoDBConnectionsPlugin().run()

View file

@ -28,10 +28,10 @@ class MongoReplicaSetLag(MuninMongoDBPlugin):
member_state = member['state']
optime = member['optime']
if member_state == PRIMARY_STATE:
primary_optime = optime.time
primary_optime = optime
elif member_state == SECONDARY_STATE:
if not oldest_secondary_optime or optime.time < oldest_secondary_optime.time:
oldest_secondary_optime = optime.time
if not oldest_secondary_optime or optime < oldest_secondary_optime:
oldest_secondary_optime = optime
if not primary_optime or not oldest_secondary_optime:
raise Exception("Replica set is not healthy")

3
fabfile.py vendored
View file

@ -1133,6 +1133,9 @@ def copy_munin_data(from_server):
def setup_db_munin():
sudo('rm /etc/munin/plugins/mongo*')
sudo('rm /etc/munin/plugins/pg_*')
sudo('rm /etc/munin/plugins/redis_*')
sudo('cp -frs %s/config/munin/mongo* /etc/munin/plugins/' % env.NEWSBLUR_PATH)
sudo('cp -frs %s/config/munin/pg_* /etc/munin/plugins/' % env.NEWSBLUR_PATH)
sudo('cp -frs %s/config/munin/redis_* /etc/munin/plugins/' % env.NEWSBLUR_PATH)