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

update project

parent 30254568
No related branches found
No related tags found
No related merge requests found
[PACKAGE]: ../../raw/master/mkp/cisco_asyncos-0.4.1-20240418.mkp "cisco_asyncos-0.4.1-20240418.mkp"
[PACKAGE]: ../../raw/master/mkp/cisco_asyncos-0.4.2-20240616.mkp "cisco_asyncos-0.4.2-20240616.mkp"
# Cisco AsyncOS (IronPort)
**Note: this package is for CheckMK version 2.x. For other versions see the corresponding branch.**
......
File added
......@@ -9,7 +9,8 @@
#
# 2020-05-14: added wato option to ignore items
# 2021-03-25: rewrite for CMK2.0
#
# 2024-06-16: replaced get_item_state/set_item_state by get_value_store to work on CMK 2.3 also
#
# sample snmpwalk
#
......@@ -154,14 +155,10 @@ from cmk.base.plugins.agent_based.agent_based_api.v1 import (
Service,
State,
contains,
get_value_store,
register,
)
from cmk.base.item_state import (
get_item_state,
set_item_state,
)
class CiscoAsyncosUpdate(NamedTuple):
updates: int
......@@ -229,41 +226,43 @@ def check_cisco_asyncos_updates(params, section: Mapping[str, CiscoAsyncosUpdate
features_ignore = params.get('features_ignore', [])
warn, crit = params.get('failedLevel')
ignore_count = 0
value_store = get_value_store()
for feature in section.keys():
failed = section[feature].update_failures
passed = section[feature].updates
# read counters
passed_last = get_item_state('cisco_asyncos_updates_%s_passedLast' % feature)
failed_last = get_item_state('cisco_asyncos_updates_%s_failedLast' % feature)
failed_attempts = get_item_state('cisco_asyncos_updates_%s_failedAttempts' % feature)
passed_last = value_store.get(f'cisco_asyncos_updates_{feature}_passedLast')
failed_last = value_store.get(f'cisco_asyncos_updates_{feature}_failedLast')
failed_attempts = value_store.get(f'cisco_asyncos_updates_{feature}_failedAttempts')
if (passed_last is None) or (failed_last is None) or (failed_attempts is None): # or (lastState is None):
# init counters
set_item_state('cisco_asyncos_updates_%s_passedLast' % feature, passed)
set_item_state('cisco_asyncos_updates_%s_failedLast' % feature, failed)
set_item_state('cisco_asyncos_updates_%s_failedAttempts' % feature, 0)
value_store[f'cisco_asyncos_updates_{feature}_passedLast'] = passed
value_store[f'cisco_asyncos_updates_{feature}_failedLast'] = failed
value_store[f'cisco_asyncos_updates_{feature}_failedAttempts'] = 0
else:
set_item_state('cisco_asyncos_updates_%s_passedLast' % feature, passed)
set_item_state('cisco_asyncos_updates_%s_failedLast' % feature, failed)
value_store[f'cisco_asyncos_updates_{feature}_passedLast'] = passed
value_store[f'cisco_asyncos_updates_{feature}_failedLast'] = failed
passed_last = int(passed_last)
failed_last = int(failed_last)
failed_attempts = int(failed_attempts)
# reset counter if overrun
if failed < failed_last:
set_item_state('cisco_asyncos_updates_%s_failedLast' % feature, failed)
value_store[f'cisco_asyncos_updates_{feature}_failedLast'] = failed
failed_last = failed
if passed < passed_last:
set_item_state('cisco_asyncos_updates_%s_passedLast' % feature, passed)
value_store[f'cisco_asyncos_updates_{feature}_passedLast'] = passed
passed_last = passed
if passed > passed_last:
# reset error counter after passed update attempt
set_item_state('cisco_asyncos_updates_%s_failedAttempts' % feature, 0)
value_store[f'cisco_asyncos_updates_{feature}_failedAttempts'] = 0
else:
failed_attempts = failed_attempts + failed - failed_last
set_item_state('cisco_asyncos_updates_%s_failedAttempts' % feature, failed_attempts)
value_store[f'cisco_asyncos_updates_{feature}_failedAttempts'] = failed_attempts
base_message = f'{feature}: {passed}/{failed}'
if feature in features_ignore:
yield Result(state=State.OK, notice=f'{base_message} updates/update failures. Feature ignored!')
......
......@@ -47,7 +47,7 @@
'wato/cisco_asyncos_dns.py']},
'name': 'cisco_asyncos',
'title': 'Cisco AsyncOS (IronPort) checks',
'version': '0.4.1-20240418',
'version': '0.4.2-20240616',
'version.min_required': '2.1.0b1',
'version.packaged': 'cmk-mkp-tool 0.2.0',
'version.usable_until': '2.3.0b1'}
'version.usable_until': '2.4.0b1'}
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