Collection of CheckMK checks (see https://checkmk.com/). All checks and plugins are provided as is. Absolutely no warranty. Send any comments to thl-cmk[at]outlook[dot]com

Skip to content
Snippets Groups Projects
Commit cc95aa14 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

Delete huawei_hw_components

parent a89c76f4
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2020-07-14
#
# extended inventory of Huawei hardware components
#
def inv_huawei_hw_components(info, params):
def parse_huawei_hw_components(info):
def get_snmp_date(hwEntityManufacturedDate):
year = (ord(hwEntityManufacturedDate[0]) << 8) + ord(hwEntityManufacturedDate[1])
month = ord(hwEntityManufacturedDate[2])
day = ord(hwEntityManufacturedDate[3])
snmpDate = '%d-%02d-%02d' % (year, month, day)
return snmpDate
defaultEntities, huaweiEntities = info
entities = {}
for entry in huaweiEntities:
hwOID_END, hwEntityBomId, hwEntityBomEnDesc, hwEntityManufacturedDate, hwEntityBoardType, hwEntityOpticalVendorSn = entry
if hwEntityBomEnDesc != '':
entity = {}
entity['hwEntityBomId'] = hwEntityBomId
entity['hwEntityBomEnDesc'] = hwEntityBomEnDesc
entity['hwEntityManufacturedDate'] = get_snmp_date(hwEntityManufacturedDate)
entity['hwEntityBoardType'] = hwEntityBoardType
entity['serial_number'] = hwEntityOpticalVendorSn
for entry in defaultEntities:
OID_END, entPhysicalDescr, entPhysicalName, entPhysicalHardwareRev, entPhysicalFirmwareRev, entPhysicalSoftwareRev, entPhysicalSerialNum, entPhysicalMfgName = entry
if OID_END == hwOID_END:
entity['entPhysicalDescr'] = entPhysicalDescr
entity['entPhysicalName'] = entPhysicalName
entity['entPhysicalHardwareRev'] = entPhysicalHardwareRev
entity['entPhysicalFirmwareRev'] = entPhysicalFirmwareRev
entity['entPhysicalSoftwareRev'] = entPhysicalSoftwareRev
entity['entPhysicalMfgName'] = entPhysicalMfgName
if entity['serial_number'] == '':
entity['serial_number'] = entPhysicalSerialNum
entities[hwOID_END] = entity
return entities
node = inv_tree_list('hardware.components.huawei:')
entities = parse_huawei_hw_components(info)
for key, value in entities.items():
node.append({
'index': key,
'bom_id': value['hwEntityBomId'],
'bom_decription': value['hwEntityBomEnDesc'],
'manufactured_date': value['hwEntityManufacturedDate'],
'board_type': value['hwEntityBoardType'],
'description': value['entPhysicalDescr'],
'name': value['entPhysicalName'],
'hardware_revision': value['entPhysicalHardwareRev'],
'firmware_revision': value['entPhysicalFirmwareRev'],
'software_revision': value['entPhysicalSoftwareRev'],
'serial_number': value['serial_number'],
'vendor': value['entPhysicalMfgName'],
})
return node
inv_info['inv_huawei_hw_components'] = {
'inv_function': inv_huawei_hw_components,
'snmp_info': [
('.1.3.6.1.2.1.47.1.1.1.1', [
OID_END,
'2', # entPhysicalDescr
'7', # entPhysicalName
'8', # entPhysicalHardwareRev
'9', # entPhysicalFirmwareRev
'10', # entPhysicalSoftwareRev
'11', # entPhysicalSerialNum
'12', # entPhysicalMfgName
]),
('.1.3.6.1.4.1.2011.5.25.31.1.1', [
OID_END,
'2.1.1', # hwEntityBomId
'2.1.2', # hwEntityBomEnDesc
'2.1.4', # hwEntityManufacturedDate
'2.1.11', # hwEntityBoardType
'3.1.4' # hwEntityOpticalVendorSn
])
],
'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith('.1.3.6.1.4.1.2011'),
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment