Article directory
Monit monitoringsoftwareFailed to start monitoring at startup.
Monit starts the monitoring process and disappears, prompting monit.service faisuffered.
OnCWP Control Panel (CWP7) to install Monit monitoringAfter the software is installed, the monitoring process of Monit startup disappears, and a prompt appears: monit.service failed.
It is worth noting that an attempt has been made to enablesystemctl enable monit
[root@stage-web-1 vagrant]# systemctl status monit
monit.service - Pro-active monitoring utility for unix systems
Loaded: loaded (/usr/lib/systemd/system/monit.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2017-06-01 16:37:00 UTC; 6min ago
Process: 1131 ExecStop=/usr/bin/monit quit (code=exited, status=1/FAILURE)
Process: 1079 ExecStart=/usr/bin/monit -I (code=exited, status=1/FAILURE)
Main PID: 1079 (code=exited, status=1/FAILURE)
Jun 01 16:37:00 stage-web-1 systemd[1]: Started Pro-active monitoring utility for unix systems.
Jun 01 16:37:00 stage-web-1 systemd[1]: Starting Pro-active monitoring utility for unix systems...
Jun 01 16:37:00 stage-web-1 monit[1079]: Error opening the log file '/var/www/html/nfs/monit/stage-web-1.log' for writing -- No such file or directory
Jun 01 16:37:00 stage-web-1 systemd[1]: monit.service: main process exited, code=exited, status=1/FAILURE
Jun 01 16:37:00 stage-web-1 monit[1131]: Error opening the log file '/var/www/html/nfs/monit/stage-web-1.log' for writing -- No such file or directory
Jun 01 16:37:00 stage-web-1 systemd[1]: monit.service: control process exited, code=exited status=1
Jun 01 16:37:00 stage-web-1 systemd[1]: Unit monit.service entered failed state.
Jun 01 16:37:00 stage-web-1 systemd[1]: monit.service failed.
Facts show that it/var/www/html/nfs
is a folder mounted to a network drive via NFS.
Monit was started before NFS, so the folder didn't exist yet, causing the monit errorError opening the log file '/var/www/html/nfs/monit/stage-web-1.log' for writing -- No such file or directory
.
How to solve the disappearance of Monit startup monitoring process monit.service failed.?
The workaround is to edit/lib/systemd/system/monit.service
:
[Unit] Description=Pro-active monitoring utility for unix systems After=network.target [Service] Type=simple ExecStart=/usr/bin/monit -I ExecStop=/usr/bin/monit quit ExecReload=/usr/bin/monit reload [Install] WantedBy=multi-user.target
and addnfs.service
到该After
Behind.The final result looks like this:
[Unit]
Description=Pro-active monitoring utility for unix systems
After=network.target nfs.service
[Service]
Type=simple
ExecStart=/usr/bin/monit -I
ExecStop=/usr/bin/monit quit
ExecReload=/usr/bin/monit reload
[Install]
WantedBy=multi-user.target
The Monit monitor can now start successfully at boot time.
Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) shared "Solving the Monit Startup Monitoring Process Disappearance monit.service failed.", which is helpful to you.
Welcome to share the link of this article:https://www.chenweiliang.com/cwl-1422.html
Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!