59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# pylint: disable=line-too-long
|
|
"""defines the form for typing in all needed HAL9002 parameters"""
|
|
|
|
from cmk.rulesets.v1 import Help, Title
|
|
from cmk.rulesets.v1.form_specs import (
|
|
DictElement,
|
|
Dictionary,
|
|
migrate_to_password,
|
|
Password,
|
|
String,
|
|
validators,
|
|
)
|
|
from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
|
|
|
|
|
|
def _form_spec_special_agent_hal9002() -> Dictionary:
|
|
return Dictionary(
|
|
title=Title("HAL 9002 Server Information"),
|
|
help_text=Help("Checking HAL servers via API"),
|
|
elements={
|
|
"hostname": DictElement(
|
|
required=True,
|
|
parameter_form=String(
|
|
title=Title("Hostname"),
|
|
help_text=Help(
|
|
"Hostname of HAL server (bare FQDN or IP), mandatory, eg. hal9002.yourdomain.tld"
|
|
),
|
|
custom_validate=(validators.LengthInRange(min_value=1),),
|
|
),
|
|
),
|
|
"username": DictElement(
|
|
required=True,
|
|
parameter_form=String(
|
|
title=Title("Username"),
|
|
help_text=Help("Username with administrative rights, mandatory"),
|
|
custom_validate=(validators.LengthInRange(min_value=1),),
|
|
),
|
|
),
|
|
"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,
|
|
),
|
|
),
|
|
},
|
|
)
|
|
|
|
|
|
rule_spec_hal9002 = SpecialAgent(
|
|
name="hal9002",
|
|
title=Title("HAL9002 connection parameters"),
|
|
topic=Topic.APPLICATIONS,
|
|
parameter_form=_form_spec_special_agent_hal9002,
|
|
)
|