Bug 602603 - RFE: Monitor a "service" process only if it was already started
RFE: Monitor a "service" process only if it was already started
Status: CLOSED CANTFIX
Product: Fedora EPEL
Classification: Fedora
Component: monit (Show other bugs)
el5
All Linux
low Severity medium
: ---
: ---
Assigned To: Stewart Adam
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-10 05:49 EDT by Toralf
Modified: 2010-06-21 15:05 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-06-21 15:05:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Toralf 2010-06-10 05:49:01 EDT
Description of problem:
I'm trying to use "monit" to restart certain processes that are otherwise started via "rc" and /etc/init.d, on the event that they exit unexpectedly. The basic setup for this is simple and well-documented; you just add a monit config entry like:

check process someservice with pidfile /var/run/someservice.pid
  start program = "/etc/init.d/someservice start"

However, what concerns me a bit is that this essentially bypasses the entire "init" system, and "chkconfig", "service" etc; if I disable the service using

chkconfig someservice off

or try to force it to stop temporarily via

service someservice stop

will still try to (re)start it, meaning that the above will have little or no effect.

I'd really like to have some simple and direct way to say "restart this process if it goes away, but only if it was enabled in the first place". 

One way of achieving this might be to (optionally) change the rules for the process test from:

If the pidfile does not exist or does not contain the pid number of a
running process, monit will call the entry's start method if defined.

to

If the pidfile does not exist, monit will do nothing. If the pid file exists, but does not contain the pid number of a running process, monit will call the entry's start method if defined.


Version-Release number of selected component (if applicable):
4.10.1

How reproducible:
Enough said, I think
Comment 1 Toralf 2010-06-10 08:43:48 EDT
I also hoped that the following might be used as a workaround:

check process someservice with pidfile /var/run/someservice.pid
  start program = "/etc/init.d/someservice start"
  depends servicepid

check file servicepid /var/run/someservice.pid
  mode passive

The idea being that "someservice" would not be started if it depended on a service that was missing, and couldn't be started. But apparently, the "depends" statement does not work that way - a failure in a prerequisite for a service does not prevent the service itself form being tested or restarted. So I guess you might say that "depends" doesn't set up true dependencies...
Comment 2 Toralf 2010-06-10 08:47:06 EDT
(In reply to comment #1)
> check process someservice with pidfile /var/run/someservice.pid
>   start program = "/etc/init.d/someservice start"
>   depends servicepid
> 
> check file servicepid /var/run/someservice.pid
Whoops. Make that

"check file servicepid with path /var/run/someservice.pid"

>   mode passive
Comment 3 Stewart Adam 2010-06-21 15:05:46 EDT
Sorry, but I can't really help with this - please contact upstream about the RFE.

However, it may be helpful to know that chkconfig creates symlinks in /etc/rc.d/rcX.d for each service you enable. Perhaps chaining a CHECK FILE will help?

Note You need to log in before you can comment on or make changes to this bug.