、私のスクリプトから値を監視するために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レスポンスコードだけを出力する方が簡単です。 – Richlv