![]() You can eventually test the syntax of the monit configuration first: $ monit -t This is done with the following line: $ monit reload When your Monit changes are done, you need to reload Monit. This is the most simple form of checks you can create in Monit - there is a lot of options, and you can - just to notice - also use it for other monitoring than services and processes. Start program = "/etc/init.d/nginx start" Start program = "/etc/init.d/mysql start"Ĭheck process nginx with pidfile /var/run/nginx/nginx.pid Start program = "/etc/init.d/redis start"Ĭheck process redis-server with pidfile /var/run/mysql/mysql.pid I opened the monit-configuration file (nf), and added the following ( $ vi /etc/nf), which will create checks for both Redis, MySQL and NGINX: # Check RedisĬheck process redis-server with pidfile /var/run/redis/redis.pid The Redis server had a few accidents, with too much memory load, where it unfortunately went down. I had setup an ElasticSearch/Logstash/Kibana central server for at customer, with Redis as a buffer, receiving data from the Logstash-agents. It is a ~500Kb program for UNIX/Linux, which checks up on defined services and processes every 2 minute. I discovered this program some time ago, with the question: "How to monitor a process, and keep it alive always, in the best possible way?". Monit is a simple and lightweight, and really useful tool. (For more on OpenShift’s arbitrary UIDs, read my other post about RunningĪnsible in OpenShift with arbitrary UIDs.Menu Monitor and keep services + proccesses alive with monit - lightweight, and great. We need to add those back in once the container starts and we’ve received User/group and made /etc/passwd and /etc/shadow writable during the build Monit daemon is started with the same user/group combination that owns the Monit has some strict security requirements for startup. The last three parts help us run with OpenShift’s strict security requirements. Make /etc/passwd and /etc/group writable by the root group (more on this later).Remove the monit user/group (more on this later).Download monit and install it to /usr/local/bin/monit.Install some basic packages that we need in the container.Let’s break down what’s here in the container build file: ENV HOME =/tmp COPY extras/start.sh /opt/start.sh RUN chmod +x /opt/start.sh CMD VOLUME # Start monit when the container starts. EXPOSE 2812 # Set up a volume for /config. RUN chmod g =u /etc/passwd /etc/group # The monit server listens on 2812. RUN sed -i '/^monit/d' /etc/passwd RUN sed -i '/^monit/d' /etc/group # Work around OpenShift's arbitrary UID/GIDs. RUN curl -Lso /tmp/monit.tgz RUN cd /tmp & tar xf monit.tgz RUN mv /tmp/monit-*/bin/monit /usr/local/bin/monit RUN rm -rf /tmp/monit* # Remove monit user/group. RUN dnf -y upgrade RUN dnf -y install coreutils httpie jq libnsl libxcrypt-compat RUN dnf clean all # Install monit. I’ve added those,Īlong with some requirements for the monit binary, to my container build file:įROM fedora:latest # Upgrade packages and install monit. In my case, some of the scripts I want to run require curl, httpie (forĬomplex HTTP/JSON requests), and jq (for parsing json). ![]() any packages needed for running monitoring scripts.a directory to hold lots of additional monitoring configs.Monit in a container #īefore we can put monit into a container, we need to think about what it Might not have a route or a NodePort configured, but you can monitor systems ![]() Monit inside OpenShift allows you to monitor services inside OpenShift that However, this post is all about how to deploy it inside OpenShift. Most Linux distributions have a package for monit and the package usuallyĬontains some basic configuration along with a systemd unit file to run the There’s only oneīinary daemon to run and it reads monitoring configuration from files in a Monit is a tried-and-true method for monitoring all kinds of systems, ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |