Initial commit

This commit is contained in:
2023-12-02 13:49:10 +01:00
commit a8c046e968
14 changed files with 784 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersOperatingSystem,
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
Checkbox,
TextAscii,
Password,
)
from cmk.gui.plugins.wato import (
HostRulespec,
)
from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourceProgramsCustom
#import cmk.gui.watolib as watolib
def _params_special_agent_hal9001():
return Dictionary(
title=_("Login parameters for HAL9001 systems"),
help = _("HAL9001: Dedicated to Arthur C. Clarke"),
elements=[
("username", TextAscii(title=_("Username"),
allow_empty=False,
help=_("Username with administrative rights, mandatory"))),
("password", Password(title=_("Password"),
allow_empty=False,
help=_("Specify password of this user"))),
],
optional_keys=[],
)
rulespec_registry.register(
HostRulespec(
#factory_default=watolib.Rulespec.FACTORY_DEFAULT_UNUSED,
group=RulespecGroupDatasourceProgramsCustom,
name="special_agents:hal9001",
valuespec=_params_special_agent_hal9001,
)
)

View File

@@ -0,0 +1,52 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
TextAscii,
Percentage,
Tuple,
Float,
Integer
)
def _item_spec_hal9001_storages():
return TextAscii(
title=_("HAL Storage ID")
)
def _parameter_spec_hal9001_storages():
return Dictionary(
elements=[
("levels_hal_storages_rates", Tuple(
title=_("hal9001 levels for storage up and download rate"),
elements=[
Float(
title=_("Warning above"),
default_value=200.0,
unit="MBytes/s",
),
Float(
title=_("Critical above"),
default_value=300.0,
unit="MBytes/s",
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name="hal9001_storages_storage_rates",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
item_spec=_item_spec_hal9001_storages,
parameter_valuespec=_parameter_spec_hal9001_storages,
title=lambda: _("Levels for HAL9001 storage upload/download"),
)
)

View File

@@ -0,0 +1,50 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
TextAscii,
Percentage,
Tuple,
Float,
Integer
)
def _item_spec_hal9001_users():
return TextAscii(
title=_("HAL User ID")
)
def _parameter_spec_hal9001_users():
return Dictionary(
elements=[
("levels_hal_users_quota_used", Tuple(
title=_("hal9001 levels for quota usage of users"),
elements=[
Percentage(
title=_("Warning at"),
default_value=65.0,
),
Percentage(
title=_("Critical at"),
default_value=85.0,
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name="hal9001_users_storage_levels",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
item_spec=_item_spec_hal9001_users,
parameter_valuespec=_parameter_spec_hal9001_users,
title=lambda: _("Levels for HAL9001 storage quota per user"),
)
)