Search code examples
linuxmonit

monit configuration | total cpu | syntax error |


Monit's official documentation states following:

# 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

But the above gives syntax error as:

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

Any pointers on same?


Solution

  • It seems you have version of monit lower than 5.14, because this feature was added in this version:

    Version 5.14.0

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

    if cpu usage > 99% then alert

    Also, I draw your attention to the fact that from Version 5.16 total cpu usage on multi-core systems calculates as a number from 0 to 100, so your 200% value has no reason

    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,