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

Delete snmp_state.py

parent b02b818c
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# License: GNU General Public License v2
# Author: thl-cmk[at]outlook[dot]com
# URL : https://thl-cmk.hopto.org
# Date : 2023-07-09
# File : snmp_state.py
#
# WATO file for snmp_state check plugin
#
# 2023-07-09: initial release
# 2023-08-02: renamed from snmp_version to snmp_state
from cmk.gui.i18n import _
from cmk.gui.valuespec import (
Dictionary,
MonitoringState,
Tuple,
ListChoice,
Integer,
ListOfStrings
)
from cmk.gui.plugins.wato.utils import (
CheckParameterRulespecWithoutItem,
rulespec_registry,
RulespecGroupCheckParametersNetworking,
)
def _parameter_valuespec_snmp_state():
return Dictionary(
elements=[
('snmp_version',
Tuple(
orientation='horizontal',
title=_('SNMP Version'),
elements=[
ListChoice(
title=_('excepted SNMP Versions'),
choices=[
('1', 'Version 1'),
('2c', 'Version 2c'),
('3', 'Version 3')
],
allow_empty=False,
help=_('Select excepted SNMP versions. Default is "Version 3".'),
default_value=['3'],
),
MonitoringState(
title=_('Monitoring state if version not in excepted versions'),
default_value=1,
)
])),
('v3_level',
Tuple(
orientation='horizontal',
title=_('SNMP v3 level'),
elements=[
ListChoice(
title=_('excepted level'),
choices=[
('authpriv', 'authentication and privacy'),
('authnopriv', 'authentication and no privacy'),
('noauthnopriv', 'no authentication and no privacy'),
],
allow_empty=False,
help=_('Select excepted SNMP v3 protocol level. Default is "authentication and privacy".'),
default_value=['authpriv'],
),
MonitoringState(
title=_('Monitoring state if level is not in excepted list'),
default_value=1,
)
])),
('v3_authentication',
Tuple(
orientation='horizontal',
title=_('SNMP v3 authenticatio'),
elements=[
ListChoice(
title=_('excepted authentication'),
choices=[
('md5', 'MD5'),
('sha', 'SHA'),
('sha-224', 'SHA-224'),
('sha-256', 'SHA-256'),
('sha-384', 'SHA-384'),
('sha-512', 'SHA-512'),
],
allow_empty=False,
help=_('Select excepted SNMP v3 authentication. Default is "SHA*".'),
default_value=['sha', 'sha-224', 'sha-256', 'sha-384', 'sha-512'],
),
MonitoringState(
title=_('Monitoring state if authentication is not in excepted list'),
default_value=1,
)
])),
('v3_encryption',
Tuple(
orientation='horizontal',
title=_('SNMP v3 encryption'),
elements=[
ListChoice(
title=_('excepted encryption'),
choices=[
('des', 'DES'),
('aes', 'AES-128'),
],
allow_empty=False,
help=_('Select excepted encryption. Default is "AES-128".'),
default_value=['aes'],
),
MonitoringState(
title=_('Monitoring state if SNMP v3 encryption is not in excepted list'),
default_value=1,
)
])),
('snmp_backend',
Tuple(
orientation='horizontal',
title=_('SNMP backend'),
elements=[
ListChoice(
title=_('excepted SNMP backend'),
choices=[
('inline', 'Inline'),
('classic', 'Classic'),
('storedwalk', 'Stored walk')
],
allow_empty=False,
help=_('Select excepted SNMP backend. Default is "Inline/Classic".'),
default_value=['inline', 'classic'],
),
MonitoringState(
title=_('Monitoring state if backend not in excepted backends'),
default_value=1,
)
])),
('min_key_length',
Tuple(
orientation='horizontal',
title=_('Check key length'),
elements=[
Integer(
title=_('minimal key length'),
minvalue=1,
help=_('Minimal expected Community string/key length. Default is "10".'),
default_value=10,
),
MonitoringState(
title=_('Monitoring state if key length below minimal key length'),
help=_(
'Set the monitoring state when the length of the Community string (SNMP v1/2c) '
'or the authentication/encryption key (SNMP v3) is below min. length. Default is WARN'
),
default_value=1,
)
])),
('auth_enc_key_identical',
MonitoringState(
title=_('Monitoring state when authentication and encryption key are identical'),
help=_(
'Set the monitoring state when authentication key and encryption key are identical. '
'This setting is for SNMP v3 only. Default is WARN.'
),
default_value=1,
)),
('default_keys',
Tuple(
orientation='horizontal',
title=_('Check default key values'),
elements=[
ListOfStrings(
title=_('List of default keys'),
allow_empty=False,
help=_(
'List of default Community strings/keys to check against. Default is "public, private".'
),
default_value=['public', 'private'],
),
MonitoringState(
title=_('Monitoring state if key length below minimal key length'),
help=_(
'Set the monitoring state when the length of the Community string (SNMP v1/2c) '
'or the authentication/encryption key (SNMP v3) is below min. length. Default is WARN'
),
default_value=1,
)
])),
('key_complexity',
Tuple(
orientation='horizontal',
title=_('Key complexity'),
elements=[
ListChoice(
title=_('excepted characters in the key'),
choices=[
('(?=.*\\d)', 'Number'),
('(?=.*[a-z])', 'Lowercase'),
('(?=.*[A-Z])', 'Uppercase'),
('(?=.*\\W)', 'Special')
],
allow_empty=False,
help=_(
'Select expected character types in the Community string or authentication/encryption key.'
' Default is "Number, Lower case, Upper case, Special".'),
default_value=['(?=.*\\d)', '(?=.*[a-z])', '(?=.*[A-Z])', '(?=.*\\W)'],
),
MonitoringState(
title=_('Monitoring state if key complexity not met'),
default_value=1,
)
])),
])
rulespec_registry.register(
CheckParameterRulespecWithoutItem(
check_group_name='snmp_state',
group=RulespecGroupCheckParametersNetworking,
match_type='dict',
parameter_valuespec=_parameter_valuespec_snmp_state,
title=lambda: _('SNMP State'),
))
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