Monit

監視 HTTP 狀態程式碼給出語法錯誤

  • October 7, 2016

我的系統正在執行 monit 5.19。當我啟動 Monit 時,我看到了錯誤syntax error 'status'

自 5.8 以來似乎支持狀態,所以我不確定問題是什麼。

它是由以下指令引起的。

check host nlb  with address   host
if failed
 port 443
 protocol HTTPS
 request "/healthcheck"
 ssl options {verify: disable}
 timeout 15 seconds
 status = 200
then restart

status子句是proto http語句的一部分,因此需要位於該ssl行之前(不是的一部分proto http)。請參閱https://mmonit.com/monit/documentation/monit.html#HTTPproto http的定義

PROTO(COL) HTTP
    [USERNAME "string"]
    [PASSWORD "string"]
    [REQUEST "string"]
    [STATUS operator number]
    [CHECKSUM checksum]
    [HTTP HEADERS list of headers]
    [CONTENT < "=" | "!=" > STRING]

不給出錯誤的文件版本是

check host nlb  with address   host
if failed
 port 443
 protocol HTTPS
 request "/healthcheck"
 status = 200
 ssl options {verify: disable}
 timeout 15 seconds
then restart

引用自:https://serverfault.com/questions/807701