我monit
在 CentOS 6.5 上安装了工作。正在检测事件并发送警报邮件,但我试图通过该exec
功能在事件触发时发生其他事情,但这些都不起作用。
例如,我有如下规则:
if cpu usage (user) > 10% then
exec "/bin/echo 'user limit' >> /tmp/monit-status-log" as uid someuser and gid somegroup
该规则在 cpu 负载下适当地触发,但没有任何内容写入文件(其保护设置为 rw-rw-rw)。
我猜,执行的日志文件看起来是正确的:
[PST Feb 20 09:31:04] info : 'linux2.example.com' Monit reloaded
[PST Feb 20 09:31:31] info : Reinitializing monit daemon
[PST Feb 20 09:31:31] info : Awakened by the SIGHUP signal
[PST Feb 20 09:31:31] info : Reinitializing monit - Control file '/etc/monit.conf'
[PST Feb 20 09:31:31] info : Shutting down monit HTTP server
[PST Feb 20 09:31:32] info : monit HTTP server stopped
[PST Feb 20 09:31:32] info : Starting monit HTTP server at [*:2812]
[PST Feb 20 09:31:32] info : monit HTTP server started
[PST Feb 20 09:31:32] info : 'linux2.example.com' Monit reloaded
[PST Feb 20 09:32:32] error : 'linux2.example.com' cpu user usage of 24.4% matches resource limit [cpu user usage>10.0%]
[PST Feb 20 09:32:32] info : 'linux2.example.com' exec: /bin/echo
[PST Feb 20 09:33:32] info : 'linux2.example.com' 'linux2.example.com' cpu user usage check succeeded [current cpu user usage=0.0%]
有什么想法或建议吗?
我认为您应该
exec
像这样设置命令以使其按预期工作: