1
0

Added miranda_densite.

This commit is contained in:
Markus Birth 2017-11-28 15:04:13 +01:00
parent 24f3e9c240
commit c1ce9295c0
Signed by: mbirth
GPG Key ID: A9928D7A098C3A9A
4 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,7 @@
[info]
title = Miranda Densité SNMP Checks
author = Markus Birth
description = SNMP based checks (card/PSU presence, system status) for the Miranda Densité frame controller.
version = 2015.07.22.1
version.min_required = 1.2.8p2
download_url = https://github.com/mbirth/check_mk-plugins

View File

@ -0,0 +1,61 @@
#!/usr/bin/python
# -*- coding: utf-8; py-indent-offset: 4 -*-
# _______ __ _ ____ __
# | | \ | |___ \ / /
# | | \| | __) | / /-,_
# | | |\ |/ __/ /__ _|
# |_______|_| \__|_____| |_|
#
# @author Markus Birth <markus.birth@weltn24.de>
def inventory_miranda_densite_presence(info):
inventory = []
for oidEnd, overallPresence in info:
inventory.append( ( "Presence", None ) )
return inventory
def check_miranda_densite_presence(item, _no_params, info):
status = 0
for oidEnd, overallPresence in info:
slot_used = ["➊", "➋", "➌", "➍", "➎", "➏", "➐", "➑", "➒", "➓", "⓫", "⓬", "⓭", "⓮", "⓯", "⓰", "⓱", "⓲", "⓳", "⓴", "PSU1", "PSU2" ]
slot_empty = ["➀", "➁", "➂", "➃", "➄", "➅", "➆", "➇", "➈", "➉", "⑪", "⑫", "⑬", "⑭", "⑮", "⑯", "⑰", "⑱", "⑲", "⑳", "----", "----" ]
bits = bin(int(overallPresence))[2:].zfill(22)[::-1]
message = "Slots: "
text = ""
ctr = 0
for c in bits[0:20]:
if c == '1':
message += slot_used[ctr]
else:
message += slot_empty[ctr]
ctr = ctr + 1
message += " / PSUs: "
ctr = 0
for c in bits[20:]:
if c == '1':
message += slot_used[ctr]
else:
status = 1
message += slot_empty[ctr]
ctr = ctr + 1
if status == 1:
message = "PSU missing!\n" + message
return status, message
return 3, "%s not found in SNMP data." % item
check_info["miranda_densite_presence"] = {
"check_function" : check_miranda_densite_presence,
"inventory_function" : inventory_miranda_densite_presence,
"service_description" : "%s",
"snmp_info" : (".1.3.6.1.4.1.3872.8.1", [
OID_END,
1, #overallPresence
]),
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.4.1.3872.8.1.1.0"),
"has_perfdata" : False
}

View File

@ -0,0 +1,52 @@
#!/usr/bin/python
# -*- coding: utf-8; py-indent-offset: 4 -*-
# _______ __ _ ____ __
# | | \ | |___ \ / /
# | | \| | __) | / /-,_
# | | |\ |/ __/ /__ _|
# |_______|_| \__|_____| |_|
#
# @author Markus Birth <markus.birth@weltn24.de>
def inventory_miranda_densite_status(info):
inventory = []
for oidEnd, overallStatus in info:
inventory.append( ( "Status", None ) )
return inventory
def check_miranda_densite_status(item, _no_params, info):
status = 0
for oidEnd, overallStatus in info:
devices = ["Slot 1", "Slot 2", "Slot 3", "Slot 4", "Slot 5", "Slot 6", "Slot 7", "Slot 8", "Slot 9", "Slot 10", \
"Slot 11", "Slot 12", "Slot 13", "Slot 14", "Slot 15", "Slot 16", "Slot 17", "Slot 18", "Slot 19", "Slot 20", \
"PSU1", "PSU2", "PSU1 Fan", "PSU2 Fan", "Rear Fan 1", "Rear Fan 2"]
bits = bin(int(overallStatus))[2:].zfill(26)[::-1]
message = "Error in: "
ctr = 0
for c in bits:
if c == '1':
if status == 2:
message += ", "
message += devices[ctr]
status = 2
ctr = ctr + 1
if status == 0:
message = "No errors reported."
return status, message
return 3, "%s not found in SNMP data." % item
check_info["miranda_densite_status"] = {
"check_function" : check_miranda_densite_status,
"inventory_function" : inventory_miranda_densite_status,
"service_description" : "%s",
"snmp_info" : (".1.3.6.1.4.1.3872.8.1", [
OID_END,
2, #overallStatus
]),
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.4.1.3872.8.1.1.0"),
"has_perfdata" : False
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB