On a web server, it’s very important to keep services up and running. CWP will help you in this via the Services Monitoring tool.
To enable service monitoring in CWP:
- Connect to your CWP installation
- Find Services Config->ServicesMonitor (systemd) option
- Select/enter:
Enable/Disable – this will enable/disable service monitoring
Email notifications to – enter an email address where you will receive notifications
Check every – period of time between two checks - Select the Services you want to be monitored.
- Click the Submit button. You will see a confirmation message:
Service Monitoring is not enabled
Enabling monitoring in cron
MAILTO=cwp1@plothost.com
*/15 * * * * root /usr/local/bin/svcMonitor-systemd
Monitoring Enabled: Yes
Notice: If the systemd status of a service is unknown then monitoring will not work for that service.
The selected services that will be monitored are saved in the file /usr/local/etc/services-monitor-systemd
The monitoring cron job can be found in file /etc/cron.d/svcMonitor-systemd
You can manually add/delete services via chkconfig command
chkconfig service_name on
chkconfig service_name off
For example, when enabling all services available we get cron messages like:
From: (Cron Daemon) <root@cwp1.yourdomain.com>
Subject: Cron <root@cwp1> /usr/local/bin/svcMonitor-systemdRestarted service amavisd.service on cwp1 at Sat Mar 31 01:00:01 EDT 2018 Job for amavisd.service failed because the control process exited with error code. See “systemctl status amavisd.service” and “journalctl -xe” for details.
Restarted service arp-ethers.service on cwp1 at Sat Mar 31 01:00:03 EDT 2018 Restarted service autovt@.service on cwp1 at Sat Mar 31 01:00:04 EDT 2018 Failed to stop autovt@.service: Unit name autovt@.service is missing the instance name.
See system logs and ‘systemctl status autovt@.service‘ for details.
Failed to get load state of autovt@.service: Unit name autovt@.service is missing the instance name.
Failed to start autovt@.service: Unit name autovt@.service is missing the instance name.
See system logs and ‘systemctl status autovt@.service‘ for details.
Restarted service console-shell.service on cwp1 at Sat Mar 31 01:00:05 EDT 2018 Restarted service garb.service on cwp1 at Sat Mar 31 01:00:06 EDT 2018 Restarted service getty@.service on cwp1 at Sat Mar 31 01:00:07 EDT 2018 Failed to stop getty@.service: Unit name getty@.service is missing the instance name.
See system logs and ‘systemctl status getty@.service‘ for details.
Failed to get load state of getty@.service: Unit name getty@.service is missing the instance name.
Failed to start getty@.service: Unit name getty@.service is missing the instance name.
See system logs and ‘systemctl status getty@.service‘ for details.
Restarted service ntalk.service on cwp1 at Sat Mar 31 01:00:09 EDT 2018 Job for ntalk.service failed because a configured resource limit was exceeded. See “systemctl status ntalk.service” and “journalctl -xe” for details.
Restarted service rdisc.service on cwp1 at Sat Mar 31 01:00:10 EDT 2018 Job for rdisc.service failed because the control process exited with error code. See “systemctl status rdisc.service” and “journalctl -xe” for details.
Restarted service serial-getty@.service on cwp1 at Sat Mar 31 01:00:17 EDT 2018 Failed to stop serial-getty@.service: Unit name serial-getty@.service is missing the instance name.
See system logs and ‘systemctl status serial-getty@.service‘ for details.
Failed to get load state of serial-getty@.service: Unit name serial-getty@.service is missing the instance name.
Failed to start serial-getty@.service: Unit name serial-getty@.service is missing the instance name.
See system logs and ‘systemctl status serial-getty@.service‘ for details.
Restarted service svnserve.service on cwp1 at Sat Mar 31 01:00:18 EDT 2018 Job for svnserve.service failed because the control process exited with error code. See “systemctl status svnserve.service” and “journalctl -xe” for details.
Restarted service tcsd.service on cwp1 at Sat Mar 31 01:00:19 EDT 2018 Job for tcsd.service failed because the control process exited with error code. See “systemctl status tcsd.service” and “journalctl -xe” for details.
Restarted service vzfifo.service on cwp1 at Sat Mar 31 01:00:20 EDT 2018
The movie tutorial for this KB post: