If you’re going to have it automatically reload, you’ll want to make sure that 
the syntax is ok first. I don’t know what happens if you SIGHUP monit and it 
has an invalid config file.

 

From: monit-general <[email protected]> on behalf 
of Eric Montellese <[email protected]>
Reply-To: This is the general mailing list for monit <[email protected]>
Date: Friday, May 15, 2020 at 8:25 PM
To: <[email protected]>
Subject: Auto-reload of configuration files

 

Greetings Monit Community!

 

I'm working on a project that would like the ability to re-load the monit 
configuration automatically when it changes.

 

In the simplest case, this result can be produced with a monit rule that sends 
SIGHUP to the monit process whenever the main monit configuration file changes, 
for example:

 

check file monit_config with path /path/to/monitrc

     if changed checksum then exec "/usr/bin/killall -s SIGHUP monit"

 

1.  As a preliminary question -- can you see an issue with this pattern?

 

It does seem to be working as expected.  However, the intended design is to 
have the main monit configuration file call

 

include /path/to/monit.d/*

 

and to allow third parties to add or change files in this directory.

 

2.  Is there an existing way to check for changes (and additions and deletions) 
to any file within a directory (it does not appear to be baked in).  If not, is 
there a standard way that this has been accomplished by others?  I can see a 
number of possible solutions.  (A script to generate a checksum of all files, a 
separate application that uses inotify and sets a flag, etc)

 

3.  Would there be interest by the community in taking a patch that allows the 
option to automatically re-load the configuration files if they change.  
Somethilng like a "set autoreload" in the config file which would trigger monit 
to monitor it's own configuration?

 

4.  Would there be interest by the community in a patch that allows watching a 
given directory for any changes?

 

Best Regards,

Eric

Reply via email to