On our linux servers we have this basic check:

check system localhost
    every "* 08-18 * * 1-5"
    if loadavg (1min) > 4 then alert
    if loadavg (5min) > 2 then alert
    if memory usage > 75% then alert
    if swap usage > 25% then alert
    if cpu usage (user) > 70% then alert
    if cpu usage (system) > 30% then alert
    if cpu usage (wait) > 20% then alert

On 3 servers we have postgresql. Is it possible to configure monit so:

  • when the basic test alerts, execute a specific program ?


check process system_busy
    depends on system
    exec "/usr/bin/psql -U postgres -c \"SELECT * FROM pg_stat_activity;\" > /var/log/postgres_busy.log"

We want another check, to not modify the localhost one.


the much better and less complicated way around this would be to invoke a bash/python script based on the required monit check which has the necessary attributes to dump the postgres activity wherever required.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.