diff --git a/checks/cisco_asyncos_update b/checks/cisco_asyncos_update index 35bfda0fceab29baf7363d7351ea9a707da2124b..5c597db8e68f1f6ef17b51c706eed987ac9a1cb2 100644 --- a/checks/cisco_asyncos_update +++ b/checks/cisco_asyncos_update @@ -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 diff --git a/cisco_asyncos.mkp b/cisco_asyncos.mkp index 7558c56841d440ef2c73a0e3011ebe8e97582629..6851723518c4cb1a2f918ebb03ccc0fe9c1828eb 100644 Binary files a/cisco_asyncos.mkp and b/cisco_asyncos.mkp differ diff --git a/packages/cisco_asyncos b/packages/cisco_asyncos index 4d3fa8767bb0e02c569b618be3e41cc94882049c..c62480ee48945ecfacda7b8a55195a7fd142c1c6 100644 --- a/packages/cisco_asyncos +++ b/packages/cisco_asyncos @@ -1,5 +1,5 @@ {'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 diff --git a/web/plugins/wato/cisco_asyncos_update.py b/web/plugins/wato/cisco_asyncos_update.py index d370a72cbefa8e1e7ade7a655b162ce01065ce42..19456b13c0d49666deed424cd44c23d5f8adae0b 100644 --- a/web/plugins/wato/cisco_asyncos_update.py +++ b/web/plugins/wato/cisco_asyncos_update.py @@ -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'),