diff --git a/agent_based/cisco_asa_sensors.py b/agent_based/cisco_asa_sensors.py index 240f9e3d8bcc88af62c9cabfcff2082ccc5cdf7a..5941c7caedadc25139b84d397845ff8905e3cc6e 100644 --- a/agent_based/cisco_asa_sensors.py +++ b/agent_based/cisco_asa_sensors.py @@ -202,10 +202,10 @@ def check_cisco_asa_fan(item, params: TempParamType, section) -> CheckResult: yield from check_levels( sensor.value, - label='Fan speed', + label='Speed', levels_lower=params.get('levels_lower', None), levels_upper=params.get('levels_upper', None), - metric_name='fan_speed', + metric_name='fan' if params.get('output_metrics') else None, render_func=lambda v: render_rpm(v), ) @@ -220,7 +220,7 @@ register.check_plugin( discovery_function=discovery_cisco_asa_fan, check_function=check_cisco_asa_fan, check_default_parameters={}, - check_ruleset_name='fan_speed' + check_ruleset_name='hw_fans' ) diff --git a/cisco_asa_sensors.mkp b/cisco_asa_sensors.mkp index d8eafac38fe111963df4503988fe0344c3373ea1..be322d4201e6b0e74a74ea4dfc82a3d2d3506904 100644 Binary files a/cisco_asa_sensors.mkp and b/cisco_asa_sensors.mkp differ diff --git a/packages/cisco_asa_sensors b/packages/cisco_asa_sensors index 2a3a13a04363e32c200cb7c8a3b2fdc4221ec4d8..e89a24ebe94f4e3231d78d21c2e26a10bec06efe 100644 --- a/packages/cisco_asa_sensors +++ b/packages/cisco_asa_sensors @@ -2,11 +2,9 @@ 'description': 'This plugin contains checks for Cisco ASA fan, temperature ' 'and power supply\n', 'download_url': 'https://thl-cmk.hopto.org', - 'files': {'agent_based': ['cisco_asa_sensors.py'], - 'web': ['plugins/metrics/fan_speed.py', - 'plugins/wato/fan_speed.py']}, + 'files': {'agent_based': ['cisco_asa_sensors.py']}, 'name': 'cisco_asa_sensors', - 'num_files': 3, + 'num_files': 1, 'title': 'Cisco ASA Sensors', 'version': '20210318_v0.0.1', 'version.min_required': '2.0.0', diff --git a/web/plugins/metrics/fan_speed.py b/web/plugins/metrics/fan_speed.py deleted file mode 100644 index 3180bcddf8e9b9d6c46ebcde22937b62ae098f71..0000000000000000000000000000000000000000 --- a/web/plugins/metrics/fan_speed.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# - -from cmk.gui.i18n import _ - -from cmk.gui.plugins.metrics import ( - metric_info, - graph_info, - perfometer_info -) - -metric_info["fan_speed"] = { - "title": _("Fan speed"), - "unit": "rpm", - "color": "16/a", -} - -graph_info['fan_speed'] = { - 'title': _('Fan speed'), - 'metrics': [ - ('fan_speed', 'area'), - ], - 'scalars': [ - ('fan_speed:crit', _('crit level')), - ('fan_speed:warn', _('warn level')), - ], - -} - -perfometer_info.append({ - 'type': 'logarithmic', - 'metric': 'fan_speed', - 'half_value': 7500.0, - 'exponent': 2, -}) \ No newline at end of file diff --git a/web/plugins/wato/fan_speed.py b/web/plugins/wato/fan_speed.py deleted file mode 100644 index b3ff0821b7624d0eb3f3d2853dd01b9d7b303ed4..0000000000000000000000000000000000000000 --- a/web/plugins/wato/fan_speed.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2 -# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and -# conditions defined in the file COPYING, which is part of this source code package. - -from cmk.gui.i18n import _ -from cmk.gui.valuespec import ( - Dictionary, - DropdownChoice, - Float, - Integer, - TextAscii, - Transform, - Tuple, -) -from cmk.gui.plugins.wato import ( - RulespecGroupCheckParametersEnvironment, - CheckParameterRulespecWithItem, - rulespec_registry, -) - - -# New fan speed rule for modern fan checks that have the -# sensor type (e.g. 'CPU', 'Chassis', etc.) as the beginning of their -# item (e.g. 'CPU 1', 'Chassis 17/11'). This will replace all other -# fan speed rulesets in future. Note: those few fan speed checks -# that do *not* use an item, need to be converted to use one single -# item (other than None). -def _parameter_valuespec_temperature(): - return Transform( - Dictionary(elements=[ - ( - 'levels', - Transform( - Tuple( - title=_('Upper fan speed Levels'), - elements=[ - Float(title=_('Warning at'), unit=u'RPM'), - Float(title=_('Critical at'), unit=u'RPM'), - ], - ), - forth=lambda elems: (float(elems[0]), float(elems[1])), - ), - ), - ( - 'levels_lower', - Transform( - Tuple( - title=_('Lower fan speed Levels'), - elements=[ - Float(title=_('Warning below'), unit=u'RPM'), - Float(title=_('Critical below'), unit=u'RPM'), - ], - ), - forth=lambda elems: (float(elems[0]), float(elems[1])), - ), - ), - - # ('device_levels_handling', - # DropdownChoice( - # title=_('Interpretation of the device's own temperature status'), - # choices=[ - # ('usr', _('Ignore device's own levels')), - # ('dev', _('Only use device's levels, ignore yours')), - # ('best', _('Use least critical of your and device's levels')), - # ('worst', _('Use most critical of your and device's levels')), - # ('devdefault', _('Use device's levels if present, otherwise yours')), - # ('usrdefault', _('Use your own levels if present, otherwise the device's')), - # ], - # default_value='usrdefault', - # )), - # ( - # 'trend_compute', - # Dictionary( - # title=_('Trend computation'), - # elements=[ - # ('period', - # Integer( - # title=_('Observation period for fan speed trend computation'), - # default_value=30, - # minvalue=5, - # unit=_('minutes'), - # )), - # ('trend_levels', - # Tuple( - # title=_('Levels on fan speed increase per period'), - # elements=[ - # Integer( - # title=_('Warning at'), - # unit=u'RPM / ' + _('period'), - # default_value=5, - # ), - # Integer( - # title=_('Critical at'), - # unit=u'RPM / ' + _('period'), - # default_value=10, - # ) - # ], - # )), - # ('trend_levels_lower', - # Tuple( - # title=_('Levels on fan speed decrease per period'), - # elements=[ - # Integer( - # title=_('Warning at'), - # unit=u'RPM / ' + _('period'), - # default_value=5, - # ), - # Integer( - # title=_('Critical at'), - # unit=u'RPM / ' + _('period'), - # default_value=10, - # ) - # ], - # )), - # ('trend_timeleft', - # Tuple( - # title= - # _('Levels on the time left until a critical fann speed (upper or lower) is reached' - # ), - # elements=[ - # Integer( - # title=_('Warning if below'), - # unit=_('minutes'), - # default_value=240, - # ), - # Integer( - # title=_('Critical if below'), - # unit=_('minutes'), - # default_value=120, - # ), - # ], - # )) - # ], - # optional_keys=['trend_levels', 'trend_levels_lower', 'trend_timeleft'], - # ), - # ), - ],), - forth=lambda v: isinstance(v, tuple) and {'levels': v} or v, - ) - - -rulespec_registry.register( - CheckParameterRulespecWithItem( - check_group_name='fan_speed', - group=RulespecGroupCheckParametersEnvironment, - item_spec=lambda: TextAscii(title=_('Sensor ID'), - help=_('The identifier of the fan speed sensor.')), - match_type='dict', - parameter_valuespec=_parameter_valuespec_temperature, - title=lambda: _('Fan speed'), - )) \ No newline at end of file