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 7bc78a44 authored by thl-cmk's avatar thl-cmk :flag_na:
Browse files

update project

parent c060eace
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2021-03-24
#
# only use full for Cisco WSA appliances
#
from typing import Mapping, List, NamedTuple
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
CheckResult,
StringTable,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
check_levels,
Result,
SNMPTree,
contains,
State,
)
class CiscoAsyncosBandwidth(NamedTuple):
bandwidth_now: int
bandwidth_hour: int
bandwidth_day: int
# [[['0', '0', '247']]]
def parse_cisco_asyncos_bandwidth(string_table: List[StringTable]) -> CiscoAsyncosBandwidth:
return CiscoAsyncosBandwidth(
bandwidth_now=int(string_table[0][0][0]),
bandwidth_hour=int(string_table[0][0][1]),
bandwidth_day = int(string_table[0][0][2]),
)
def discovery_cisco_asyncos_bandwidth(section: CiscoAsyncosBandwidth) -> DiscoveryResult:
yield Service()
def check_cisco_asyncos_bandwidth(params, section: CiscoAsyncosBandwidth) -> CheckResult:
yield from check_levels(
section.bandwidth_now,
label='Current bandwidth',
levels_upper=params.get('upper', None),
levels_lower=params.get('lower', None),
metric_name='bandwith_now',
# render_func=
)
yield Result(state=State.OK,
summary='last hour: %s, last day: %s' % (section.bandwidth_hour, section.bandwidth_day))
register.snmp_section(
name='cisco_asyncos_bandwidth',
parse_function=parse_cisco_asyncos_bandwidth,
fetch=[
SNMPTree(
base='.1.3.6.1.4.1.15497.1.2.3.7.4', # ASYNCOSWEBSECURITYAPPLIANCE-MIB::proxyRecentBandWTotPerf
oids=[
'1', # cacheBwidthTotalNow
'3', # cacheBwidthTotal1hrMean
'5', # cacheBwidthTotal1dayMean
]
),
],
detect=contains('.1.3.6.1.2.1.1.1.0', 'AsyncOS'),
)
register.check_plugin(
name='cisco_asyncos_bandwidth',
service_name='Bandwidth',
discovery_function=discovery_cisco_asyncos_bandwidth,
check_function=check_cisco_asyncos_bandwidth,
check_default_parameters={},
)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
#
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2021-03-24
#
# only use full for Cisco WSA appliances
#
from typing import Mapping, List, NamedTuple
from cmk.base.plugins.agent_based.agent_based_api.v1.type_defs import (
DiscoveryResult,
CheckResult,
StringTable,
)
from cmk.base.plugins.agent_based.agent_based_api.v1 import (
register,
Service,
check_levels,
Result,
Metric,
SNMPTree,
contains,
State,
)
class CiscoAsyncosCache(NamedTuple):
cache_hits_now: int
cache_misses_now: int
cache_hit_resptime_now: int
cache_miss_resptime_now: int
cache_total_resptime: int
# [[['0', '0', '0', '0', '0']]]
def parse_cisco_asyncos_cache(string_table: List[StringTable]) -> CiscoAsyncosCache:
return CiscoAsyncosCache(
cache_hits_now=int(string_table[0][0][0]),
cache_misses_now=int(string_table[0][0][1]),
cache_hit_resptime_now=int(string_table[0][0][2]),
cache_miss_resptime_now=int(string_table[0][0][3]),
cache_total_resptime=int(string_table[0][0][4]),
)
def discovery_cisco_asyncos_cache(section: CiscoAsyncosCache) -> DiscoveryResult:
yield Service()
def check_cisco_asyncos_cache(params, section: CiscoAsyncosCache) -> CheckResult:
yield Result(state=State.OK,
summary='Cache Stats current %s Hits (%sms response time), %s Misses (%sms response time) and %sms total response time' % (
section.cache_hits_now, section.cache_hit_resptime_now, section.cache_misses_now,
section.cache_miss_resptime_now, section.cache_total_resptime))
yield Metric(name='cache_hits_now', value=section.cache_hits_now)
yield Metric(name='cache_misses_now', value=section.cache_misses_now)
yield Metric(name='cache_hit_resptime_now', value=section.cache_hit_resptime_now)
yield Metric(name='cache_miss_resptime_now', value=section.cache_miss_resptime_now)
yield Metric(name='cache_total_resptime', value=section.cache_total_resptime)
register.snmp_section(
name='cisco_asyncos_cache',
parse_function=parse_cisco_asyncos_cache,
fetch=[
SNMPTree(
base='.1.3.6.1.4.1.15497.1.2.3.7', # ASYNCOSWEBSECURITYAPPLIANCE-MIB::proxyRecentPerf
oids=[
'5.1', # cacheHitsNow
'6.1', # cacheMissesNow
'7.1', # cacheHitRespTimeNow
'8.1', # cacheMissRespTimeNow
'9.1', # cacheTotalRespTimeNow
]
),
],
detect=contains('.1.3.6.1.2.1.1.1.0', 'AsyncOS'),
)
register.check_plugin(
name='cisco_asyncos_cache',
service_name='Cache Stats',
discovery_function=discovery_cisco_asyncos_cache,
check_function=check_cisco_asyncos_cache,
check_default_parameters={},
)
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
# only use full for Cisco WSA appliances
#
cisco_asyncos_bandwidth_default_levels = {}
def inventory_cisco_asyncos_bandwidth(info):
if len(info) > 0:
return [(None, 'cisco_asyncos_bandwidth_default_levels')]
def check_cisco_asyncos_bandwidth(item, params, info):
state = 0
perfdata = []
warn, crit = None, None
now, onehour, oneday = info[0]
perfdata.append( ('now', now, warn, crit, 0, 1000000) )
perfdata.append( ('onehour', onehour, warn, crit, 0, 1000000) )
perfdata.append( ('oneday', oneday, warn, crit, 0, 1000000) )
infotext = 'Bandbreitennutzung aktuell %skBits - 1h Durchschnitt %skBits - 1d Durchschnitt %skBits' % (now, onehour, oneday)
return state, infotext, perfdata
check_info['cisco_asyncos_bandwidth'] = {
'check_function': check_cisco_asyncos_bandwidth,
'inventory_function': inventory_cisco_asyncos_bandwidth,
'service_description': 'Bandwidth total',
'has_perfdata': True,
'snmp_info': ('.1.3.6.1.4.1.15497.1.2.3.7.4', [ # ASYNCOSWEBSECURITYAPPLIANCE-MIB::proxyRecentBandWTotPerf
'1', # cacheBwidthTotalNow
'3', # cacheBwidthTotal1hrMean
'5', # cacheBwidthTotal1dayMean
]),
'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.1.0').find('AsyncOS') != -1,
# 'snmp_scan_function': scan_cisco_asyncos,
# 'includes': ['cisco_asyncos.include'],
}
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
# | | |___| | | | __/ (__| < | | | | . \ |
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
# | |
# | Copyright Mathias Kettner 2013 mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
# ails. You should have received a copy of the GNU General Public
# License along with GNU Make; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
# only use full for Cisco WSA appliances
#
cisco_asyncos_cache_default_levels = {}
def inventory_cisco_asyncos_cache(info):
if len(info) > 0:
return [(None, 'cisco_asyncos_cache_default_levels')]
def check_cisco_asyncos_cache(item, params, info):
state = 0
perfdata = []
warn, crit = None, None
hits, misses, hitresp, missresp, totalresp = info[0]
perfdata.append( ('hits', int(hits) ) )
perfdata.append( ('misses', int(misses) ) )
perfdata.append( ('hitresp', int(hitresp) ) )
perfdata.append( ('missresp', int(missresp) ) )
perfdata.append( ('totalresp', int(totalresp) ) )
infotext = 'Cache Stats aktuell %s Hits (%sms Antwortzeit), %s Misses (%sms Antwortzeit) und %sms gesamt Antwortzeit' % (hits, hitresp, misses, missresp, totalresp)
return state, infotext, perfdata
check_info['cisco_asyncos_cache'] = {
'check_function': check_cisco_asyncos_cache,
'inventory_function': inventory_cisco_asyncos_cache,
'service_description': 'Cache Stats',
'has_perfdata': True,
'snmp_info': ('.1.3.6.1.4.1.15497.1.2.3.7', [ # ASYNCOSWEBSECURITYAPPLIANCE-MIB::proxyRecentPerf
'5.1', # cacheHitsNow
'6.1', # cacheMissesNow
'7.1', # cacheHitRespTimeNow
'8.1', # cacheMissRespTimeNow
'9.1', # cacheTotalRespTimeNow
]),
'snmp_scan_function': lambda oid: oid('.1.3.6.1.2.1.1.1.0').find('AsyncOS') != -1,
# 'snmp_scan_function': scan_cisco_asyncos,
# 'includes': ['cisco_asyncos.include'],
}
No preview for this file type
......@@ -20,17 +20,18 @@
'\n'
'- 2021-03-21: rewrite cisco_asyncos_cpu, cisco_asyncos_mem, '
'cisco_asyncos_temp for CMK 2.0\n'
'- 2021-03-24: rewrite cisco_asyncos_raid\n',
'- 2021-03-24: rewrite cisco_asyncos_raid, '
'cisco_asyncos_bandwidth, cisco_asyncos_cache\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'agent_based': ['cisco_asyncos_cpu.py',
'cisco_asyncos_mem.py',
'cisco_asyncos_temp.py',
'cisco_asyncos_fan.py',
'cisco_asyncos_power.py',
'cisco_asyncos_raid.py'],
'checks': ['cisco_asyncos_bandwidth',
'cisco_asyncos_cache',
'cisco_asyncos_conn',
'cisco_asyncos_raid.py',
'cisco_asyncos_bandwidth.py',
'cisco_asyncos_cache.py'],
'checks': ['cisco_asyncos_conn',
'cisco_asyncos_license',
'cisco_asyncos_queue',
'cisco_asyncos_update',
......
......@@ -63,22 +63,22 @@ metric_info['cisco_asyncos_mem_mem_used'] = {
#
######################################################################################################################
check_metrics['check_mk-cisco_asyncos_dns'] = {
'outstandingdnsrequests': {'name': 'cisco_asyncos_dns_outstandingdnsrequests', },
'pendingdnsrequests': {'name': 'cisco_asyncos_dns_pendingdnsrequests', },
}
check_metrics['check_mk-cisco_asyncos_messageage'] = {
'oldestmessageage': {'name': 'cisco_asyncos_messageage_oldestmessageage', },
}
check_metrics['check_mk-cisco_asyncos_queue'] = {
'queue': {'name': 'cisco_asyncos_queue_work_queue', },
}
check_metrics['check_mk-cisco_asyncos_mem'] = {
'mem_used': {'name': 'cisco_asyncos_mem_mem_used', },
}
# check_metrics['check_mk-cisco_asyncos_dns'] = {
# 'outstandingdnsrequests': {'name': 'cisco_asyncos_dns_outstandingdnsrequests', },
# 'pendingdnsrequests': {'name': 'cisco_asyncos_dns_pendingdnsrequests', },
# }
#
# check_metrics['check_mk-cisco_asyncos_messageage'] = {
# 'oldestmessageage': {'name': 'cisco_asyncos_messageage_oldestmessageage', },
# }
#
# check_metrics['check_mk-cisco_asyncos_queue'] = {
# 'queue': {'name': 'cisco_asyncos_queue_work_queue', },
# }
#
# check_metrics['check_mk-cisco_asyncos_mem'] = {
# 'mem_used': {'name': 'cisco_asyncos_mem_mem_used', },
# }
######################################################################################################################
......
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