Module: check_mk
Branch: master
Commit: f9facc1c44a9e6508f2cf1a9952b3b3096a80cce
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9facc1c44a9e6…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Feb 22 13:34:40 2017 +0100
4412 FIX haproxy.server: fixed empty uptime info handling
Change-Id: I918e2b6ae3662aea78a2302a96cd667178d60608
---
.werks/4412 | 11 +++++++++++
ChangeLog | 1 +
checks/haproxy | 22 +++++++++++++---------
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/.werks/4412 b/.werks/4412
new file mode 100644
index 0000000..fafc95c
--- /dev/null
+++ b/.werks/4412
@@ -0,0 +1,11 @@
+Title: haproxy.server: fixed empty uptime info handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1487766850
+
+
diff --git a/ChangeLog b/ChangeLog
index e7feeb8..1fffb52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 4349 FIX: cisco_qos: Fix crashing check for some cases where the QoS class cannot
be found...
* 4409 FIX: uptime: fixed missing info handling
* 4410 FIX: brocade_fcport: fixed missing info handling
+ * 4412 FIX: haproxy.server: fixed empty uptime info handling
Multisite:
* 4365 FIX: Service availability: Host down could not be rewritten to other states
like CRIT
diff --git a/checks/haproxy b/checks/haproxy
index 9517a2d..795e4b5 100644
--- a/checks/haproxy
+++ b/checks/haproxy
@@ -50,9 +50,9 @@ def inventory_haproxy_frontend(info):
def check_haproxy_frontend(item, _no_params, info):
for line in info:
if line[0] == item:
- now = time.time()
- status = line[17]
- stot = int(line[7])
+ now = time.time()
+ status = line[17]
+ stot = int(line[7])
session_rate = get_rate("sessions.%s" % item, now, stot)
infotext = "%s, Session Rate: %.2f/s" % (status, session_rate)
@@ -83,25 +83,29 @@ def inventory_haproxy_server(info):
def check_haproxy_server(item, _no_params, info):
for line in info:
if "%s/%s" % (line[0], line[1]) == item:
- status = line[17]
- uptime = get_age_human_readable(int(line[23]))
+ status = line[17]
+ uptime_str = line[23]
layer_check = line[36]
- active = int(line[19])
- backup = int(line[20])
+ active = int(line[19])
+ backup = int(line[20])
+
+ infotext = "Status: %s" % status
+ if uptime_str:
+ infotext += " since %s" %
get_age_human_readable(int(uptime_str))
if status == "UP" and (active or backup):
state = 0
else:
state = 2
- infotext = "%s since %s, Layer Check: %s" % \
- (status, uptime, layer_check)
+ infotext += ", Layer Check: %s" % layer_check
if active:
infotext += ", active"
elif backup:
infotext += ", backup"
else:
infotext += ", neither active nor backup (!!)"
+
return state, infotext