diff --git a/checks/cisco_eigrp_interface b/checks/cisco_eigrp_interface deleted file mode 100644 index cad0be223e8e03fb5e2ab889682bee3ac3224475..0000000000000000000000000000000000000000 --- a/checks/cisco_eigrp_interface +++ /dev/null @@ -1,379 +0,0 @@ -#!/usr/bin/python -# -*- encoding: utf-8; py-indent-offset: 4 -*- -# -# Cisco EIGRP Interfaces -# -# Author: Th.L. -# Date : 2017-17-21 -# -# Monitor status of Cisco EIGRP interface info -# -# 2018-01-23: Th.L.: inventory skip Loopback interface -# 2018-02-11: Th.L.: removed unnecessary OIDs -# 2018-08-06: modified scan function -# 2019-10-14: added support for hamc-sha-256 authentication, md5 moved to warn, none moved to crit -# 2019-10-16: added support for IPv6 and VRFs, added data parser function -# 2019-10-31: changed item from interface long-name to interface short name -# -# snmpwalk sample -# -# OMD[mysite]:~$ snmpwalk -ObentU -v2c -c router-01 simulant .1.3.6.1.4.1.9.9.449.1.5.1.1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.3.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.3.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.3.65536.10.8 = Gauge32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.3.65536.10.9 = Gauge32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.4.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.4.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.4.65536.10.8 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.4.65536.10.9 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.5.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.5.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.5.65536.10.8 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.5.65536.10.9 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.6.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.6.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.6.65536.10.8 = Gauge32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.6.65536.10.9 = Gauge32: 19 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.7.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.7.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.7.65536.10.8 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.7.65536.10.9 = Gauge32: 23 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.8.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.8.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.8.65536.10.8 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.8.65536.10.9 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.9.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.9.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.9.65536.10.8 = Gauge32: 50 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.9.65536.10.9 = Gauge32: 84 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.10.65536.10.1 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.10.65536.10.7 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.10.65536.10.8 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.10.65536.10.9 = Gauge32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.11.65536.10.1 = Gauge32: 5 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.11.65536.10.7 = Gauge32: 5 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.11.65536.10.8 = Gauge32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.11.65536.10.9 = Gauge32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.12.65536.10.1 = Counter64: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.12.65536.10.7 = Counter64: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.12.65536.10.8 = Counter64: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.12.65536.10.9 = Counter64: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.13.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.13.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.13.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.13.65536.10.9 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.14.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.14.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.14.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.14.65536.10.9 = Counter32: 18 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.15.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.15.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.15.65536.10.8 = Counter32: 64 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.15.65536.10.9 = Counter32: 40 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.16.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.16.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.16.65536.10.8 = Counter32: 66 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.16.65536.10.9 = Counter32: 27 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.17.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.17.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.17.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.17.65536.10.9 = Counter32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.18.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.18.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.18.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.18.65536.10.9 = Counter32: 2 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.19.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.19.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.19.65536.10.8 = Counter32: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.19.65536.10.9 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.20.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.20.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.20.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.20.65536.10.9 = Counter32: 5 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.21.65536.10.1 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.21.65536.10.7 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.21.65536.10.8 = Counter32: 0 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.21.65536.10.9 = Counter32: 3 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.22.65536.10.1 = INTEGER: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.22.65536.10.7 = INTEGER: 1 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.22.65536.10.8 = INTEGER: 2 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.22.65536.10.9 = INTEGER: 2 -# .1.3.6.1.4.1.9.9.449.1.5.1.1.23.65536.10.1 = "" -# .1.3.6.1.4.1.9.9.449.1.5.1.1.23.65536.10.7 = "" -# .1.3.6.1.4.1.9.9.449.1.5.1.1.23.65536.10.8 = STRING: "KEY-EIGRP-10" -# .1.3.6.1.4.1.9.9.449.1.5.1.1.23.65536.10.9 = STRING: "KEY-EIGRP-10" -# # -# sample info -# [ -# [ -# [u'65536.10.1', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'5', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'1', u''], -# [u'65536.10.7', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'5', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'0', u'1', u''], -# [u'65536.10.8', u'1', u'0', u'0', u'1', u'0', u'0', u'50', u'0', u'1', u'0', u'0', u'0', u'64', u'66', u'0', u'0', u'1', u'0', u'0', u'2', u'KEY-EIGRP-10'], -# [u'65536.10.9', u'1', u'0', u'0', u'19', u'23', u'0', u'84', u'0', u'1', u'0', u'0', u'18', u'40', u'27', u'1', u'2', u'0', u'5', u'3', u'2', u'KEY-EIGRP-10'] -# ], -# [ -# [u'1', u'GigabitEthernet0/0/0'], -# [u'2', u'GigabitEthernet0/0/1'], -# [u'3', u'GigabitEthernet0/0/2'], -# [u'4', u'GigabitEthernet0/0/3'], -# [u'5', u'GigabitEthernet0'], -# [u'6', u'Null0'], -# [u'7', u'Loopback0'], -# [u'8', u'Tunnel10'], -# [u'9', u'Tunnel101'] -# ] -# ] -# - - -factory_settings['cisco_eigrp_interface_defaults'] = { - 'ignore_interfaces_auth': [24, ], # Loopback - 'no_auth_state': 2, - 'md5_auth_state': 1, -} - -########################################################################### -# -# DATA Parser function -# -########################################################################### - - -def parse_cisco_eigrp_interface(info): - - InetAddressType = { - 0: 'unknown', - 1: 'ipv4', - 2: 'ipv6', - 3: 'ipv4z', - 4: 'ipv6z', - 16: 'dns', - } - - def eigrp_authmode(mode): - name = { - 0: 'unknown', - 1: 'none', - 2: 'md5', - 3: 'hmac-sha-256' - } - return name.get(mode, 'unknown') - - def get_short_if_name(st): - names = {'ethernet': 'Eth', - 'fastethernet': 'Fa', - 'gigabitethernet': 'Gi', - 'tengigabitethernet': 'Te', - 'fortygigabitethernet': 'Fo', - 'hundredgigabitethernet': 'Hu', - 'port-channel': 'Po', - 'tunnel': 'Tu', - 'loopback': 'Lo', - } - for item in names.keys(): - if st.lower().startswith(item): - st = st.lower().replace(item, names.get(item)) - return st - - EigrpInterfaces, InterfaceNames, VrfInfo = info - EigrpIfTable = [] - - for OID_END, cEigrpPeerCount, cEigrpXmitReliableQ, cEigrpXmitUnreliableQ, cEigrpMeanSrtt, cEigrpPendingRoutes, \ - cEigrpHelloInterval, cEigrpUMcasts, cEigrpRMcasts, cEigrpUUcasts, cEigrpRUcasts, cEigrpMcastExcepts, \ - cEigrpCRpkts, cEigrpAcksSuppressed, cEigrpRetransSent, cEigrpOOSrvcd, cEigrpAuthMode, cEigrpAuthKeyChain in EigrpInterfaces: - - cEigrpVrfId = int(OID_END.split('.')[0]) - cEigrpAS = OID_END.split('.')[1] - cEigrpIfIndex = int(OID_END.split('.')[2]) - cEigrpIfName = '' - for ifindex, ifname, iftype in InterfaceNames: - if int(ifindex) == cEigrpIfIndex: # compare interface index - if not int(iftype) == 24: # skip Loopback interfaces - cEigrpIfName = get_short_if_name(ifname) - - - if cEigrpIfName != '': - cEigrpVrfName = '' - for VrfId, VrfName in VrfInfo: - if int(VrfId) == cEigrpVrfId: - cEigrpVrfName = VrfName - - if cEigrpVrfId < 100000: - cEigrpAddrFammily = 'IPv4' - else: - cEigrpAddrFammily = 'IPv6' - - - ServiceText = '' - if cEigrpVrfName == 'default' and cEigrpAddrFammily == 'IPv4': - ServiceText = '%s on AS %s' % (cEigrpIfName, cEigrpAS) - elif cEigrpVrfName == 'default' and cEigrpAddrFammily == 'IPv6': - ServiceText = '%s on AS %s IPv6' % (cEigrpIfName, cEigrpAS) - elif cEigrpVrfName != 'default' and cEigrpAddrFammily == 'IPv4': - ServiceText = '%s on AS %s VRF %s' % (cEigrpIfName, cEigrpAS, cEigrpVrfName) - elif cEigrpVrfName != 'default' and cEigrpAddrFammily == 'IPv6': - ServiceText = '%s on AS %s IPv6 VRF %s' % (cEigrpIfName, cEigrpAS, cEigrpVrfName) - - - EigrpIfTable.append({'cEigrpVrfId': cEigrpVrfId, - 'cEigrpAS': cEigrpAS, - 'cEigrpVrfName': cEigrpVrfName, - 'cEigrpIfName': cEigrpIfName, - 'cEigrpPeerCount': cEigrpPeerCount, - 'cEigrpXmitReliableQ': cEigrpXmitReliableQ, - 'cEigrpXmitUnreliableQ': cEigrpXmitUnreliableQ, - 'cEigrpMeanSrtt': cEigrpMeanSrtt, - 'cEigrpPendingRoutes': cEigrpPendingRoutes, - 'cEigrpHelloInterval': cEigrpHelloInterval, - 'cEigrpUMcasts': cEigrpUMcasts, - 'cEigrpUUcasts': cEigrpUUcasts, - 'cEigrpRUcasts': cEigrpRUcasts, - 'cEigrpMcastExcepts': cEigrpMcastExcepts, - 'cEigrpCRpkts': cEigrpCRpkts, - 'cEigrpAcksSuppressed': int(cEigrpAcksSuppressed), - 'cEigrpRetransSent': int(cEigrpRetransSent), - 'cEigrpOOSrvcd': int(cEigrpOOSrvcd), - 'cEigrpAuthMode': eigrp_authmode(int(cEigrpAuthMode)), - 'cEigrpAuthKeyChain': cEigrpAuthKeyChain, - 'ServiceText': ServiceText, - }) - - return EigrpIfTable - -########################################################################### -# -# INVENTORY function -# -########################################################################### - - -def inventory_cisco_eigrp_interface(parsed): - for EigrpIf in parsed: - yield EigrpIf.get('ServiceText'), {} - -########################################################################### -# -# CHECK function -# -########################################################################### - - -def check_cisco_eigrp_interface(item, params, parsed): - for EigrpIf in parsed: - if EigrpIf.get('ServiceText') == item: - - longoutput = '' - interface_type = 0 - - cEigrpPeerCount = EigrpIf.get('cEigrpPeerCount') - cEigrpXmitReliableQ = EigrpIf.get('cEigrpXmitReliableQ') - cEigrpXmitUnreliableQ = EigrpIf.get('cEigrpXmitUnreliableQ') - cEigrpMeanSrtt = EigrpIf.get('cEigrpMeanSrtt') - cEigrpPendingRoutes = EigrpIf.get('cEigrpPendingRoutes') - cEigrpHelloInterval = EigrpIf.get('cEigrpHelloInterval') - cEigrpUMcasts = EigrpIf.get('cEigrpUMcasts') - cEigrpRMcasts = EigrpIf.get('cEigrpRMcasts') - cEigrpUUcasts = EigrpIf.get('cEigrpUUcasts') - cEigrpRUcasts = EigrpIf.get('cEigrpRUcasts') - cEigrpMcastExcepts = EigrpIf.get('cEigrpMcastExcepts') - cEigrpCRpkts = EigrpIf.get('cEigrpCRpkts') - cEigrpAcksSuppressed = EigrpIf.get('cEigrpAcksSuppressed') - cEigrpRetransSent = EigrpIf.get('cEigrpRetransSent') - cEigrpOOSrvcd = EigrpIf.get('cEigrpOOSrvcd') - cEigrpAuthMode = EigrpIf.get('cEigrpAuthMode') - cEigrpAuthKeyChain = EigrpIf.get('cEigrpAuthKeyChain') - cEigrpAS = EigrpIf.get('cEigrpAS') - cEigrpIfName = EigrpIf.get('cEigrpIfName') - - state = 0 - infotext = 'Peer count: %s, Hello interval: %s, Auth Mode: %s' % (cEigrpPeerCount, cEigrpHelloInterval, cEigrpAuthMode) - - md5_auth_state = params.get('md5_auth_state') - no_auth_state = params.get('no_auth_state') - if interface_type not in params.get('ignore_interfaces_auth'): - if cEigrpAuthMode in ['md5'] and md5_auth_state != 0: - longoutput += '\n you can change the authentication mode to hmac-sha-256 by removing the eigrp authentication'\ - '\n configuration from the interface and move it to the "router eigrp configuration"'\ - '\n you need to change to "named mode configuration"'\ - '\n router eigrp YOUR-EIGRP-NAME'\ - '\n address-family ipv4 unicast autonomous-system %s'\ - '\n af-interface %s'\ - '\n authentication mode hmac-sha-256 YOUR-EIGRPKEY'\ - '\n exit-af-interface'\ - '\n eigrp YOUR-ROUTER-ID'\ - '\n network ....'\ - '\n end' % (cEigrpAS, cEigrpIfName) - yield md5_auth_state, 'weak authentication set' - elif cEigrpAuthMode == 'none' and no_auth_state != 0: - yield no_auth_state, 'no authentication set' - if cEigrpAuthKeyChain != '': - infotext += ', Key chain: %s' % cEigrpAuthKeyChain - - perfdata = [ - ('cEigrpPeerCount', cEigrpPeerCount), - ('cEigrpXmitReliableQ', cEigrpXmitReliableQ), - ('cEigrpXmitUnreliableQ', cEigrpXmitUnreliableQ), - ('cEigrpMeanSrtt', cEigrpMeanSrtt), - ('cEigrpPendingRoutes', cEigrpPendingRoutes), - ('cEigrpRMcasts', cEigrpRMcasts), - ('cEigrpUMcasts', cEigrpUMcasts), - ('cEigrpUUcasts', cEigrpUUcasts), - ('cEigrpRUcasts', cEigrpRUcasts), - ('cEigrpMcastExcepts', cEigrpMcastExcepts), - ('cEigrpCRpkts', cEigrpCRpkts), - ('cEigrpAcksSuppressed', cEigrpAcksSuppressed), - ('cEigrpRetransSent', cEigrpRetransSent), - ('cEigrpOOSrvcd', cEigrpOOSrvcd), - ] - - yield state, infotext + longoutput, perfdata - -########################################################################### -# -# CHECK info -# -########################################################################### - - -check_info['cisco_eigrp_interface'] = { - 'check_function' : check_cisco_eigrp_interface, - 'inventory_function' : inventory_cisco_eigrp_interface, - 'service_description' : 'EIGRP interface %s', - 'has_perfdata' : True, - 'snmp_scan_function' : lambda oid: oid('.1.3.6.1.2.1.1.1.0').lower().find('cisco') != -1 and - oid('.1.3.6.1.4.1.9.9.449.1.5.1.1.3.*'), # CISCO-EIGRP-MIB::cEigrpPeerCount - 'group' : 'cisco_eigrp_interface', - 'default_levels_variable': 'cisco_eigrp_interface_defaults', - 'parse_function' : parse_cisco_eigrp_interface, - 'snmp_info' : [('.1.3.6.1.4.1.9.9.449.1.5.1.1', [OID_END, # AS number and interface index [0] (u'65536.10.1') - '3', # cEigrpPeerCount [1] - '4', # cEigrpXmitReliableQ [2] - '5', # cEigrpXmitUnreliableQ [3] - '6', # cEigrpMeanSrtt [4] - '10', # cEigrpPendingRoutes [5] - '11', # cEigrpHelloInterval [6] - '13', # cEigrpUMcasts [7] - '14', # cEigrpRMcasts [8] - '15', # cEigrpUUcasts [9] - '16', # cEigrpRUcasts [10] - '17', # cEigrpMcastExcepts [11] - '18', # cEigrpCRpkts [12] - '19', # cEigrpAcksSuppressed [13] - '20', # cEigrpRetransSent [14] - '21', # cEigrpOOSrvcd [15] - '22', # cEigrpAuthMode [16] - '23', # cEigrpAuthKeyChain [17] - # '7', # cEigrpPacingReliable [] - # '8', # cEigrpPacingUnreliable [] - # '9', # cEigrpMFlowTimer [] - # '12', # cEigrpXmitNextSerial [] - ]), - ('.1.3.6.1.2.1.2.2.1', ['1', # ifIndex - '2', # ifDescr - '3', # ifType - ]), - ('.1.3.6.1.4.1.9.9.449.1.1.1.1', [OID_END, # VRF ID - '2', # cEigrpVpnName [0] - ]), - ] -}