监控配置 |总计 cpu |语法错误 |

monit configuration | total cpu | syntax error |

Monit 的 official documentation 声明如下:

# Test CPU usage including user, system and wait. Note that 
# multi-core systems can generate 100% per core
# so total CPU usage can be more than 100%
if cpu usage > 200% for 4 cycles then alert

但上面给出的语法错误为:

/etc/monit/conf.d/test:61: Error: syntax error 'cpu'

有相同的指示吗?

看来你的monit版本低于5.14,因为这个功能是在这个版本中添加的:

Version 5.14.0

New: Simpler system-wide cpu usage test (total of user%, system%, wait%). Example:

if cpu usage > 99% then alert

此外,我提请您注意以下事实:从版本 5.16 开始,多核系统上的总 cpu 使用量计算为 0 到 100 之间的数字,因此您的 200% 值没有任何理由

You can now check a process' CPU usage in a more natural way as a percentage between 0-100 on a multi-core system. For instance, to check if a single-threaded application like node.js has gotten stuck on 100% CPU,