尝试检查文件的校验和是否已更改时,出现错误“没有名为 file.yaml 的服务”

问题描述

我正在使用 Monit 工具在服务器上进行监控。 我正在尝试检查文件的校验和是否已更改:

set daemon 10
set alert me.mylastname@coorp.com
set httpd port 2812 and use address localhost
 allow localhost
 allow admin:Monit

check file config.yaml with path /home/mydir/config.yaml
 if changed checksum then alert

运行“monit restart all”时出现错误 “没有名为 file.yaml 的服务”

知道我做错了什么吗?

解决方法

Monit 对不带引号的字符串有点挑剔。如果你需要一个带点或空格的支票名称,你需要引用它:

set daemon 10
set alert me.mylastname@coorp.com
set httpd port 2812 and use address localhost
 allow localhost
 allow admin:Monit

check file "config.yaml" with path /home/mydir/config.yaml
 if changed checksum then alert