'Monit - how to restart process on single core cpu use

I have 4 processes on a server, that use one core each. For some reason, these tend to enter some sort of loop and start using 100% of the core. I monitor the server with monit, but the service options are checking the overall CPU utilization, so they don't restart the service. The config looks like this:

check process rtpproxy1 with pidfile /run/rtpproxy1.pid
start program = "/bin/systemctl start rtpproxy1"
stop program = "/bin/systemctl stop rtpproxy1"
if cpu > 65% for 2 cycles then alert
if cpu > 90% for 5 cycles then restart
if 3 restarts within 4 cycles then unmonitor

Is there a way to have monit check the core utilization instead of the overall CPU?

Trying to estimate an overall usage does not really work (last time 2 of the 4 services were stuck, and the total CPU utilization was <30%, and the load was 2).

Thank you!



Solution 1:[1]

Short answer, Monit can not, the overall CPU utilization is used.

But you can use "check program" to use your script to evaluate something. You can use a monitor of your own.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lutzmad