[Check_mk (deutsch)] help check_mk-ups_capacity

Hallo Zusammen,

wir nutzen check_mk – ups_capacity zur Überwachung einer Grafenthal USV. Bisher hat das ganze recht gut funktioniert. Wahrscheinlich seit dem letzten Update auf die p15 bekommen wir folgenden Fehler als Kritisch angezeigt.

Die Capacity wird von der USV mit 0 zurückgegeben, da diese erst mit einem Wert zurückkommt, wenn die USV in den Battery Mode springt. Es zeigt also die Rest Kapazität auf Battery Mode an. Hier müsste eigentlich kein Error erscheinen
sondern alles in bester Ordnung sein.

Über /omd/sites/…/share/check_mk/checks# nano ups_capacity

bekomme ich den Check folgend ausgegeben:

ups_capacity_default_levels = { ‘battime’: (0, 0), ‘capacity’: (95, 90) }

def inventory_ups_capacity(info):

if len(info) > 0:

return [(None, ‘ups_capacity_default_levels’)]

check_info[“ups_capacity”] = {

“check_function” : check_ups_capacity,

“inventory_function” : inventory_ups_capacity,

“service_description” : “Battery capacity”,

“has_perfdata” : True,

“group” : “ups_capacity”,

“includes” : [ “ups_capacity.include” ],

“snmp_info” : ( “.1.3.6.1.2.1.33.1.2”, [ “2.0”,“3.0”,“4.0” ] ),

“snmp_scan_function” : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in \

[ “.1.3.6.1.4.1.534.1”, “.1.3.6.1.4.1.705.1”, “.1.3.6.1.4.1.818.1.100.1.1”,

“1.3.6.1.4.1.705.1.2”, “.1.3.6.1.2.1.33.2”, “.1.3.6.1.4.1.5491.6”,

“.1.3.6.1.4.1.476.1.42”, “.1.3.6.1.4.1.818.1.100.1.2”,

“.1.3.6.1.4.1.232.165.3”, “.1.3.6.1.4.1.935” ] \

or oid(".1.3.6.1.2.1.1.2.0").startswith(’.1.3.6.1.2.1.33’)

}

Der Check ups_capacity.include sieht folgend aus:

def check_ups_capacity(item, params, info):

To support inventories with the old version

if type(params) is tuple: # old format with 2 params in tuple

warn, crit = params

cap_warn, cap_crit = (95, 90)

elif type(params) is dict: # new dict format

warn, crit = params.get(‘battime’, (20, 10))

cap_warn, cap_crit = params.get(‘capacity’, (95, 90))

else:

warn, crit = (20, 10)

cap_warn, cap_crit = (95, 90)

time_on_bat, minutes_left, percent_fuel = info[0]

Check time left on battery if minutes_left:

minutes_left = int(minutes_left)

state = 0

infotext = “%d min left on battery” % minutes_left

if minutes_left <= crit:

state = 2

elif minutes_left < warn:

state = 1

if state:

infotext += " (warn/crit below %d min/%d min)" % (warn, crit)

yield state, infotext, [ (‘capacity’, minutes_left, warn, crit) ]

Check percentual capacity

if percent_fuel:

percent_fuel = int(percent_fuel)

infotext = “capacity: %d%%” % percent_fuel

state = 0

if percent_fuel <= cap_crit:

state = 2

elif percent_fuel < cap_warn:

state = 1

if state:

infotext += " (warn/crit below %d%%/%d%%)" % (cap_warn, cap_crit)

yield state, infotext, [ (‘percent’, percent_fuel, cap_warn, cap_crit) ]

Output time on battery

if time_on_bat and int(time_on_bat) > 0:

yield 0, “On battery for %d min” % int(time_on_bat)

Wie kann ich dieses ändern, das der Check wieder korrekt funktioniert?

Mit freundlichen Grüßen

i.A. Jürgen Mannes

Systemengineer

image001.png

PIRONET Enterprise Solutions GmbH

Carlswerkstr. 13a

51063 Köln

Deutschland

Phone
+49 (0)221 2994-82-23

Mobile: +49 (0) 172 8589370

Mail jmannes@pironet.com

Website
www.pironet.com

Blog
www.business-cloud.de

···

PIRONET Enterprise Solutions GmbH

Gesellschaft mit beschränkter Haftung mit Sitz in Köln

Handelsregister Amtsgericht Köln:

HRB Nr. 52337 USt-IdNr. DE 814170286

Geschäftsführer PIRONET Enterprise Solutions GmbH: Katharina Gülpen, Jan Dilthey, Uwe Schröter

Diese E-Mail und alle mitgesendeten Dateien sind vertraulich und ausschließlich für den Gebrauch durch den Empfänger bestimmt!

This e-mail and any files transmitted with it are confidential intended solely for the use of the addressee!