From 61309674ff213f1d111173fb12ba9431bbeec2f9 Mon Sep 17 00:00:00 2001
From: thl-cmk <thl-cmk@outlook.com>
Date: Tue, 3 Aug 2021 07:52:07 +0000
Subject: [PATCH] Delete cisco_eigrp_peers

---
 checks/cisco_eigrp_peers | 333 ---------------------------------------
 1 file changed, 333 deletions(-)
 delete mode 100644 checks/cisco_eigrp_peers

diff --git a/checks/cisco_eigrp_peers b/checks/cisco_eigrp_peers
deleted file mode 100644
index 5c0479e..0000000
--- a/checks/cisco_eigrp_peers
+++ /dev/null
@@ -1,333 +0,0 @@
-#!/usr/bin/python
-# -*- encoding: utf-8; py-indent-offset: 4 -*-
-#
-# Cisco EIGRP peer status
-#
-# Author: Th.L.
-# Date  : 2017-17-20
-#
-# Monitor status of Cisco EIGRP peers
-#
-# 2018-02-11: removed unnecessary OIDs
-# 2018-07-26: code cleanup, removed hold time from infotext (it is the actual time, not the configured value)
-# 2018-08-06: modified scan function
-# 2019-07-01: fixed uptime for peers up for more then 1 year...
-# 2019-10-15: added initial support for IPv6, code cleanup (parser function)
-# 2019-10-16: added VRF support, fixed ipv4 address rendering
-#
-#  snmpwalk sample
-#
-# thl@surfbox-ii:~$ snmpwalk -v2c -c router-01 -ObentU simulant .1.3.6.1.4.1.9.9.449.1.4.1.1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.2.65536.10.1 = INTEGER: 1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.2.65536.10.2 = INTEGER: 1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.2.65536.10.3 = INTEGER: 1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.3.65536.10.1 = Hex-STRING: 0A A7 DD 3A   # can be also in the form of "10.10.10.10" :-(
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.3.65536.10.2 = Hex-STRING: 0A A7 DD 39
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.3.65536.10.3 = Hex-STRING: 0A A7 DD 3C
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.4.65536.10.1 = INTEGER: 9
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.4.65536.10.2 = INTEGER: 9
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.4.65536.10.3 = INTEGER: 9
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.5.65536.10.1 = Gauge32: 2
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.5.65536.10.2 = Gauge32: 2
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.5.65536.10.3 = Gauge32: 2
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.6.65536.10.1 = STRING: "01:05:33"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.6.65536.10.2 = STRING: "01:06:06"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.6.65536.10.3 = STRING: "01:05:57"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.7.65536.10.1 = Gauge32: 469
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.7.65536.10.2 = Gauge32: 1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.7.65536.10.3 = Gauge32: 1
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.8.65536.10.1 = Gauge32: 2814
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.8.65536.10.2 = Gauge32: 100
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.8.65536.10.3 = Gauge32: 100
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.9.65536.10.1 = Gauge32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.9.65536.10.2 = Gauge32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.9.65536.10.3 = Gauge32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.10.65536.10.1 = Gauge32: 30
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.10.65536.10.2 = Gauge32: 33
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.10.65536.10.3 = Gauge32: 24
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.11.65536.10.1 = STRING: "20.0/2.0"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.11.65536.10.2 = STRING: "20.0/2.0"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.11.65536.10.3 = STRING: "20.0/2.0"
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.12.65536.10.1 = Counter32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.12.65536.10.2 = Counter32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.12.65536.10.3 = Counter32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.13.65536.10.1 = Gauge32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.13.65536.10.2 = Gauge32: 0
-# .1.3.6.1.4.1.9.9.449.1.4.1.1.13.65536.10.3 = Gauge32: 0
-#
-# sample info
-# [
-#  [
-#   [u'65536.10.0', u'1', u'\n\xa7\xdd7', u'10', u'2', u'01:05:34', u'1', u'100', u'0', u'147', u'23.0/2.0', u'0', u'0']
-#  ],
-#  [
-#   [u'1', u'FastEthernet0', u'6'],
-#   [u'2', u'FastEthernet1', u'6'],
-#   [u'3', u'FastEthernet2', u'6'],
-#   [u'4', u'FastEthernet3', u'6'],
-#   [u'5', u'FastEthernet4', u'6'],
-#   [u'6', u'VoIP-Null0', u'1'],
-#   [u'7', u'Null0', u'1'],
-#   [u'8', u'Vlan1', u'53'],
-#   [u'9', u'Loopback0', u'24'],
-#   [u'10', u'Tunnel100', u'131']
-#  ]
-# ]
-#
-
-import re
-
-factory_settings['cisco_eigrp_peers_defaults'] = {
-    'minuptime': 86400,
-}
-
-###########################################################################
-#
-#  DATA Parser function
-#
-###########################################################################
-
-
-def parse_cisco_eigrp_peers(info):
-
-    InetAddressType = {0: 'unknown',
-                       1: 'ipv4',
-                       2: 'ipv6',
-                       3: 'ipv4z',
-                       4: 'ipv6z',
-                       16: 'dns',
-                       }
-
-    def render_ip4_address(bytestring):
-        if len(bytestring) == 4:  # byte sting length = 4 bytes
-            return ".".join(["%s" % ord(m) for m in bytestring])
-        elif len(bytestring) >= 7:  # ipv4 address > 4 octets + 3 dots
-            return bytestring
-
-    def shorten_ipv6_adress(address):
-        address = address.split(':')
-        span = 2
-        address = [''.join(address[i:i + span]) for i in range(0, len(address), span)]
-        for m in range(0, len(address)):
-            address[m] = re.sub(r'^0{1,3}', r'', address[m])
-        address = ':'.join(address)
-        zeros = ':0:0:0:0:0:0:'
-        while not zeros == '':
-            if zeros in address:
-                address = re.sub(r'%s' % zeros, r'::', address)
-                zeros = ''
-            else:
-                zeros = zeros[:-2]
-        if address == '0::0':
-            address = '::'
-
-        return address
-
-    def render_ipv6_address(bytestring):
-        address = ":".join(["%02s" % hex(ord(m))[2:] for m in bytestring]).replace(' ', '0').upper()
-        address = shorten_ipv6_adress(address)
-
-        return address
-
-    def get_uptime(uptimestr):
-        uptime_in_sec = 0
-        if 'y' in uptimestr and 'w' in uptimestr:
-            uptimestr = uptimestr.split('y')
-            uptime_in_sec = int(uptimestr[0]) * 31536000 # 365 * 24 * 3600, one year
-            uptime_in_sec += int(uptimestr[1][:-1]) * 604800 # 7 * 24 * 3600, one week
-        if 'w' in uptimestr and 'd' in uptimestr:
-            uptimestr = uptimestr.split('w')
-            uptime_in_sec = int(uptimestr[0]) * 604800  # 7 * 24 * 3600, one week
-            uptime_in_sec += int(uptimestr[1][:-1]) * 86400  # 24 * 3600, on day
-        elif 'd' in uptimestr and 'h' in uptimestr:
-            uptimestr = uptimestr.split('d')
-            uptime_in_sec = int(uptimestr[0]) * 86400  # 24 * 3600, one day
-            uptime_in_sec += int(uptimestr[1][:-1]) * 3600
-        elif ':' in uptimestr:
-            uptime_in_sec = uptimestr.split(':')
-            if len(uptime_in_sec) == 3:  # [19:20:00] hours:minutes:seconds
-                uptime_in_sec = (int(uptime_in_sec[0]) * 3600) + (int(uptime_in_sec[1]) * 60) + int(uptime_in_sec[2])
-            elif len(uptime_in_sec) == 4:  # [10:19:20:00]   days(?):hours:minutes:seconds
-                uptime_in_sec = (int(uptime_in_sec[0]) * 86400) + \
-                                (int(uptime_in_sec[1]) * 3600) + \
-                                (int(uptime_in_sec[2]) * 60) + \
-                                int(uptime_in_sec[3])
-
-        return uptime_in_sec
-
-    peers, peer_interfaces, VrfInfo = info
-    PeerTable = []
-
-    for peer in peers:
-        OID_END, cEigrpPeerAddrType, cEigrpPeerAddr, cEigrpPeerIfIndex, cEigrpHoldTime, cEigrpUpTime, cEigrpSrtt, cEigrpRto, cEigrpPktsEnqueued, cEigrpRetrans, cEigrpRetries = peer
-
-        cEigrpVrfId = int(OID_END.split('.')[0])
-        cEigrpPeerAS = OID_END.split('.')[1]
-        cEigrpAddrFammily = int(OID_END.split('.')[2])
-        if int(cEigrpPeerAddrType) == 1:  # IPv4 address
-            cEigrpPeerAddr = render_ip4_address(cEigrpPeerAddr)
-        elif int(cEigrpPeerAddrType) == 2:  # IPv4 address
-            cEigrpPeerAddr = render_ipv6_address(cEigrpPeerAddr)
-
-        cEigrpPeerIfIndex = peer[3]
-        cEigrpHoldTime = int(peer[4])
-        cEigrpUpTime = peer[5]
-        cEigrpSrtt = int(peer[6])
-        cEigrpRto = int(peer[7])
-        cEigrpPktsEnqueued = int(peer[8])
-        cEigrpRetrans = int(peer[9])
-        cEigrpRetries = int(peer[10])
-
-        cEigrpUpTimeSeconds = get_uptime(cEigrpUpTime)
-
-        PeerInterface = ''
-        for ifIndex, ifDescr, ifType in peer_interfaces:
-            if int(cEigrpPeerIfIndex) == int(ifIndex):
-                PeerInterface = ifDescr
-
-        cEigrpVrfName = ''
-        for VrfId, VrfName in VrfInfo:
-            if int(VrfId) == cEigrpVrfId:
-                cEigrpVrfName = VrfName
-
-        if cEigrpAddrFammily == 2:
-            cEigrpAddrFammily = 'IPv6'
-        else:
-            cEigrpAddrFammily = 'IPv4'
-
-        if cEigrpVrfName == 'default':
-            ServiceText = '%s on AS %s' % (cEigrpPeerAddr, cEigrpPeerAS)
-        else:
-            ServiceText = '%s on AS %s, VRF %s' % (cEigrpPeerAddr, cEigrpPeerAS, cEigrpVrfName)
-
-
-        PeerTable.append({'cEigrpPeerAS': cEigrpPeerAS,
-                           'cEigrpPeerAddr': cEigrpPeerAddr,
-                           'cEigrpUpTime': cEigrpUpTime,
-                           'cEigrpUpTimeSeconds': cEigrpUpTimeSeconds,
-                           'cEigrpSrtt': cEigrpSrtt,
-                           'cEigrpRto': cEigrpRto,
-                           'cEigrpPktsEnqueued': cEigrpPktsEnqueued,
-                           'cEigrpRetrans': cEigrpRetrans,
-                           'cEigrpRetries': cEigrpRetries,
-                           'cEigrpHoldTime': cEigrpHoldTime,
-                           'cEigrpVrfName': cEigrpVrfName,
-                           'cEigrpVrfId': cEigrpVrfId,
-                           'cEigrpAddrFammily': cEigrpAddrFammily,
-                           'ServiceText': ServiceText,
-                           'PeerInterface': PeerInterface})
-
-    return PeerTable
-
-###########################################################################
-#
-#  INVENTORY function
-#
-###########################################################################
-
-
-def inventory_cisco_eigrp_peers(parsed):
-
-    for peer in parsed:
-        yield '%s' % peer.get('ServiceText'), {}
-
-###########################################################################
-#
-#  CHECK function
-#
-###########################################################################
-
-
-def check_cisco_eigrp_peers(item, params, parsed):
-
-    def render_uptime(uptime):  # expects time in seconds
-        m, s = divmod(uptime, 60)  # break in seconds / minutes
-        h, m = divmod(m, 60)  # break in mintes / hours
-        if h >= 24:  # more then one day
-            d, h = divmod(h, 24)  # break in hours / days
-        else:
-            return '%02d:%02d:%02d' % (h, m, s)
-        if d >= 365:  # more the one year
-            y, d = divmod(d, 365)  # break in days / years
-            return '%dy %dd %02d:%02d:%02d' % (y, d, h, m, s)
-        else:
-            return '%dd %02d:%02d:%02d' % (d, h, m, s)
-
-    state = 2
-    infotext = 'Peer not found(!!)'
-    longoutput = ''
-    perfdata = []
-    minuptime = 86400
-
-    if params.get('minuptime'):
-        minuptime = params.get('minuptime')
-
-    for peer in parsed:
-
-        if peer.get('ServiceText') == item:
-            cEigrpUpTime = peer.get('cEigrpUpTime')
-            PeerInterface = peer.get('PeerInterface')
-
-            state = 0
-            infotext = 'Uptime: %s' % cEigrpUpTime
-
-            cEigrpUpTimeSeconds = peer.get('cEigrpUpTimeSeconds')  # get uptime in seconds
-
-            if cEigrpUpTimeSeconds < minuptime:
-                state = max(1, state)
-                infotext += ' <%s(!)' % (render_uptime(minuptime))
-
-            infotext += ', on interface: %s' % PeerInterface
-            # infotext += ', Hold time: %s' % cEigrpHoldTime
-
-            perfdata = [
-                        ('cEigrpUpTime', cEigrpUpTime),
-                        ('cEigrpPktsEnqueued', peer.get('cEigrpPktsEnqueued')),
-                        ('cEigrpRetrans', peer.get('cEigrpRetrans')),
-                        ('cEigrpRetries', peer.get('cEigrpRetries')),
-                        ('cEigrpSrtt', peer.get('cEigrpSrtt')),
-                        ('cEigrpRto', peer.get('cEigrpRto')),
-                    ]
-
-    return state, infotext + longoutput, perfdata
-
-###########################################################################
-#
-#  CHECK info
-#
-###########################################################################
-
-
-check_info['cisco_eigrp_peers'] = {
-    'check_function'         : check_cisco_eigrp_peers,
-    'inventory_function'     : inventory_cisco_eigrp_peers,
-    'service_description'    : 'EIGRP peer %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.4.1.1.*'),  # CISCO-EIGRP-MIB::cEigrpPeerEntry
-    'group'                  : 'cisco_eigrp_peers',
-    'default_levels_variable': 'cisco_eigrp_peers_defaults',
-    'parse_function'         : parse_cisco_eigrp_peers,
-    'snmp_info'              : [('.1.3.6.1.4.1.9.9.449.1.4.1.1', [OID_END,  # u'65536.10.0'        [0]
-                                                                  '2',      # cEigrpPeerAddrType   [1]
-                                                                  '3',      # cEigrpPeerAddr       [2]
-                                                                  '4',      # cEigrpPeerIfIndex    [3]
-                                                                  '5',      # cEigrpHoldTime       [4]
-                                                                  '6',      # cEigrpUpTime         [5]
-                                                                  '7',      # cEigrpSrtt           [6]
-                                                                  '8',      # cEigrpRto            [7]
-                                                                  '9',      # cEigrpPktsEnqueued   [8]
-                                                                  '12',     # cEigrpRetrans        [9]
-                                                                  '13',     # cEigrpRetries        [10]
-                                                                  # '10',     # cEigrpLastSeq        []
-                                                                  # '11',     # cEigrpVersion        []
-                                                                  ]),
-                                ('.1.3.6.1.2.1.2.2.1', ['1',  # ifIndex [0]
-                                                        '2',  # ifDescr [1]
-                                                        '3',  # ifType  [2]
-                                                        ]),
-                                ('.1.3.6.1.4.1.9.9.449.1.1.1.1', [OID_END,  # VRF ID
-                                                                  '2',  # cEigrpVpnName [0]
-                                                                ])
-                                ],
-}
-- 
GitLab