If the processes have PID files, then no additional file is necessary and it could be sufficient just to touch/update the timestamp of that pidfile + monitor it with 'check file' for example like this:
check file myproc1_heartbeat with path /var/run/myproc1.pid
if timestamp > 5 minutes then alert
If you want to use common status file, you can use something like this:
check file myproc_heartbeat with path /var/log/myproc.status
if not match "hello" for 3 cycles then alert
I think the timestamp based solution could be simpler ... note that Monit >= 5.2 is recommended with it, as previous monit versions used the pidfile timestamp to determine the process uptime - newer monit versions use get the real uptime from process table directly.
On Apr 6, 2011, at 11:28 PM, Ortiz, Nelson wrote:
Thanks, this is very useful information. The heartbeat the monitored process provides to the monitor could be anything. I was thinking it should just provide its PID. What would you recommend? Suppose I wanted to monitor 10 processes by having them write their PIDs periodically to a common file (or separate files, one for each monitored process, what do you think?). Each write to the file would trigger a timestamp change, so as you have stated, if periodic timestamps are missing I could alert on that. Thanks for thinking, Martin! Very Respectfully, Nelson J. Ortiz *----------------------------* From: address@hidden [mailto:address@hidden On Behalf Of Martin Pala
Sent: Tuesday, April 05, 2011 4:39 PM
To: This is the general mailing list for monit
Subject: Re: Can MONIT be configured to work as a heartbeat monitor?
what kind of heartbeat the process sends? Monit allows to check the files for content and timestamp changes, so if the process writes periodically to the file, you can get alert when it stops.
On Apr 5, 2011, at 5:10 PM, Ortiz, Nelson wrote:
I know that MONIT is able to monitor CPU utilization and so forth, but if a process sends it a periodic heartbeat signal, is MONIT able to differentiate a heartbeat signal from a process and alert on missing or abnormal heartbeat? Very Respectfully, Nelson J. Ortiz *----------------------------*