【发布时间】:2016-09-05 16:52:08
【问题描述】:
我试图配置 zabbix 来监控我脚本中的值,
但是zabbix返回错误:
Received value [200true] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]
脚本:
status=$(curl -I https://example.com/health_check.jsp 2> /dev/null | head -n 1 | cut -d ' ' -f 2);
if [ $status = "200" ]; then
exit 0
else
echo 1
fi
Zabbix 配置:
key - system.run[/zabbix_scripts/myscript.sh]
key type of information - numeric (unsigned)
key data type - decimal
trigger - {sso:system.run[/zabbix_scripts/myscript.sh].last()}=1
我以前做过,但不知何故这个脚本不适用于 zabbix。
请帮忙, 谢谢!
【问题讨论】:
-
这会在有问题的系统上返回什么?
curl -I https://example.com/health_check.jsp 2> /dev/null | head -n 1- 另外,你正在混合echo和exit。虽然您可能指的是echo,但在这种情况下,只输出 HTTP 响应代码会更简单。