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

Merge pull request #653 from noradaiko/master

Fix bug where can't read MongoDB lock ratio
This commit is contained in:
Steve Schnepp 2016-10-08 13:49:57 +02:00 committed by GitHub
commit c194f5c20f

View File

@ -20,7 +20,10 @@ name = "locked"
def doData():
status = getServerStatus()
if status["version"] >= "2.2.0":
ratio = float(status["globalLock"]["lockTime"]) / status["globalLock"]["totalTime"]
if status["globalLock"]["lockTime"]["$numberLong"]:
ratio = float(status["globalLock"]["lockTime"]["$numberLong"]) / float(status["globalLock"]["totalTime"]["$numberLong"])
else:
ratio = float(status["globalLock"]["lockTime"]) / status["globalLock"]["totalTime"]
else:
ratio = status["globalLock"]["ratio"]
print name + ".value " + str( 100 * ratio )