diff --git a/checks/checkpoint_asg_interface b/checks/checkpoint_asg_interface deleted file mode 100644 index 23a8e0d772c62395fd4de2848a74277ec1a3bf49..0000000000000000000000000000000000000000 --- a/checks/checkpoint_asg_interface +++ /dev/null @@ -1,177 +0,0 @@ -#!/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-11-09 -# -# Monitor Check Point Maestro SMO interfaces -# -# sample snmpwalk (for one interface) -# .1.3.6.1.4.1.2620.1.48.26.1.1.1.4.0 = Gauge32: 4 -# .1.3.6.1.4.1.2620.1.48.26.1.1.2.4.0 = STRING: "bond2.602" -# .1.3.6.1.4.1.2620.1.48.26.1.1.3.4.0 = STRING: "10.9.9.1/25" -# .1.3.6.1.4.1.2620.1.48.26.1.1.4.4.0 = STRING: "-" -# .1.3.6.1.4.1.2620.1.48.26.1.1.5.4.0 = STRING: "00:1c:7f:81:05:09" -# .1.3.6.1.4.1.2620.1.48.26.1.1.6.4.0 = STRING: "Vlan" -# .1.3.6.1.4.1.2620.1.48.26.1.1.7.4.0 = STRING: "(up)/(up)" -# .1.3.6.1.4.1.2620.1.48.26.1.1.8.4.0 = STRING: "NA" -# .1.3.6.1.4.1.2620.1.48.26.1.1.9.4.0 = STRING: "1500" -# .1.3.6.1.4.1.2620.1.48.26.1.1.10.4.0 = STRING: "Full" -# .1.3.6.1.4.1.2620.1.48.26.1.1.11.4.0 = STRING: "355320533" -# .1.3.6.1.4.1.2620.1.48.26.1.1.12.4.0 = STRING: "4673143507" -# -# sample info -# [ -# [u'bond2', u'-', u'-', u'00:1c:7f:81:05:09', u'Bond Master', u'(up)/(up)', u'20G', u'NA', u'Full', u'3373103274', u'5007776301'], -# [u'eth1-05', u'-', u'-', u'00:1c:7f:81:05:09', u'Bond slave', u'(up)/(up)', u'10G', u'1500', u'Full', u'1014183605', u'3291515315'], -# [u'eth2-05', u'-', u'-', u'00:1c:7f:81:05:09', u'Bond slave', u'(up)/(up)', u'10G', u'1500', u'Full', u'2358951560', u'1716293763'], -# [u'bond2.602', u'10.9.9.1/25', u'-', u'00:1c:7f:81:05:09', u'Vlan', u'(up)/(up)', u'NA', u'1500', u'Full', u'355320533', u'4673143507'], -# [u'bond2.3001', u'10.0.100.49/27', u'-', u'00:1c:7f:81:05:09', u'Vlan', u'(up)/(up)', u'NA', u'1500', u'Full', u'2910413426', u'229216384'], -# [u'bond3', u'-', u'-', u'00:1c:7f:81:06:09', u'Bond Master', u'(up)/(up)', u'20G', u'NA', u'Full', u'1479928728', u'133617791'], -# [u'eth1-06', u'-', u'-', u'00:1c:7f:81:06:09', u'Bond slave', u'(up)/(up)', u'10G', u'1500', u'Full', u'214459394', u'131774843'], -# [u'eth2-06', u'-', u'-', u'00:1c:7f:81:06:09', u'Bond slave', u'(up)/(up)', u'10G', u'1500', u'Full', u'1265469477', u'1843158'], -# [u'magg1', u'10.0.100.9/27', u'-', u'00:1c:7f:6e:9b:dc', u'Bond Master', u'(up)/(up)', u'20G', u'NA', u'Full', u'200631796', u'384654797'], -# [u'eth1-Mgmt1', u'-', u'-', u'00:1c:7f:6e:9b:dc', u'Bond slave', u'(Up)/(Up)', u'10G', u'1500', u'Full', u'61520991', u'44776128'], -# [u'eth2-Mgmt1', u'-', u'-', u'00:1c:7f:6e:9b:dc', u'Bond slave', u'(Up)/(Up)', u'10G', u'1500', u'Full', u'139110651', u'339878254'], -# [u'Sync', u'192.0.2.1/24', u'-', u'00:1c:7f:01:04:fe', u'Bond Master', u'(up)/(up)', u'20G', u'NA', u'Full', u'24549684703', u'14214325659'], -# [u'eth1-Sync', u'-', u'-', u'00:1c:7f:01:04:fe', u'Bond slave', u'(down)/(down)', u'10G', u'1500', u'Full', u'1228171', u'1511513'], -# [u'eth2-Sync', u'-', u'-', u'00:1c:7f:01:04:fe', u'Bond slave', u'(up)/(up)', u'10G', u'1500', u'Full', u'24548432877', u'14212801896'] -# ] -# - -def parse_checkpoint_asg_interface(info): - items = {} - for asg_interface in info: - asgNetIfName, asgNetIfIPv4Addr, asgNetIfIPv6Addr, asgNetIfMACAddr, asgNetIfInfo, asgNetIfState, asgNetIfSpeed, asgNetIfMTU, asgNetIfDuplex, asgNetIfRx, asgNetIfTx = asg_interface - # if not asgNetIfIPv4Addr == asgNetIfIPv6Addr == '-': # do not add interfaces without ip address - item = '%s' % (asgNetIfName) - items.update({item : {'asgNetIfIPv4Addr': asgNetIfIPv4Addr, - 'asgNetIfIPv6Addr': asgNetIfIPv6Addr, - 'asgNetIfMACAddr': asgNetIfMACAddr, - 'asgNetIfInfo': asgNetIfInfo, - 'asgNetIfState': asgNetIfState, - 'asgNetIfSpeed': asgNetIfSpeed, - 'asgNetIfMTU': asgNetIfMTU, - 'asgNetIfDuplex': asgNetIfDuplex, - 'asgNetIfRx': int(asgNetIfRx), - 'asgNetIfTx': int(asgNetIfTx) - } - }) - return items - - -def inventory_checkpoint_asg_interface(parsed): - # sample parsed - # { - # u'Sync': {'asgNetIfDuplex': u'Full', 'asgNetIfSpeed': u'20G', 'asgNetIfMACAddr': u'00:1c:7f:01:04:fe', 'asgNetIfIPv4Addr': u'192.0.2.1/24', 'asgNetIfMTU': u'NA', 'asgNetIfIPv6Addr': u'-', 'asgNetIfTx': 14214325659, 'asgNetIfState': u'(up)/(up)', 'asgNetIfRx': 24549684703, 'asgNetIfInfo': u'Bond Master'}, - # u'bond2.602': {'asgNetIfDuplex': u'Full', 'asgNetIfSpeed': u'NA', 'asgNetIfMACAddr': u'00:1c:7f:81:05:09', 'asgNetIfIPv4Addr': u'10.9.9.1/25', 'asgNetIfMTU': u'1500', 'asgNetIfIPv6Addr': u'-', 'asgNetIfTx': 4673143507, 'asgNetIfState': u'(up)/(up)', 'asgNetIfRx': 355320533, 'asgNetIfInfo': u'Vlan'}, - # u'bond2.3001': {'asgNetIfDuplex': u'Full', 'asgNetIfSpeed': u'NA', 'asgNetIfMACAddr': u'00:1c:7f:81:05:09', 'asgNetIfIPv4Addr': u'10.0.100.49/27', 'asgNetIfMTU': u'1500', 'asgNetIfIPv6Addr': u'-', 'asgNetIfTx': 229216384, 'asgNetIfState': u'(up)/(up)', 'asgNetIfRx': 2910413426, 'asgNetIfInfo': u'Vlan'}, - # u'magg1': {'asgNetIfDuplex': u'Full', 'asgNetIfSpeed': u'20G', 'asgNetIfMACAddr': u'00:1c:7f:6e:9b:dc', 'asgNetIfIPv4Addr': u'10.0.100.9/27', 'asgNetIfMTU': u'NA', 'asgNetIfIPv6Addr': u'-', 'asgNetIfTx': 384654797, 'asgNetIfState': u'(up)/(up)', 'asgNetIfRx': 200631796, 'asgNetIfInfo': u'Bond Master'}, - # } - # - for item in parsed.keys(): - yield item, {'asgNetIfSpeed': parsed.get(item).get('asgNetIfSpeed')} - - -def check_checkpoint_asg_interface(item, params, parsed): - def get_throughput(rate_bits): - # 1024 * 1024 * 1024 * 1024 --> Tbits (1099511627776) - if rate_bits > 1099511627776: - rate = '%.2f Tbit/s' % (rate_bits / 1099511627776) - # 1024 * 1024 * 1024 --> GBits (1073741824) - elif rate_bits > 1073741824: - rate = '%.2f Gbit/s' % (rate_bits / 1073741824) - # 1024 * 1024 --> Mbits (1048576) - elif rate_bits > 1048576: - rate = '%.2f MBit/s' % (rate_bits / 1048576) - # 1024 --> Kbit - elif rate_bits > 1024: - rate = '%.2f Kbit/s' % (rate_bits / 1024) - else: - rate = '%.2f bit/s' % rate_bits - return rate - - try: - asg_interface = parsed[item] - asgNetIfIPv4Addr = asg_interface['asgNetIfIPv4Addr'] - asgNetIfState = asg_interface['asgNetIfState'] - asgNetIfSpeed = asg_interface['asgNetIfSpeed'] - asgNetIfDuplex = asg_interface['asgNetIfDuplex'] - - - if params: - inv_asgNetIfSpeed = params['asgNetIfSpeed'] - - now_time = time.time() - rate_item = item.lower().replace(' ', '_').replace(':', '_') - - rx_bits = get_rate('checkpoint_asg_interface.%s.%s' % ('asgNetIfRx', rate_item), now_time, asg_interface['asgNetIfRx'] * 8, onwrap=SKIP) - tx_bits = get_rate('checkpoint_asg_interface.%s.%s' % ('asgNetIfTx', rate_item), now_time, asg_interface['asgNetIfTx'] * 8, onwrap=SKIP) - - perfdata = [] - perfdata.append(('out', tx_bits, None, None, None, None)) - perfdata.append(('in', rx_bits, None, None, None, None)) - - longoutput = '' - longoutput += '\nIPv4 Address: %s' % asg_interface['asgNetIfIPv4Addr'] - longoutput += '\nIPv6 Address: %s' % asg_interface['asgNetIfIPv6Addr'] - longoutput += '\nMAC Address: %s' % asg_interface['asgNetIfMACAddr'] - longoutput += '\nType: %s' % asg_interface['asgNetIfInfo'] - longoutput += '\nMTU: %s' % ['asgNetIfMTU'] - longoutput += '\nDuplex: %s' % asgNetIfDuplex - - infotext = '' - infotext += 'In: %s, Out: %s' % (get_throughput(rx_bits), get_throughput(tx_bits)) - infotext += ', Type: %s' % asg_interface['asgNetIfInfo'] - if not asgNetIfIPv4Addr == '-': - infotext += ', IPv4: %s' % asg_interface['asgNetIfIPv4Addr'] - - if not asgNetIfState.lower() == '(up)/(up)': - yield 2, 'State: %s' % asgNetIfState - else: - yield 0, 'State: %s' % asgNetIfState - - if not asgNetIfSpeed == inv_asgNetIfSpeed: - yield 1, 'Speed: %s (%s expected)' % (asgNetIfSpeed, inv_asgNetIfSpeed) - elif not asgNetIfSpeed == 'NA': - yield 0, 'Speed %s' % asgNetIfSpeed - - if not asgNetIfDuplex.lower(): - yield 2, 'Duplex: %s (Full expected)' % asgNetIfDuplex - #else: - # yield 0, 'Duplex: %s' % asgNetIfDuplex - - yield 0, infotext + longoutput, perfdata - - except KeyError: - pass - -check_info['checkpoint_asg_interface'] = { - 'check_function': check_checkpoint_asg_interface, - 'inventory_function': inventory_checkpoint_asg_interface, - 'service_description': "ASG Interface %s", - 'snmp_scan_function': scan_checkpoint, - 'parse_function' : parse_checkpoint_asg_interface, - 'group': 'checkpoint_asg_interface', - 'has_perfdata' : True, - 'snmp_info': ( - '.1.3.6.1.4.1.2620.1.48.26.1.1', # CHECKPOINT-MIB::asgResourceEntry - [ - '2', # asgNetIfName - '3', # asgNetIfIPv4Addr - '4', # asgNetIfIPv6Addr - '5', # asgNetIfMACAddr - '6', # asgNetIfInfo - '7', # asgNetIfState - '8', # asgNetIfSpeed - '9', # asgNetIfMTU - '10', # asgNetIfDuplex - '11', # asgNetIfRx - '12', # asgNetIfTx - - ]), - 'includes': ['checkpoint.include'], -} \ No newline at end of file