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

coerce lockTime to float type

otherwise we'll always get 0 from integer division.
This commit is contained in:
代码之力 2014-04-30 10:48:44 +08:00
parent d2847dc508
commit 96116a460b

View file

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