Could you use the "check program" functionality? Have monit run a script which reads the monit control file and in a deterministic manner follows includes and generates a checksum. If the final checksum differs from the previous cycle, run "monit -t" and conditionally send SIGHUP? This seems like it would be more of a self-contained solution in the sense that it wouldn't require wrapping monit's initialization or external daemons, and wouldn't be dependent on inotify.
On May 16, 2020 1:07 PM, Eric Montellese <[email protected]> wrote:
Thanks for the input -Yes, we're looking to automatically reload monit's configuration if a monit configuration file changes. The idea being that various (pre-tested) applications with their own monit configurations can be added and removed automatically.One option that we've tested is to have a separate process (or wrapper) that runs inotify on the configuration files, and sends SIGHUP to monit if a change is detected. This works, but it seems a shame to add a separate monitor for monit.Best Regards,EricOn Sat, May 16, 2020 at 3:10 PM Lutz Mader <[email protected]> wrote:Hello Eric,
are you interresting in doing an config reload only.
> I'm working on a project that would like the ability to re-load the monit
> configuration automatically when it changes.
I do monitoring some application server folder to find new application
to be configured to monit and add the additional configuration based on
a template.
After I create a new config file based on the template I use the syntax
check to check the new config file. If the check will be passed, the new
config will be loaded by reinitializing monit.
This is my way, but I never monitor the monit config folder to find
changes and do an automatic reload.
With regards,
Lutz
