Added miranda_densite.
This commit is contained in:
parent
24f3e9c240
commit
c1ce9295c0
7
src/miranda_densite/baseinfo.ini
Normal file
7
src/miranda_densite/baseinfo.ini
Normal 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
|
61
src/miranda_densite/checks/miranda_densite_presence
Normal file
61
src/miranda_densite/checks/miranda_densite_presence
Normal 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
|
||||
}
|
52
src/miranda_densite/checks/miranda_densite_status
Normal file
52
src/miranda_densite/checks/miranda_densite_status
Normal 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
|
||||
}
|
BIN
src/miranda_densite/web/htdocs/images/icons/Miranda.png
Normal file
BIN
src/miranda_densite/web/htdocs/images/icons/Miranda.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user