Zabbix 3.0 on CentOS 6
Zabbix 3.0 is the enterprise-level software designed for monitoring availability and performance of IT infrastructure components. It is open source without any cost. We will install it in a server and then install a client system in a separate machine that will be monitored by the server.
The prerequisites for installing it is to have LAMP server is already configured.
1. Install LAMP
Let us first install and configure LAMP stack on the server starting with apache.
# yum install httpd httpd-devel
# yum install mysql mysql-server
# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml
Enable Apache and MySQL during boot.
# chkconfig httpd on # chkconfig mysqld on # service httpd start # service mysqld start
Execute mysql secure installation script to make it secure.
Configure IPTABLE to allow traffic to apache. Execute the following command in the terminal terminal to allow traffic to port no 80
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT # service iptables save # service iptables restart
LAMP server is configured in your server.
2. Install Zabbix 3.0 repository
To install it, add EPEL repository, download the EPEL rpm repository using wget and then install it using rpm -ivh
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -Uvh epel-release-6-8.noarch.rpm
3. Install Zabbix 3.0
Now update the repository and install it.
# yum update # yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql
The server is installed in your system, let us now configure it.
4. Configure Zabbix 3.0
We will first create a MySQL database and a mysql user.
# mysql -u root -p # create database zab; # GRANT ALL ON zab.* TO zab-user@localhost IDENTIFIED BY 'somepassword'; # flush privileges; # exit
Now import templates to the database
# mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/schema/mysql.sql # mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/data/data.sql # mysql -uzab -p somepassword < /usr/share/doc/zabbix-server-mysql-1.8.22/create/data/images_mysql.sql
Edit the file /etc/zabbix/zabbix_server.conf, Write the database name, user and password that you’ve created in step 3
[...] DBName=zab [...] DBUser=zab-user [...] DBPassword=somepassword [...]
Also edit file /etc/zabbix/zabbix_agentd.conf and edit the server hostname.
[...] Hostname=Demo server [...]
Though it is not mandatory to configure hostname but setting this value can easily let you choose a particular host when the server is monitoring large no of clients.
Edit PHP setting and uncomment/add following values
max_execution_time = 600 max_input_time = 600 memory_limit = 512M post_max_size = 32M upload_max_filesize = 16M date.timezone = Asia/Singapore
Configure IPTABLE to allow traffic to ports 10050 and 10051. Edit /etc/sysconfig/iptables and add the following lines
[...] -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT [...]
Restart IPTABLE service to reload new configuration.
# service iptables restart
If you want to restrict web console to particular IP address/ranges then edit /etc/httpd/conf.d/zabbix.conf and add “Allow from” directive inside <directory>…</directory> tag
Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from 192.168.3.11/24 or Allow from all </Directory>
Our settings allow web console to be accessed from anywhere. Start/Restart the following services and configure them to start on reboot.
# service zabbix-server start # service zabbix-agent start # service httpd restart # service mysqld restart # chkconfig zabbix-server on # chkconfig zabbix-agent on
5. Web Installer
Access web installer using http://demohost.com/zabbix/ and follow the steps as per given instructions.
Accept license and click “Next”
Check for all prerequisite and click “Next”
Provide MySQL database details/user/password, test the connection and click “Next”
Set host name and port no. We will keep the default port no as we have already added this port number to IPTABLE.
Check the pre-installation settings / parameters and click “Next”
The installation is now complete. Click Finish to complete the installation. You’ll be redirected to the login page. Provide the username and password. The default username/password is admin/zabbix.
Click “Enter”, You will be redirected to dashboard.
Activate the server. The server is by default deactivated from being monitored. To activate it, go to Configuration and then Hosts. Select the host by the name and choose Activate selected from the drop-down box and click Go.
You should find that the host is being monitored
6. Client side configuration
Now we will install agent in client systems. Install the client packages on Fedora/RHEL clients, execute the following command in the terminal. Here for simplicity we will choose the server itself ( demohost.com )as client system. You can replicate the following steps in any client system in the network.
# sudo yum install zabbix-agent
On Ubuntu/Debian clients:
# sudo apt-get install zabbix-agent
Next edit file /etc/zabbix/zabbix_agentd.conf and add the following lines in it. Add the server IP address and client hostname.
[...] Server=demohost.com [...] Hostname=Demo client [...]
Where, demohost.com is the server that we have installed in step 4
Restart the agent
# sudo service zabbix-agent start
Add Monitoring host
Navigate to dashboard. Click Configuration and then Hosts and finally Click on Create Host on the right side.
Provide hostname, groups and IP address, the agent port no as shown below. When you click “Add” button ( numbered 7), a pop-up window will appear to select the template. We will select “Linux template”( numbered 8 in the image). And finally click the “Save” button ( numbered 9 )
You will now find that new client host is being monitored.
Now you can explore all the options and modify them that suits your requirements on your newly installed Zabbix 3.0 Server.