Initial commit
This commit is contained in:
32
local/share/check_mk/web/plugins/metrics/hal9001_metrics.py
Normal file
32
local/share/check_mk/web/plugins/metrics/hal9001_metrics.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
from cmk.gui.i18n import _
|
||||
from cmk.gui.plugins.metrics import (
|
||||
metric_info,
|
||||
graph_info,
|
||||
)
|
||||
|
||||
metric_info["hal_users_quota_used"] = {
|
||||
"title": _("HAL9001 User Quota Used"),
|
||||
"unit": "%",
|
||||
"color": "16/a",
|
||||
}
|
||||
|
||||
metric_info["hal_storages_download_rate"] = {
|
||||
"title": _("HAL9001 Storage Download Rate"),
|
||||
"unit": "bytes/s",
|
||||
"color": "26/a",
|
||||
}
|
||||
|
||||
metric_info["hal_storages_upload_rate"] = {
|
||||
"title": _("HAL9001 Storage Upload Rate"),
|
||||
"unit": "bytes/s",
|
||||
"color": "26/b",
|
||||
}
|
||||
|
||||
graph_info["hal_storages_rate_combined"] = {
|
||||
"title": _("HAL9001 Storage Upload/Download Rate"),
|
||||
"metrics": [
|
||||
("hal_storages_download_rate", "-area"),
|
||||
("hal_storages_upload_rate", "area"),
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
from cmk.gui.plugins.metrics import perfometer_info
|
||||
|
||||
perfometer_info.append({
|
||||
"type": "stacked",
|
||||
"perfometers": [
|
||||
{
|
||||
"type": "linear",
|
||||
"segments": ["hal_users_quota_used"],
|
||||
"total": 100.0,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
perfometer_info.append({
|
||||
"type": "stacked",
|
||||
"perfometers": [
|
||||
{
|
||||
"type": "linear",
|
||||
"segments": ["hal_storages_upload_rate"],
|
||||
#"half_value": 1024000,
|
||||
#"exponent": 3,
|
||||
},
|
||||
{
|
||||
"type": "linear",
|
||||
"segments": ["hal_storages_download_rate"],
|
||||
#"half_value": 1024000,
|
||||
#"exponent": 3,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
# both values will added (??)
|
||||
#perfometer_info.append({
|
||||
# "type": "stacked",
|
||||
# "perfometers": [
|
||||
# {
|
||||
# "type": "linear",
|
||||
# "segments": ["hal_storages_upload_rate", "hal_storages_download_rate"],
|
||||
# },
|
||||
# ],
|
||||
#})
|
||||
44
local/share/check_mk/web/plugins/wato/hal9001_params.py
Normal file
44
local/share/check_mk/web/plugins/wato/hal9001_params.py
Normal 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,
|
||||
)
|
||||
)
|
||||
@@ -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"),
|
||||
)
|
||||
)
|
||||
50
local/share/check_mk/web/plugins/wato/hal9001_users_rules.py
Normal file
50
local/share/check_mk/web/plugins/wato/hal9001_users_rules.py
Normal 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"),
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user