monit-general
[Top][All Lists]
Advanced

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

Re: monitoring the number of processes


From: Szépe Viktor
Subject: Re: monitoring the number of processes
Date: Fri, 12 Aug 2016 19:57:12 +0200
User-agent: K-9 Mail for Android

"processname" is not necessary.


--
+36204242498
Ezen a készüléken sok az elütés.
Elnézést!

On August 12, 2016 6:59:56 PM CEST, "Stephen Berg (Contractor)" <address@hidden> wrote:
I wrote up a script (/usr/local/sbin/processname) that generates a "0" 
return code if there is one process running, otherwise it returns "1".
So if the daemon is not running or has more than 1 process I should get
a 0. That's good so either state of not running and running more than
one instance should generate a restart.

In /etc/monit.d/processname I have:

check program processname with path "/usr/local/sbin/processname"
if status != 0 then
start program = "/usr/sbin/service processname start"
stop program = "/usr/sbin/service processname stop"
restart

When I test using "monit -t" I get:

/etc/monit.d/processname:3: syntax error '/usr/sbin/service'

This is the first time I've tried to do any custom setup in monit so I'm
betting I'm just not getting the right syntax is just the right spot.

On 08/12/2016 11:14 AM, SZÉPE Viktor wrote:
You may also use `pgrep`

Be aware that there is no shell execution in `program with path` you
have to put your script in a file.


Idézem/Quoting Tino Hendricks <address@hidden>:

I would go for a simple script containing something like

ps aux | grep the_process_name | grep -v grep | wc -l

and check for the number.

Tino

Am 12.08.2016 um 14:12 schrieb Stephen Berg (Contractor)
<address@hidden>:

Is there a way to monitor a daemon that is supposed to have exactly
one process showing. If the count is above one the daemon needs to
be restarted.


--
Stephen Berg
Systems Administrator
NRL Code: 7320
Office: 228-688-5738
address@hidden


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


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



SZÉPE Viktor


reply via email to

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