From 96116a460ba7ca65a57b4510c97db6244b41a3f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B9=8B=E5=8A=9B?= Date: Wed, 30 Apr 2014 10:48:44 +0800 Subject: [PATCH] coerce lockTime to float type otherwise we'll always get 0 from integer division. --- plugins/mongodb/mongo_lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mongodb/mongo_lock b/plugins/mongodb/mongo_lock index af093a0e..4b94aeca 100755 --- a/plugins/mongodb/mongo_lock +++ b/plugins/mongodb/mongo_lock @@ -20,7 +20,7 @@ name = "locked" def doData(): status = getServerStatus() if status["version"] >= "2.2.0": - ratio = status["globalLock"]["lockTime"] / status["globalLock"]["totalTime"] + ratio = float(status["globalLock"]["lockTime"]) / status["globalLock"]["totalTime"] else: ratio = status["globalLock"]["ratio"] print name + ".value " + str( 100 * ratio )