]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/zabbix: fix div by zero
authorJohn Spray <john.spray@redhat.com>
Sat, 23 Sep 2017 14:18:18 +0000 (15:18 +0100)
committerShinobu Kinjo <shinobu@redhat.com>
Sat, 4 Nov 2017 20:42:35 +0000 (05:42 +0900)
Fixes: http://tracker.ceph.com/issues/21518
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit 9c02738b4ea0303f5b3cbfc4748d6791007be834)

src/pybind/mgr/zabbix/module.py

index eb2eba11a1ffe56e0348a2fb4b6dcdf194a24604..a7baac1ba69004252ae360d2368dc24e6258c5d8 100644 (file)
@@ -12,7 +12,10 @@ from mgr_module import MgrModule
 
 
 def avg(data):
-    return sum(data) / float(len(data))
+    if len(data):
+        return sum(data) / float(len(data))
+    else:
+        return 0
 
 
 class ZabbixSender(object):