From cea604847e7dd62b390fb5c24da78becb1c82de7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 8 Jan 2016 23:50:33 +0100 Subject: nut plugin now also detects RB -> replace battery diff --git a/checks/nut b/checks/nut index f5ec1cc..df6c156 100644 --- a/checks/nut +++ b/checks/nut @@ -262,14 +262,19 @@ def check_nut_status(item, params, info): if len(line) < 3 or line[0] != item: continue - value = line[2] + values = line[2:] if line[1] == 'ups.status:': - if value == 'OL': + if values[0] == 'OL': + if len(values) > 1: + if values[1] == 'RB': + return (1, "WARN - UPS Status is Onlince / Replace Battery (OL RB)") + return (1, "WARN - UPS Status has unknown extra fields: %s" % (", ".join(values[1:]))) return (0, "OK - UPS Status is Online (OL)") - elif value == 'OB': + elif values[0] == 'OB': return (1, "WARN - UPS Status is On Battery (OB)") - elif value == 'LB': + elif values[0] == 'LB': return (2, "CRIT - UPS Status is Low Battery (LB)") + return (3, "UNKNOWN - UPS Status cannot be determined for %s" % item) -- cgit v0.10.2