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

update project

parent 4c287205
No related branches found
No related tags found
No related merge requests found
......@@ -42,8 +42,8 @@ def check_cisco_asyncos_conn(_no_item, params, info):
warn, crit = None, None
idle, total, max = info[0]
active = int(total) - int(idle)
perfdata.append( ('active', active, warn, crit, 0, int(max)) )
perfdata.append( ('idle', idle, '', '', 0, int(max)) )
perfdata.append(('active', active, warn, crit, 0, int(max)))
perfdata.append(('idle', idle, '', '', 0, int(max)))
infotext = '%s Active Connections - %s Idle Connections - Maximum Connections was %s' % (active, idle, max)
return state, infotext, perfdata
......
......@@ -124,7 +124,7 @@
# ]
#
cisco_asyncos_license_default_levels = {
factory_settings['cisco_asyncos_license_default_levels'] = {
'expire': (30, 7), # 30 days warn, 7 days crit
# 'features_ignore': ['McAfee', 'Data Loss Prevention'], # list of features to ignore in license check
}
......@@ -191,6 +191,7 @@ check_info['cisco_asyncos_license'] = {
'4', # keySecondsUntilExpire
]),
'snmp_scan_function': scan_cisco_asyncos,
'default_levels_variable': 'cisco_asyncos_license_default_levels',
'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.
# Rewriten by: Th.L.
# Date: 19-02-2020
#
#
# 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
......@@ -24,47 +16,269 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
#
# sample snmpwalk
#
# OMD[cmk16x]:~$ snmpwalk -v2c -c public -m ASYNCOS-MAIL-MIB -ObentU localhost updateEntry
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.1 = INTEGER: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.2 = INTEGER: 2
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.3 = INTEGER: 3
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.4 = INTEGER: 4
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.5 = INTEGER: 5
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.6 = INTEGER: 6
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.7 = INTEGER: 7
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.8 = INTEGER: 8
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.9 = INTEGER: 9
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.10 = INTEGER: 10
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.11 = INTEGER: 11
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.12 = INTEGER: 12
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.13 = INTEGER: 13
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.14 = INTEGER: 14
# .1.3.6.1.4.1.15497.1.1.1.13.1.1.15 = INTEGER: 15
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.1 = STRING: File Reputation
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.2 = STRING: IronPort Anti-Spam
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.3 = STRING: McAfee
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.4 = STRING: Sophos Anti-Virus
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.5 = STRING: amp
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.6 = STRING: content_scanner
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.7 = STRING: enrollment_client
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.8 = STRING: geo_countries
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.9 = STRING: howto
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.10 = STRING: openssh_key
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.11 = STRING: repeng
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.12 = STRING: sdr_client
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.13 = STRING: smart_agent
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.14 = STRING: support_request
# .1.3.6.1.4.1.15497.1.1.1.13.1.2.15 = STRING: timezones
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.1 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.2 = Counter32: 10
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.3 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.4 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.5 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.6 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.7 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.8 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.9 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.10 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.11 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.12 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.13 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.14 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.3.15 = Counter32: 1
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.1 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.2 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.3 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.4 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.5 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.6 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.7 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.8 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.9 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.10 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.11 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.12 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.13 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.14 = Counter32: 0
# .1.3.6.1.4.1.15497.1.1.1.13.1.4.15 = Counter32: 0
#
# OMD[cmk16x]:~$ snmpwalk -v2c -c public -m ASYNCOS-MAIL-MIB localhost updateEntry
# ASYNCOS-MAIL-MIB::updateIndex.1 = INTEGER: 1
# ASYNCOS-MAIL-MIB::updateIndex.2 = INTEGER: 2
# ASYNCOS-MAIL-MIB::updateIndex.3 = INTEGER: 3
# ASYNCOS-MAIL-MIB::updateIndex.4 = INTEGER: 4
# ASYNCOS-MAIL-MIB::updateIndex.5 = INTEGER: 5
# ASYNCOS-MAIL-MIB::updateIndex.6 = INTEGER: 6
# ASYNCOS-MAIL-MIB::updateIndex.7 = INTEGER: 7
# ASYNCOS-MAIL-MIB::updateIndex.8 = INTEGER: 8
# ASYNCOS-MAIL-MIB::updateIndex.9 = INTEGER: 9
# ASYNCOS-MAIL-MIB::updateIndex.10 = INTEGER: 10
# ASYNCOS-MAIL-MIB::updateIndex.11 = INTEGER: 11
# ASYNCOS-MAIL-MIB::updateIndex.12 = INTEGER: 12
# ASYNCOS-MAIL-MIB::updateIndex.13 = INTEGER: 13
# ASYNCOS-MAIL-MIB::updateIndex.14 = INTEGER: 14
# ASYNCOS-MAIL-MIB::updateIndex.15 = INTEGER: 15
# ASYNCOS-MAIL-MIB::updateServiceName.1 = STRING: File Reputation
# ASYNCOS-MAIL-MIB::updateServiceName.2 = STRING: IronPort Anti-Spam
# ASYNCOS-MAIL-MIB::updateServiceName.3 = STRING: McAfee
# ASYNCOS-MAIL-MIB::updateServiceName.4 = STRING: Sophos Anti-Virus
# ASYNCOS-MAIL-MIB::updateServiceName.5 = STRING: amp
# ASYNCOS-MAIL-MIB::updateServiceName.6 = STRING: content_scanner
# ASYNCOS-MAIL-MIB::updateServiceName.7 = STRING: enrollment_client
# ASYNCOS-MAIL-MIB::updateServiceName.8 = STRING: geo_countries
# ASYNCOS-MAIL-MIB::updateServiceName.9 = STRING: howto
# ASYNCOS-MAIL-MIB::updateServiceName.10 = STRING: openssh_key
# ASYNCOS-MAIL-MIB::updateServiceName.11 = STRING: repeng
# ASYNCOS-MAIL-MIB::updateServiceName.12 = STRING: sdr_client
# ASYNCOS-MAIL-MIB::updateServiceName.13 = STRING: smart_agent
# ASYNCOS-MAIL-MIB::updateServiceName.14 = STRING: support_request
# ASYNCOS-MAIL-MIB::updateServiceName.15 = STRING: timezones
# ASYNCOS-MAIL-MIB::updates.1 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.2 = Counter32: 10
# ASYNCOS-MAIL-MIB::updates.3 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.4 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.5 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.6 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.7 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.8 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.9 = Counter32: 0
# ASYNCOS-MAIL-MIB::updates.10 = Counter32: 0
# ASYNCOS-MAIL-MIB::updates.11 = Counter32: 0
# ASYNCOS-MAIL-MIB::updates.12 = Counter32: 0
# ASYNCOS-MAIL-MIB::updates.13 = Counter32: 0
# ASYNCOS-MAIL-MIB::updates.14 = Counter32: 1
# ASYNCOS-MAIL-MIB::updates.15 = Counter32: 1
# ASYNCOS-MAIL-MIB::updateFailures.1 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.2 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.3 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.4 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.5 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.6 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.7 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.8 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.9 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.10 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.11 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.12 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.13 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.14 = Counter32: 0
# ASYNCOS-MAIL-MIB::updateFailures.15 = Counter32: 0
#
# sample info
#
# [[u'File Reputation', u'1', u'0'],
# [u'IronPort Anti-Spam', u'10', u'0'],
# [u'McAfee', u'1', u'0'],
# [u'Sophos Anti-Virus', u'1', u'0'],
# [u'amp', u'1', u'0'],
# [u'content_scanner', u'1', u'0'],
# [u'enrollment_client', u'1', u'0'],
# [u'geo_countries', u'1', u'0'],
# [u'howto', u'0', u'0'],
# [u'openssh_key', u'0', u'0'],
# [u'repeng', u'0', u'0'],
# [u'sdr_client', u'0', u'0'],
# [u'smart_agent', u'0', u'0'],
# [u'support_request', u'1', u'0'],
# [u'timezones', u'1', u'0']
# ]
#
factory_settings['cisco_asyncos_update_default_levels'] = {
'failedLevel': (5, 10)
}
def inventory_cisco_asyncos_update(info):
if len(info) > 0:
return [(None, None)]
def check_cisco_asyncos_update(_no_item, params, info):
if len(info) > 0:
infotext = ''
longoutput = ''
perfdata = []
failedItemsWarn = []
failedItemsCrit = []
failedWarn, failedCrit = params.get('failedLevel')
for line in info:
yield line[0], None
def check_cisco_asyncos_update(item, _no_params, info):
message = ''
for line in info:
if line[0] == item:
status = 0
name, amount, error = line
if int(amount) > 0:
message += '%s(!) Updates present' % amount
status = 0
if error != '0':
if len(message) > 0:
message += ', '
message += '%s(!) Error messages present' % error
status = 0
if status == 0 and len(message) == 0:
message = 'No Updates and Errors present'
return status, message
return 3, 'Update not found in SNMP output'
name, passed, failed = line
longoutput += '\n%s: %s/%s passed/failed attempt(s)' % (name, passed, failed)
# read counters
passedLast = get_item_state('cisco_asyncos_update_%s_passedLast' % name)
failedLast = get_item_state('cisco_asyncos_update_%s_failedLast' % name)
failedAttempts = get_item_state('cisco_asyncos_update_%s_failedAttempts' % name)
lastState = get_item_state('cisco_asyncos_update_%s_lastState' % name)
# lastState = 0
# set_item_state('cisco_asyncos_update_%s_lastState' % name, lastState)
# print 'cisco_asyncos_update_%s_passedLast: %s' % (name, passedLast)
# print 'cisco_asyncos_update_%s_failedLast: %s' % (name, failedLast)
# print 'cisco_asyncos_update_%s_failedAttempts: %s' % (name, failedAttempts)
# print 'cisco_asyncos_update_%s_lastState: %s' % (name, lastState)
if (passedLast == None) or (failedLast == None) or (failedAttempts == None) or (lastState == None):
# init counters
# print ' init counters'
set_item_state('cisco_asyncos_update_%s_passedLast' % name, passed)
set_item_state('cisco_asyncos_update_%s_failedLast' % name, failed)
set_item_state('cisco_asyncos_update_%s_failedAttempts' % name, 0)
lastState = 0
set_item_state('cisco_asyncos_update_%s_lastState' % name, lastState)
else:
set_item_state('cisco_asyncos_update_%s_passedLast' % name, passed)
set_item_state('cisco_asyncos_update_%s_failedLast' % name, failed)
passedLast = int(passedLast)
failedLast = int(failedLast)
failedAttempts = int(failedAttempts)
lastState = int(lastState)
failed = int(failed)
passed = int(passed)
# reset counter if overrun
if failed < failedLast:
set_item_state('cisco_asyncos_update_%s_failedLast' % name, failed)
failedLast = failed
if passed < passedLast:
set_item_state('cisco_asyncos_update_%s_passedLast' % name, passed)
passedLast = passed
if passed == passedLast and failed == failedLast:
# no attempt since last check
if lastState == 2:
failedItemsCrit.append(name)
elif lastState == 1:
failedItemsWarn.append(name)
elif failed > failedLast:
# failed attempts since last check
failedAttempts = failedAttempts + failed - failedLast
set_item_state('cisco_asyncos_update_%s_failedAttempts' % name, failedAttempts)
if failedAttempts >= failedCrit:
failedItemsCrit.append(name)
lastState = 2
elif failedAttempts >= failedWarn:
failedItemsWarn.append(name)
lastState = 1
elif passed > passedLast:
# rest error counter and state
lastState = 0
set_item_state('cisco_asyncos_update_%s_failedAttempts' % name, 0)
set_item_state('cisco_asyncos_update_%s_lastState' % name, lastState)
if lastState == 0:
lastState = 1
else:
lastState = -1
# perfdata.append((name.replace(' ', '_'), lastState, None, None, -1, +1))
# print failedItemsCrit
# print failedListWarn
infotext += '%d item(s) found' % len(info)
if len(failedItemsCrit) > 0:
yield 2, '%d failed item(s) (%s), failed attempts >= %d' % (len(failedItemsCrit), ', '.join(failedItemsCrit), failedCrit)
if len(failedItemsWarn) > 0:
yield 1, '%d failed item(s) (%s), failed attempts >= %d' % (len(failedItemsWarn), ', '.join(failedItemsWarn), failedWarn)
# print perfdata
yield 0, infotext + longoutput, perfdata
check_info['cisco_asyncos_update'] = {
'check_function': check_cisco_asyncos_update,
'inventory_function': inventory_cisco_asyncos_update,
'service_description': 'Update %s',
'service_description': 'Update',
# 'has_perfdata': True,
'snmp_info': ('.1.3.6.1.4.1.15497.1.1.1.13.1', [ # ASYNCOS-MAIL-MIB::updateEntry
'2', # updateServiceName --> A textual name for an update entry
'3', # updates --> The number of successful attempts that have occurred when updating a service
'4', # updateFailures --> "The number of failed attempts that have occurred when updating a service
]),
'snmp_scan_function': scan_cisco_asyncos,
'default_levels_variable': 'cisco_asyncos_update_default_levels',
'includes': ['cisco_asyncos.include'],
}
No preview for this file type
{'author': u'Th.L. (thl-cmk[at]outlook[dot]com)',
'description': u'Cisco AsyncOS (IronPort) checks\n\n- fixed inventory function\n- changed scan function, to look for "AsyncOS"\n- cisco_asyncos_queue: added wato\n\n- cisco_asyncos_fan, cisco_asyncos_power, cisco_asyncos_raid, cisco_asyncos_license and cisco_asyncos_temp rewriten by Th.L. all other checks by A.Doehler\n\n- cisco_asyncos_fan uses fan.include\n- cisco_asyncos_temp uses temperature.include\n',
'description': u'Cisco AsyncOS (IronPort) checks\n\n- fixed inventory function\n- changed scan function, to look for "AsyncOS"\n- cisco_asyncos_queue: added wato\n\n- cisco_asyncos_fan, cisco_asyncos_power, cisco_asyncos_raid, cisco_asyncos_license, cisco_asyncos_update and cisco_asyncos_temp rewriten by Th.L. all other checks by A.Doehler\n\n- cisco_asyncos_fan uses fan.include\n- cisco_asyncos_temp uses temperature.include\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'checks': ['cisco_asyncos_bandwidth',
'cisco_asyncos_cache',
......@@ -19,6 +19,6 @@
'name': 'cisco_asyncos',
'num_files': 15,
'title': u'Cisco AsyncOS (IronPort) checks',
'version': '20200210_v0.1.1',
'version': '20200219_v0.1.2',
'version.min_required': '1.6.0p6',
'version.packaged': '1.6.0p8'}
\ No newline at end of file
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