Preamble
If you tried to control services manually on Linux servers then here is the solution for you. First of all you will need to install Monit on Linux.
We can set up Monit to check the Tomcat and MySQL processes. We have to configure for MySQL and Tomcat using Monit. We can also test the Monit and Java processes. We will see how to control MySQL.
It is very easy to configure Monit on Linux and you can find the log file in /var/log/monit. We discussed with you some examples of monitoring using ssh and MySQL services.
SSH configuration
We will create a file to monitor the ssh service using the Monit tool.
[root@andrex ~]# vim /etc/monit.d/ssh.conf
check process sshd with pidfile /var/run/sshd.pid
start program "/usr/sbin/sshd start"
stop program "/usr/sbin/sshd stop"
if failed host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
The above code will monitor the ssh services and restart the services on failure. It will try 5 times.
You can check the status if it works or is configured correctly using the command.
Process 'sshd'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
pid 7101
parent pid 1
uid 0
effective uid 0
gid 0
uptime 1h 54m
threads 1
children 3
cpu 0.0%
cpu total 0.0%
memory 0.0% [468 kB]
memory total 0.3% [2.8 MB]
security attribute system_u:system_r:sshd_t:s0-s0:c0.c1023
disk read 0 B/s [116.6 MB total]
port response time 34.733 ms to 127.0.0.1:22 type TCP/IP protocol SSH
data collected Tue, 05 May 2020 14:22:32
MySQL configuration
We can also control the MySQL server as well as with this tool. Create a file to monitor MySQL.
- Note:
You can change the location of the configuration file according to your server.
[root@andrex ~]# vim /etc/monit.d/mysql.conf
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
We can also check the configuration before rebooting the monitoring service.
[root@andrex ~]# monit -t # check the configuration before rebooting the service
[root@andrex ~]#get reload # reboot the configuration to make changes
You can check the PID location and run the program, it may be different on your computer.
Check the status by using the monitoring status
Process 'mysqld'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
pid 60708
parent pid 60504
uid 27
effective uid 27
gid 27
uptime 0m
threads 22
children 0
cpu 0.1%
cpu total 0.1%
memory 45.3% [440.2 MB]
memory total 45.3% [440.2 MB]
security attribute system_u:system_r:mysqld_t:s0
disk read 0 B/s [13.7 MB total]
disk write 0 B/s [64 kB total]
port response time 0.924 ms to 127.0.0.1:3306 type TCP/IP protocol DEFAULT
data collected Tue, 05 May 2020 14:22:32
Now we have configured SSH and MySQL services to monitor and automatically restart on failure.
Test configuration
We will stop the MySQL service manually to check if it works or not.
As soon as it is done. You check the status by using the monitoring status
Process 'mysqld'
status Initializing
monitoring status Initializing
monitoring mode active
on reboot start
data collected Tue, 05 May 2020 14:39:08
You will see that it will be in the process of initialization for a few seconds and then you will check the state of MySQL service.
The service will be restarted automatically.
Process 'mysqld'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
pid 61687
parent pid 61482
uid 27
effective uid 27
gid 27
uptime 0m
threads 22
children 0
cpu 0.1%
cpu total 0.1%
memory 45.3% [440.2 MB]
memory total 45.3% [440.2 MB]
security attribute system_u:system_r:mysqld_t:s0
disk write 0 B/s [60 kB total]
port response time 0.566 ms to 127.0.0.1:3306 type TCP/IP protocol DEFAULT
data collected Tue, 05 May 2020 14:40:11
If you have set up access with GUI for Monit monitoring panel. You can also check the status there.

About Enteros
Enteros helps associations of each size with making their cloud data stockrooms work for any usage case and our experts are skilled in the fluctuating nuances of the different data circulation focus courses of action.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
Cost Attribution for Marketing Platforms: How Enteros AI SQL and AIOps Deliver Data Intelligence
- 18 March 2026
- Database Performance Management
Introduction The marketing sector has evolved into one of the most data-intensive domains in modern business. From digital advertising and customer segmentation to real-time personalization and omnichannel campaigns, marketing platforms today rely on complex technology ecosystems powered by massive volumes of data. Every click, impression, conversion, and interaction generates data that must be processed, analyzed, … Continue reading “Cost Attribution for Marketing Platforms: How Enteros AI SQL and AIOps Deliver Data Intelligence”
How Media Platforms Optimize Growth Management with Enteros Performance Management and Cost Attribution
Introduction The media industry has undergone a massive transformation in the past decade. From traditional broadcasting to digital-first ecosystems, media platforms now operate in a world driven by streaming services, real-time content delivery, personalized recommendations, and global audience engagement. Whether it’s video streaming, music platforms, online publishing, or digital advertising networks, modern media organizations rely … Continue reading “How Media Platforms Optimize Growth Management with Enteros Performance Management and Cost Attribution”
Driving Telecom Efficiency with Enteros Database Software, AIOps Platform, and Cost Estimation Intelligence
- 17 March 2026
- Database Performance Management
Introduction The telecommunications industry is at the center of global digital transformation. From enabling 5G connectivity and IoT ecosystems to supporting streaming platforms, cloud applications, and enterprise communications, telecom operators are responsible for managing vast, complex, and high-performance digital infrastructures. Behind every call, message, and data transaction lies a sophisticated network of databases, applications, and … Continue reading “Driving Telecom Efficiency with Enteros Database Software, AIOps Platform, and Cost Estimation Intelligence”
Modernizing Fashion Technology with Enteros Database Management, AIOps Platform, and Cloud FinOps
Introduction The fashion industry is no longer just about creativity, design, and seasonal trends—it is now deeply rooted in data, digital platforms, and technology-driven operations. From global e-commerce platforms and mobile shopping apps to supply chain systems, inventory management tools, and customer engagement platforms, fashion enterprises rely heavily on modern IT ecosystems to drive growth … Continue reading “Modernizing Fashion Technology with Enteros Database Management, AIOps Platform, and Cloud FinOps”