directory structure re-arranged
This commit is contained in:
122
traefik/rulesets/rs_traefik_http.py
Normal file
122
traefik/rulesets/rs_traefik_http.py
Normal 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(),
|
||||
)
|
||||
Reference in New Issue
Block a user