Munin is a networked opensource resource monitoring tool that can be used to monitor servers and their services. It displays information gathered from the system as graphs through a web based interface. Here I am referring the steps for munin installation. Continue reading
Monit is utility or package we usually used in Linux machines for managing and monitoring service running in the Linux machines. For example services like HTTPD, MySQL etc. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. The monit also has user friendly web interface where you can directly view the system status and setup up processes using native HTTP(S) web server or via the command line interface. In this blog we disscussing how we can implement monit on a Centos7 server. The Centos version I am using CentOS Linux release 7.2.1511
[root@server ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
At this moment monit is not available in the base repository of Centos 7. So I used EPEL repository to install monit using yum.
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm rpm -ivh epel-release-7-8.noarch.rpm
yum install monit
Now we are going to enable monit web interface by configuring the monit conf file. After enabling we will be having a nice web interface of monit that shows status of services we are monitoring, how long it was up in the server etc. We have added a screenshot for the same at the end of this article. You are refer the same for how exactly it look like.
open /etc/monitrc using vi editer and make below changes.
originally it was like
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'
After changes it will look like
set httpd port 2812 and use address x.x.x.x(server IP) # only accept connection from localhost allow y.y.y.y(Your IP) # allow localhost to connect to the server and allow admin:monit # require user 'admin' with password 'monit'
Restart service using below command
service monit restart
Allow port 2812 in the firewall and verify its listening from outside using telnet commands. In my case I was using csf firewall. So I just need to add port in the csf conf file under TCP_IN and TCP_OUT section.
After that access the monit web interface using the url like http://x.x.x.x:2812
In this section we are going to monitor our server mySQL service by monit and restart it if its failed. Below are the changes.
Create a file named mysql.conf under directory /etc/monit.d/.
Add below entries and make necessary changes as per your server and pid file name and location.
check process mysqld with pidfile /var/lib/mysql/server.namemysql.pid group mysql start program = "/usr/bin/systemctl start mysql.service" stop program = "/usr/bin/systemctl stop mysql.service" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout
Once added check the syntax using command “monit -t” and you will get result like below.
monit -t Control file syntax OK
restart monit service using below command.
service monit restart
After that refresh the monit web panel and you will see MySQL is monitored by Monit.
In centos 7 we can see monit log from the location tail -f /var/log/monit.log
CentOS Web Panel
CentOS Web Panel is a free Web Hosting control panel. It is mainly designed for quick and easy management of servers without using ssh console for every little thing. Lots of options and features are available in this panel. As the name suggest the panel can only be installed in CentOS 6, RedHat 6 and CloudLinux 6.
How to access CentOS Web Panel after installation.
Non SSL Login: http://IP-Address:2030 SSL Login: https://IP-Address:2031
We can use the same server root logins to log in to the panel.
How to create Domain Account in CentOS Web Panel
- Log in to the Panel as we have mentioned before.
- Click “User Accounts” in left menu then Click “New Account”
- Enter Domain name (eg. example.com)
- Enter username (make it similar to domain eg. example)
- Copy random generated password from CentOS Web Panel to safe place or set your password
- Select Package if you created previously or set it as default.
- Enter email address in the email address field.
- Click on button Create.