monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Add process during runtime without process is not running error


From: Martin Pala
Subject: Re: Add process during runtime without process is not running error
Date: Thu, 28 Jan 2016 09:49:03 +0100

There are two ways how to monitor a process by monit:

1.) using pidfile ... in your case you set it to "/var/run/api.pid", monit will try to read a pid from this file - if the pidfile doesn't exist or the given pid is not running, monit will try to restart the process using the given start/stop programs. When the process successfully started, it must create a given pidfile. If the process was running already, monit won't restart it. If you think the process is running, but monit reports it doesn't exist, check the content of the pidfile vs. "ps" output ... if the pidfile contains non-existent pid but the process is up, the pidfile content is wrong and you need to fix program's start method (or the process itself) to update the pidfile (or use the second approach described bellow).

2.) if the process has no pidfile, you can use a pattern based process check (no pidfile is needed) 


On 28 Jan 2016, at 09:41, Michael Wittig <address@hidden> wrote:

My check looks like this:

check process api with pidfile /var/run/api.pid
  start program = "/opt/api/server.sh start 8888"
  stop program = "/opt/api/server.sh stop"
  if failed port 8888 protocol http request "/ping" for 2 cycles then restart

Why do you mean by "please check that the pid from the file is running". So I should start the application first (put the pid into the file) and then lat monit take over? Is there a more elegant solution if there is no pid at all?


2016-01-28 9:33 GMT+01:00 Martin Pala <address@hidden>:
Hi,

the way you added the configuration is correct, the problem will be most probably in the "check process" configuration ... if you use a pidfile, please check that the pid from the file is running, if you use a pattern based check, test the pattern using "monit procmatch <pattern>"

Regards,
Martin


On 28 Jan 2016, at 08:47, Michael Wittig <address@hidden> wrote:

Hi

I want to add processes to monit (monit-5.2.5-3.11.amzn1.x86_64) during runtime. So far I include

include /etc/monit.d/*

all files from a certain directory. When I add a new process I place a file into /etc/monit.d/ and run

monit -c /etc/monit.conf reload

Th problem is that I get a process is not running error in my logs. Any idea how I can get rid of the error message?

I most likely will not be alerted on this. But I want to get alerts if my process dies after the first start?

Thanks
Michael
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

[Prev in Thread] Current Thread [Next in Thread]