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

update project

parent 970b3a52
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
# #
factory_settings['cisco_flash_defaults'] = { factory_settings['cisco_flash_defaults'] = {
'warn_level_percent': 85,
'crit_level_percent': 90,
} }
########################################################################### ###########################################################################
...@@ -164,13 +166,16 @@ def check_cisco_flash(item, params, parsed): ...@@ -164,13 +166,16 @@ def check_cisco_flash(item, params, parsed):
filecount = cflPartition.get('filecount') filecount = cflPartition.get('filecount')
lowspacenotifythreshold = cflPartition.get('lowspacenotifythreshold') lowspacenotifythreshold = cflPartition.get('lowspacenotifythreshold')
size = max(size, 1) # for size = 0 --> div/0
percentused = 100 * usedspace / size percentused = 100 * usedspace / size
spacewarn = (size / 100) * lowspacenotifythreshold
if spacewarn >= freespace: crit_level_percent = params.get('crit_level_percent', 90)
yield 1, 'Low space' warn_level_percent = params.get('warn_level_percent', 85)
elif freespace <= 10: # 10 MB
yield 2, 'Low space' if percentused >= crit_level_percent:
yield 2, 'Low space, more then %s%% used' % crit_level_percent
elif percentused > warn_level_percent:
yield 1, 'Low space, more then %s%% used' % warn_level_percent
if cflPartition.get('neederasure'): if cflPartition.get('neederasure'):
yield 1, 'Partition needs erasure' yield 1, 'Partition needs erasure'
...@@ -183,14 +188,10 @@ def check_cisco_flash(item, params, parsed): ...@@ -183,14 +188,10 @@ def check_cisco_flash(item, params, parsed):
longoutput += '\nDevice index: %s' % cflPartition.get('flashindex') longoutput += '\nDevice index: %s' % cflPartition.get('flashindex')
longoutput += '\nPartition index: %s' % cflPartition.get('index') longoutput += '\nPartition index: %s' % cflPartition.get('index')
# longoutput += '\nPartition size: %s' % size
# longoutput += '\nPartition used space: %s' % usedspace
# longoutput += '\nPartition free space: %s' % freespace
# longoutput += '\nPartition warn space: %s' % spacewarn
longoutput += '\nPartition need erasure: %s' % cflPartition.get('neederasure') longoutput += '\nPartition need erasure: %s' % cflPartition.get('neederasure')
longoutput += '\nPartition low space notify threshold: %s' % lowspacenotifythreshold longoutput += '\nPartition low space notify threshold: %s' % lowspacenotifythreshold
infotext += '%s%% used (%s of %s MB), File count: %s' % (percentused, usedspace, size, filecount) infotext += '%s%% used (%s of %s MB), %s MB free, File count: %s' % (percentused, usedspace, size, freespace, filecount)
yield 0, infotext + longoutput, perfdata yield 0, infotext + longoutput, perfdata
......
No preview for this file type
...@@ -13,10 +13,11 @@ ...@@ -13,10 +13,11 @@
'pnp-templates': [], 'pnp-templates': [],
'web': ['plugins/metrics/cisco_flash.py', 'web': ['plugins/metrics/cisco_flash.py',
'plugins/views/inv_cisco_flash.py', 'plugins/views/inv_cisco_flash.py',
'plugins/wato/cisco_flash.py',
'plugins/wato/inv_cisco_flash.py']}, 'plugins/wato/inv_cisco_flash.py']},
'name': 'cisco_flash', 'name': 'cisco_flash',
'num_files': 5, 'num_files': 6,
'title': 'Cisco flash plugins', 'title': 'Cisco flash plugins',
'version': '20191103v.0.2a', 'version': '20191104v.0.2b',
'version.min_required': '1.4.0p35', 'version.min_required': '1.4.0p35',
'version.packaged': '1.4.0p35'} 'version.packaged': '1.4.0p35'}
\ No newline at end of file
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
#
# Check_MK cisco_flash WATO plugin
#
# Author: Th.L.
# Date: 2019-11-04
#
#
#
#
register_check_parameters(
subgroup_networking,
'cisco_flash',
_('Cisco Flash'),
Dictionary(
help=_(''),
elements=[
('warn_level_percent',
Integer(
title=_('Warning if above percentage of used space'),
label=_('Warning if above percentage of used space'),
help=_('Warning if above percentage of used space'),
default_value=85,
allow_empty=False,
minvalue=1,
maxvalue=100
)),
('crit_level_percent',
Integer(
title=_('Critical if above percentage of used space'),
label=_('Critical if above percentage of used space'),
help=_('Critical if above percentage of used space'),
default_value=90,
allow_empty=False,
minvalue=1,
maxvalue=100
)),
],
),
TextAscii(title=_('Cisco flash')),
match_type='dict',
)
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