monit does not start a service as desired

Issue #847 new
Former user created an issue

Hi, I have a monit configuration which is supposed to start elasticsearch if there is no process matching a specific regex.

check process devels941dat9 matching "/usr/bin/java" every 2 cycles
    onreboot nostart
    start program = "/sbin/service elasticsearch start"
    stop program = "/sbin/service  elasticsearch stop"

After restarting / reloading monit, nothing seems to happen even after 10 minutes. The check_interval is 180 seconds. Elasticsearch service is not started by monit. There is no existing process running except for stale pid. Snippet from log

sudo tail -f /var/log/monit
[UTC Sep 18 02:55:05] info     : Monit daemon with pid [11916] stopped
[UTC Sep 18 02:55:05] info     : 'devels941dat9.int.coupadev.com' Monit 5.25.1 stopped
[UTC Sep 18 02:55:16] info     : Starting Monit 5.25.1 daemon
[UTC Sep 18 02:55:16] info     : 'devels941dat9.int.coupadev.com' Monit 5.25.1 started
[UTC Sep 18 02:55:16] error    : 'collectd' process is not running
[UTC Sep 18 02:55:16] info     : 'collectd' trying to restart
[UTC Sep 18 02:55:16] info     : 'collectd' start: '/etc/init.d/collectd start'
[UTC Sep 18 02:58:16] error    : 'collectd' process is not running
[UTC Sep 18 02:58:16] info     : 'collectd' trying to restart
[UTC Sep 18 02:58:16] info     : 'collectd' start: '/etc/init.d/collectd start'
[UTC Sep 18 03:01:17] error    : 'collectd' process is not running
[UTC Sep 18 03:01:17] info     : 'collectd' trying to restart
[UTC Sep 18 03:01:17] info     : 'collectd' start: '/etc/init.d/collectd start'
[UTC Sep 18 03:04:17] error    : 'collectd' process is not running
[UTC Sep 18 03:04:17] info     : 'collectd' trying to restart
[UTC Sep 18 03:04:17] info     : 'collectd' start: '/etc/init.d/collectd start'

I even tried this with the earlier setting if checking PID but it exhibits the same behaviour

Assistance appreciated

--Syd

Comments (1)

  1. Lutz Mader

    Hello,
    have you try a check process with “onreboot start” or “onreboot laststate”. A check with "onreboot nostart" does not start a process after a reboot (or monit restart), nothing will happen, the status will forwarded only.
    Wit regards,
    Lutz

  2. Log in to comment