Module: check_mk
Branch: master
Commit: 6b551fd2f4d8100085345687f987d213910a7976
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6b551fd2f4d810…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 25 13:40:16 2016 +0200
3766 FIX palo_alto_sessions: Fixed possible division by zero error
---
.werks/3766 | 10 ++++++++++
ChangeLog | 1 +
checks/palo_alto_sessions | 8 +++++---
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.werks/3766 b/.werks/3766
new file mode 100644
index 0000000..a42585f
--- /dev/null
+++ b/.werks/3766
@@ -0,0 +1,10 @@
+Title: palo_alto_sessions: Fixed possible division by zero error
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1472125205
+
+
diff --git a/ChangeLog b/ChangeLog
index b8f9aec..369e1ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -353,6 +353,7 @@
* 3762 FIX: local: Fixed long output handling with Microcore...
* 3764 FIX: netapp_api_vs_traffic: Fixed exception when no NFSv4 infos available
* 3765 FIX: oracle_asm_diskgroup: Made check more robust against invalid data
received from agent...
+ * 3766 FIX: palo_alto_sessions: Fixed possible division by zero error
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/palo_alto_sessions b/checks/palo_alto_sessions
index 3ce5269..c8af7b9 100644
--- a/checks/palo_alto_sessions
+++ b/checks/palo_alto_sessions
@@ -35,7 +35,11 @@ def inventory_palo_alto_sessions(info):
def check_palo_alto_sessions(_no_item, params, info):
sessions_supported, total, tcp, udp, icmp, sslproxy = map(int, info[0])
- sessions_used_perc = float(total)*100 / sessions_supported
+
+ if sessions_supported == 0:
+ sessions_used_perc = 0
+ else:
+ sessions_used_perc = float(total)*100 / sessions_supported
infotext = "%d total active sessions: %d TCP, %d UDP, %d ICMP, %d SSL
Proxy." % \
(total, tcp, udp, icmp, sslproxy)
@@ -52,8 +56,6 @@ def check_palo_alto_sessions(_no_item, params, info):
("sslproxy_active_sessions", sslproxy),
]
-
-
if sessions_used_perc >= crit:
status = 2
elif sessions_used_perc >= warn: