directory structure re-arranged

This commit is contained in:
2026-03-06 12:34:05 +00:00
parent 51c5c3447d
commit 5be0232a23
21 changed files with 1577 additions and 3 deletions

View File

@@ -0,0 +1,122 @@
#!/user/bin/env python3
"""HTTP components parameter form for Traefik"""
from cmk.rulesets.v1 import Title, Help
from cmk.rulesets.v1.form_specs import (
DictElement,
Dictionary,
SimpleLevels,
DefaultValue,
Integer,
LevelDirection,
Float,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, Topic, HostCondition
# function name should begin with an underscore to limit it's visibility
def _parameter_form():
return Dictionary(
elements={
"levels_traefik_min_http_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of HTTP routers"),
help_text=Help(
"Define the levels for the minimum number of HTTP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(10, 5)),
),
required=True,
),
"levels_traefik_max_http_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of HTTP routers"),
help_text=Help(
"Define the levels for the maximum number of HTTP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(75, 100)),
),
required=True,
),
"levels_traefik_min_http_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of HTTP services"),
help_text=Help(
"Define the levels for the minimum number of HTTP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(10, 5)),
),
required=True,
),
"levels_traefik_max_http_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of HTTP services"),
help_text=Help(
"Define the levels for the maximum number of HTTP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(75, 100)),
),
required=True,
),
"levels_traefik_min_http_middlewares": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of HTTP middlewares"),
help_text=Help(
"Define the levels for the minimum number of HTTP middlewares"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(5, 2)),
),
required=True,
),
"levels_traefik_max_http_middlewares": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of HTTP middlewares"),
help_text=Help(
"Define the levels for the maximum number of HTTP middlewares"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(20, 50)),
),
required=True,
),
"levels_traefik_http_components_not_ok": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for percentage of not OK HTTP components"),
help_text=Help(
"Define the levels for the maximum number of HTTP components in not OK state"
),
form_spec_template=Float(unit_symbol="%"),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(0.5, 1.0)),
),
required=True,
),
}
)
# name must begin with "rule_spec_", should refer to the used check plugin
# must be an instance of "CheckParameters"
rule_spec_traefik_http_components = CheckParameters(
# "name" should be the same as the check plugin
name="traefik_http_components",
# the title is shown in the GUI
title=Title("Traefik HTTP components parameters"),
# this ruleset can be found under Setup|Service monitoring rules|Applications...
topic=Topic.APPLICATIONS,
# define the name of the function which creates the GUI elements
parameter_form=_parameter_form,
condition=HostCondition(),
)

View File

@@ -0,0 +1,49 @@
#!/user/bin/env python3
"""general parameter form for Traefik"""
from cmk.rulesets.v1 import Title, Help
from cmk.rulesets.v1.form_specs import (
DictElement,
Dictionary,
SimpleLevels,
DefaultValue,
Float,
LevelDirection,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, Topic, HostCondition
# function name should begin with an underscore to limit it's visibility
def _parameter_form():
return Dictionary(
elements={
"levels_traefik_agent_execution_time": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for agent execution time"),
help_text=Help(
"Define the levels for the maximum agent execution time"
),
form_spec_template=Float(unit_symbol="ms"),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(500.0, 750.0)),
),
required=True,
),
}
)
# name must begin with "rule_spec_", should refer to the used check plugin
# must be an instance of "CheckParameters"
rule_spec_traefik_info = CheckParameters(
# "name" should be the same as the check plugin
name="traefik_info",
# the title is shown in the GUI
title=Title("Traefik general parameters"),
# this ruleset can be found under Setup|Service monitoring rules|Applications...
topic=Topic.APPLICATIONS,
# define the name of the function which creates the GUI elements
parameter_form=_parameter_form,
condition=HostCondition(),
)

View File

@@ -0,0 +1,144 @@
#!/usr/bin/env python3
# pylint: disable=line-too-long
"""defines the form for typing in all needed Traefik parameters"""
from cmk.rulesets.v1 import Help, Title, Label
from cmk.rulesets.v1.form_specs import (
DictElement,
Dictionary,
String,
validators,
BooleanChoice,
Integer,
Password,
migrate_to_password,
InputHint,
DefaultValue,
SingleChoice,
SingleChoiceElement,
)
from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
def _form_spec_special_agent_traefik() -> Dictionary:
return Dictionary(
title=Title("Traefik Server Information"),
help_text=Help("Checking Traefik systems via API"),
elements={
"hostname": DictElement(
required=True,
parameter_form=String(
title=Title("Hostname"),
help_text=Help(
"Hostname of Traefik server (bare FQDN or IP), mandatory, eg. traefik.yourdomain.tld"
),
custom_validate=(validators.LengthInRange(min_value=1),),
prefill=InputHint("traefik.yourdomain.tld"),
),
),
"username": DictElement(
required=True,
parameter_form=String(
title=Title("Username"),
help_text=Help("Username for authentification, mandatory"),
custom_validate=(validators.LengthInRange(min_value=1),),
prefill=InputHint("traefikadmin"),
),
),
"password": DictElement(
required=True,
parameter_form=Password(
title=Title("Password"),
help_text=Help("Specify password, mandatory"),
custom_validate=(validators.LengthInRange(min_value=1),),
migrate=migrate_to_password,
),
),
"auth_type": DictElement(
required=True,
parameter_form=SingleChoice(
title=Title("Authentification type"),
help_text=Help("Type of authentification to use"),
elements=[
SingleChoiceElement(
name="basic",
title=Title("Basic"),
),
SingleChoiceElement(
name="digest",
title=Title("Digest"),
),
],
),
),
"no_http_check": DictElement(
required=False,
parameter_form=BooleanChoice(
title=Title("Disable HTTP components"),
help_text=Help(
"Activate to disable check of HTTP components, optional"
),
label=Label("Disable HTTP components"),
),
),
"no_tcp_check": DictElement(
required=False,
parameter_form=BooleanChoice(
title=Title("Disable TCP components"),
help_text=Help(
"Activate to disable check of TCP components, optional"
),
label=Label("Disable TCP components"),
),
),
"no_udp_check": DictElement(
required=False,
parameter_form=BooleanChoice(
title=Title("Disable UDP components"),
help_text=Help(
"Activate to disable check of UDP components, optional"
),
label=Label("Disable UDP components"),
),
),
"no_https": DictElement(
required=False,
parameter_form=BooleanChoice(
title=Title("Disable HTTPS"),
help_text=Help(
"Activate to disable encryption (not recommended), optional"
),
label=Label("Disable HTTPS"),
),
),
"no_cert_check": DictElement(
required=False,
parameter_form=BooleanChoice(
title=Title("Disable certificate validation"),
help_text=Help(
"Activate to disable certificate validation (not recommended), optional"
),
label=Label("Disable certificate validation"),
),
),
"port": DictElement(
required=False,
parameter_form=Integer(
title=Title("Port"),
help_text=Help(
"Specify port the Traefik system ist listening on (if not 80/443), optional"
),
prefill=DefaultValue(443),
custom_validate=(validators.NetworkPort(),),
),
),
},
)
rule_spec_traefik = SpecialAgent(
name="traefik",
title=Title("Traefik connection parameters"),
topic=Topic.APPLICATIONS,
parameter_form=_form_spec_special_agent_traefik,
)

View File

@@ -0,0 +1,122 @@
#!/user/bin/env python3
"""HTTP components parameter form for Traefik"""
from cmk.rulesets.v1 import Title, Help
from cmk.rulesets.v1.form_specs import (
DictElement,
Dictionary,
SimpleLevels,
DefaultValue,
Integer,
LevelDirection,
Float,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, Topic, HostCondition
# function name should begin with an underscore to limit it's visibility
def _parameter_form():
return Dictionary(
elements={
"levels_traefik_min_tcp_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of TCP routers"),
help_text=Help(
"Define the levels for the minimum number of TCP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(0, 0)),
),
required=True,
),
"levels_traefik_max_tcp_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of TCP routers"),
help_text=Help(
"Define the levels for the maximum number of TCP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(25, 50)),
),
required=True,
),
"levels_traefik_min_tcp_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of TCP services"),
help_text=Help(
"Define the levels for the minimum number of TCP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(0, 0)),
),
required=True,
),
"levels_traefik_max_tcp_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of TCP services"),
help_text=Help(
"Define the levels for the maximum number of TCP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(25, 50)),
),
required=True,
),
"levels_traefik_min_tcp_middlewares": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of TCP middlewares"),
help_text=Help(
"Define the levels for the minimum number of TCP middlewares"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(0, 0)),
),
required=True,
),
"levels_traefik_max_tcp_middlewares": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of TCP middlewares"),
help_text=Help(
"Define the levels for the maximum number of TCP middlewares"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(25, 50)),
),
required=True,
),
"levels_traefik_tcp_components_not_ok": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for percentage of not OK TCP components"),
help_text=Help(
"Define the levels for the maximum number of TCP components in not OK state"
),
form_spec_template=Float(unit_symbol="%"),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(0.5, 1.0)),
),
required=True,
),
}
)
# name must begin with "rule_spec_", should refer to the used check plugin
# must be an instance of "CheckParameters"
rule_spec_traefik_tcp_components = CheckParameters(
# "name" should be the same as the check plugin
name="traefik_tcp_components",
# the title is shown in the GUI
title=Title("Traefik TCP components parameters"),
# this ruleset can be found under Setup|Service monitoring rules|Applications...
topic=Topic.APPLICATIONS,
# define the name of the function which creates the GUI elements
parameter_form=_parameter_form,
condition=HostCondition(),
)

View File

@@ -0,0 +1,98 @@
#!/user/bin/env python3
"""UDP components parameter form for Traefik"""
from cmk.rulesets.v1 import Title, Help
from cmk.rulesets.v1.form_specs import (
DictElement,
Dictionary,
SimpleLevels,
DefaultValue,
Integer,
LevelDirection,
Float,
)
from cmk.rulesets.v1.rule_specs import CheckParameters, Topic, HostCondition
# function name should begin with an underscore to limit it's visibility
def _parameter_form():
return Dictionary(
elements={
"levels_traefik_min_udp_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of UDP routers"),
help_text=Help(
"Define the levels for the minimum number of UDP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(0, 0)),
),
required=True,
),
"levels_traefik_max_udp_routers": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of UDP routers"),
help_text=Help(
"Define the levels for the maximum number of UDP routers"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(25, 50)),
),
required=True,
),
"levels_traefik_min_udp_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for minimum number of UDP services"),
help_text=Help(
"Define the levels for the minimum number of UDP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.LOWER,
prefill_fixed_levels=DefaultValue(value=(0, 0)),
),
required=True,
),
"levels_traefik_max_udp_services": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for maximum number of UDP services"),
help_text=Help(
"Define the levels for the maximum number of UDP services"
),
form_spec_template=Integer(unit_symbol=""),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(25, 50)),
),
required=True,
),
"levels_traefik_udp_components_not_ok": DictElement(
parameter_form=SimpleLevels(
title=Title("Levels for percentage of not OK UDP components"),
help_text=Help(
"Define the levels for the maximum number of UDP components in not OK state"
),
form_spec_template=Float(unit_symbol="%"),
level_direction=LevelDirection.UPPER,
prefill_fixed_levels=DefaultValue(value=(0.5, 1.0)),
),
required=True,
),
}
)
# name must begin with "rule_spec_", should refer to the used check plugin
# must be an instance of "CheckParameters"
rule_spec_traefik_udp_components = CheckParameters(
# "name" should be the same as the check plugin
name="traefik_udp_components",
# the title is shown in the GUI
title=Title("Traefik UDP components parameters"),
# this ruleset can be found under Setup|Service monitoring rules|Applications...
topic=Topic.APPLICATIONS,
# define the name of the function which creates the GUI elements
parameter_form=_parameter_form,
condition=HostCondition(),
)