我正在研究一个check_mk插件,并且当它运行一次检查时,似乎无法将WATO指定的params传递给check函数...
运行factory_settings["elasticsearch_status_default"] = {
"min": (600, 300)
}
def inventory_elasticsearch_status(info):
for line in info:
yield restore_whitespace(line[0]), {}
def check_elasticsearch_status(item, params, info):
for line in info:
name = restore_whitespace(line[0])
message = restore_whitespace(line[2])
if name == item:
return get_status_state(params["min"], name, line[1], message, line[3])
check_info['elasticsearch_status'] = {
"inventory_function" : inventory_elasticsearch_status,
"check_function" : check_elasticsearch_status,
"service_description" : "ElasticSearch Status %s",
"default_levels_variable" : "elasticsearch_status_default",
"group" : "elasticsearch_status",
"has_perfdata" : False
}
会将检查显示为始终具有默认值。
我已经盯着它看了一段时间,但我没有想法。
Check_MK版本:1.2.8p21 Raw
批量检查文件:
group = "checkparams"
#subgroup_applications = _("Applications, Processes & Services")
register_check_parameters(
subgroup_applications,
"elasticsearch_status",
_("Elastic Search Status"),
Dictionary(
elements = [
( "min",
Tuple(
title = _("Minimum required status age"),
elements = [
Age(title = _("Warning if below"), default_value = 600),
Age(title = _("Critical if below"), default_value = 300),
]
))
]
),
None,
match_type = "dict",
)
Wato文件:
checkgroup_parameters.setdefault('elasticsearch_status', [])
checkgroup_parameters['elasticsearch_status'] = [
( {'min': (3600, 1800)}, [], ALL_HOSTS ),
] + checkgroup_parameters['elasticsearch_status']
从WATO规则中输入rules.mk:
import inspect
inspect.getclosurevars(f)
# returns:
ClosureVars(nonlocals={'a': 2, 'n': 3}, globals={}, builtins={'print': <built-in function print>}, unbound=set())
如果有任何其他信息有用,请告诉我们!
编辑:请帮助
答案 0 :(得分:0)
也发布了问题documentation,这个谜团得到了解决。
我将WATO规则与项None
(WATO文件中的第5个位置arg)匹配,但由于此检查在其下有多个项目(其中没有一个具有标识TextAscii( title = _("Status Description"), allow_empty = True),
)规则适用于主机,但不适用于任何特定的服务检查。
修复是用以下内容替换该参数:
componentWillMount(){
var data = peopleContract.getPeople()
this.setState({
firstNames: String(data[0]).split(','),
lastNames: String(data[1]).split(','),
ages: String(data[2]).split(',')
})
}
render() {
var TableRows = []
_.each(this.state.firstNames, (value, index) => {
TableRows.push(
<tr>
<td>{ETHEREUM_CLIENT.toAscii(this.state.firstNames[index])}</td>
<td>{ETHEREUM_CLIENT.toAscii(this.state.lastNames[index])}</td>
<td>{ETHEREUM_CLIENT.toAscii(this.state.ages[index])}</td>
</tr>
)
})