0

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 ?

Example:

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.

Massimo
  • 260
  • 3
  • 13

1 Answers1

0

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.

Corleone
  • 121
  • 6