How to combine RHEL systemd and monit?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to combine RHEL systemd and monit?

Sonderegger, Markus

Hi all

I am new to this mailing-list so bear with me if this question already came up even so I could not find an adequate answer in the archives so far.

 

I am responsible for managing applications like IBM MQ, IBM Integration Bus, Appia FIX Engine and many supporting and monitoring tools written in Perl and Bash.

We managed these applications using Veritas Cluster Server (VCS) on Solaris implementing the Start, Stop, Clean and Monitor Program.

 

Now we are forced to migrate to Linux and our Sys Admins want that we manage our applications using systemd using sudo commands as we do not have root access.

 

I then discovered monit which is a good replacement of the intelligent watchdog functionality VCS did deliver with additional functionality much appreciated.

I am very happy with the functionality of monit even if currently we can’t run it under root.

 

But I face an issue to smoothly bring down the applications when systemd controls monit.

Our SysAdmin has defined the following systemd entries:

 

ExecStart=/opt/monit/bin/monit -I -v
ExecStop=/opt/monit/bin/monit stop all
ExecStop=/bin/bash -c "while true; do if [ $(/opt/monit/bin/monit -B status | /bin/egrep '^\s*status' | /bin/egrep -c 'OK|Initializing') -eq 0 ] ; then break; else echo waiting; sleep 5; fi; done"
ExecStop=/opt/monit/bin/monit quit

 

but this does not work smoothly as systemd kills the processes before they are smoothly shut down.

 

Doing it manually with monit stop all works fine but not with systemd.

 

Is there a better way to bring down monit so that systemd waits until monit has brought down all my processes?

 

Many thanks for your help.

Regards

Markus

––––––––––––––––––––––––––––––

Dr. Markus Sonderegger

Executive Director

Head Application Integration

 

Bank Julius Baer & Co. Ltd.

Hohlstrasse 600, P.O. Box

8010 Zurich, Switzerland

T +41 58 88 77281

M +41 79 698 09 79

F +41 58 88 74851

www.juliusbaer.com

 



*****JuliusBaer Disclaimer***** This e-mail is for the intended recipient only and may contain confidential or privileged information. If you have received this e-mail by mistake, please contact us immediately and completely delete it (and any attachments) and do not forward it or inform any other person of its contents. If you send us messages by e-mail, we take this as your authorisation to correspond with you by e-mail, however, we reserve the right not to execute orders and instructions transmitted by e-mail at any time and without further explanation. If you do not wish to receive any further e-mail correspondence please let us know. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, amended, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Neither the Julius Baer Group nor the sender accept liability for any errors or omissions in the content of this message which arise as a result of its e-mail transmission. Please note that all e-mail communications to and from the Julius Baer Group may be monitored. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction.

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

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to combine RHEL systemd and monit?

Lutz Mader
Hello,
we use Monit to handle all the application servers (IBM Http Server, IBM
Liberty Profile and WildFly Application Server) and some other non Java
applications only.

Monit will be started/stopped by Systemd, but the applications are
started/stopped by Monit only. From my point of view this works well.

To start/stop Monit and the used user environment we use something like
this (dienste.service), Monit run in the user context:
[Unit]
SourcePath=/usr/local/bin/dienste
Before=multi-user.target graphical.target
[Service]
TasksMax=8000
Type=forking
Restart=no
TimeoutSec=10min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/usr/local/bin/dienste start
ExecStop=/usr/local/bin/dienste stop
[Install]
WantedBy=multi-user.target

We decided to use one monitor to handle applications only. This is more
easy to handle and limit the configuration complexity. Today Monit fits
well and handle applications in a more useful way than Systemd.

In a short word, we start and stop the system base via Systemd, but all
other applications are started by Monit. And we are able to use a
similar configuration for Linux and AIX systems.

A suggestion only,
Lutz

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