How to Install Monit on openSUSE 13.2
Monit is an open source process tool for Linux operating system which helps you to monitor system process using a web browser and also when ever requires it automatically do the maintenance or repair of processes in such a way that it can be brought back online. It can also be used for managing and monitoring of programs, files, directories, and devices for timestamps changes, checksum changes, or size changes; not limited to perform various TCP/IP network checks, protocol checks, and can utilize SSL for such checks.
It logs to its own log file and notifies the user via customizable messages, this guide will help you to set up monit on openSUSE.
Install the Monit as the package is available on official repository.
# zypper install monit
Start monit by using the following command.
# systemctl start monit.service
Check the monit status.
# monit status The Monit daemon 5.8.1 uptime: 12m System 'server.itzgeek.com' status Running monitoring status Monitored load average [0.00] [0.01] [0.01] cpu 0.0%us 0.0%sy 0.0%wa memory usage 119868 kB [3.1%] swap usage 0 kB [0.0%] data collected Fri, 21 Nov 2014 17:35:39
If you get any error like below,
Status not available -- the monit daemon is not running
Edit /etc/monitrc and un comment the following pid entry.
set pidfile /var/run/monit.pid
Then restart the service and start the monit daemon.
# systemctl restart monit.service # monit
Monit’s configuration file is /etc/monitrc, by default, monit it set to check the services at an interval of 1 min, this setting can be altered by changing the following entry.
# vi /etc/monitrc set daemon 60
Alert can be configured by.
Alert templates can be found in the configuration file itself; logs setting can be changed. By default, Monit logs will go /var/log/messages.
Monit also provides a web interface to monitor and manage the configured services, by default monit listens on 2812 port but it needs to be setup.
# vi /etc/monitrc
Look for httpd port 2812, modify the following entries.
# set httpd port 2812 and use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and allow admin:monit # require user 'admin' with password 'monit' allow @monit # allow users of group 'monit' to connect (rw) allow @users readonly # allow users of group 'users' to connect read only
set httpd port 2812 and allow 0.0.0.0/0.0.0.0 allow admin:monit
From the above settings, monit will listen on 2812; admin user will able to access the web interface from any network with the password “monit”.
Un comment the following line in the same file, to include additional monitoring files from /etc/monit.d/
# systemctl restart monit.service
Auto start Monit on start-up.
# systemctl enable monit.service
Access the web interface by using http://your-ip-address:2812, use the username and password mentioned in the previous step. Monit home page will look like this.
Configuring services for monitoring:
Once the web interface is up, we can start to set up other services that you want to monitor; you can place the configuration files under /etc/monit.d/ directory.
Configure for syslog.
# vi /etc/monit.d/syslogmonitor check process syslogd with pidfile /var/run/rsyslogd.pid start program = "/usr/bin/systemctl start rsyslog.service" stop program = "/usr/bin/systemctl stop rsyslog.service"
Once configured, test monit syntax.
# monit -t Control file syntax OK
Reload it to take effect of changes.
# systemctl restart monit.service
Access the web interface, you would find syslog service that we configured earlier.
Test the Monitoring:
Now stop the syslog daemon.
# systemctl stop rsyslog.service
Service status in the web interface is changed to does not exist.
Wait for 20 second, monit will start the syslog automatically. You can find it in monit log, event with the keyword “monit” represents Monit event.
# cat /var/log/messages 2014-11-21T18:56:02.275872+00:00 server monit: 'syslogd' process is running with pid 3113
That’s All, We have successfully configured Monit on openSUSE 13.2. We welcome your feedback, please post your valuable comments below.