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

update project

parent bc334074
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
# Rewriten by: Th.L.
# Date: 19-02-2020
#
# 2020-05-14: added wato oprion to ignore items
#
# 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
......@@ -15,7 +16,7 @@
# 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.
#
#
# sample snmpwalk
#
......@@ -164,7 +165,8 @@
#
factory_settings['cisco_asyncos_update_default_levels'] = {
'failedLevel': (5, 10)
'failedLevel': (5, 10),
'features_ignore': []
}
......@@ -181,6 +183,7 @@ def check_cisco_asyncos_update(_no_item, params, info):
failedItemsWarn = []
failedItemsCrit = []
failedWarn, failedCrit = params.get('failedLevel')
features_ignore = params['features_ignore']
lastState = 1
for line in info:
......@@ -190,31 +193,18 @@ def check_cisco_asyncos_update(_no_item, params, info):
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
......@@ -231,54 +221,22 @@ def check_cisco_asyncos_update(_no_item, params, info):
else:
failedAttempts = failedAttempts + failed - failedLast
set_item_state('cisco_asyncos_update_%s_failedAttempts' % name, failedAttempts)
if failedAttempts >= failedCrit:
failedItemsCrit.append(name)
lastState = -1
elif failedAttempts >= failedWarn:
failedItemsWarn.append(name)
lastState = -1
# 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
if name not in features_ignore:
if failedAttempts >= failedCrit:
failedItemsCrit.append(name)
lastState = -1
elif failedAttempts >= failedWarn:
failedItemsWarn.append(name)
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
......
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, 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\n- 08.03.2020: added cisco_asyncos_dns, cisco_asyncos_resources, cisco_asyncos_messageage\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\n- 2020-03-08: added cisco_asyncos_dns, cisco_asyncos_resources, cisco_asyncos_messageage\n- 2020-05-14: added wato option to cisco_asyncos_update to ignore features\n',
'download_url': 'https://thl-cmk.hopto.org',
'files': {'checks': ['cisco_asyncos_bandwidth',
'cisco_asyncos_cache',
......@@ -24,6 +24,6 @@
'name': 'cisco_asyncos',
'num_files': 20,
'title': u'Cisco AsyncOS (IronPort) checks',
'version': '2020308_v0.1.3',
'version': '20200514_v0.1.4',
'version.min_required': '1.6.0p6',
'version.packaged': '1.6.0p8'}
\ No newline at end of file
......@@ -9,14 +9,14 @@ register_check_parameters(
Dictionary(
# help=_(''),
elements=[
# ('features_ignore',
# ListOfStrings(
# title=_('update features to ignore'),
# orientation='horizontal',
# help=_('there will be no warning/critical if this features are expired'
# 'Examples: McAfee, IronPort Email Encryption, Data Loss Prevention, etc.'),
# )
# ),
('features_ignore',
ListOfStrings(
title=_('update features to ignore'),
orientation='horizontal',
help=_('there will be no warning/critical if this features are not updated'
'Examples: geo_countries, timezones, etc.'),
)
),
('failedLevel',
Tuple(
title=_('Levels for failed attempts'),
......
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