Module: check_mk
Branch: master
Commit: 75e9421e0be676ed83493ca86e3b4adc658d4b9c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=75e9421e0be676…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Jul 19 08:48:57 2018 +0200
6124 FIX juniper_bgp_state: avoid crash if peer state or peer status is missing in SNMP
walk
Change-Id: I29d2ed992c2d1658a3f28da3360cb6c9df60074e
---
.werks/6124 | 10 ++++++++++
checks/juniper_bgp_state | 2 ++
2 files changed, 12 insertions(+)
diff --git a/.werks/6124 b/.werks/6124
new file mode 100644
index 0000000..6e3839d
--- /dev/null
+++ b/.werks/6124
@@ -0,0 +1,10 @@
+Title: juniper_bgp_state: avoid crash if peer state or peer status is missing in SNMP
walk
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1531982891
+Class: fix
+
+
diff --git a/checks/juniper_bgp_state b/checks/juniper_bgp_state
index b0c92e5..095a43c 100644
--- a/checks/juniper_bgp_state
+++ b/checks/juniper_bgp_state
@@ -47,6 +47,8 @@ def check_juniper_bgp_state(item, _no_params, info):
status = 0
for oid_end, bgp_state, bgp_operational_state in info:
peering_partner_ip = juniper_bgp_state_create_item(oid_end)
+ if not bgp_state or not bgp_operational_state:
+ return 3, "Missing SNMP data"
bgp_state = int(bgp_state)
bgp_operational_state = int(bgp_operational_state)