Zabbix is an enterprise-class open source distributed monitoring solution that can be used to monitor and track performance and availability of network servers, devices and other IT resources. It supports distributed and WEB monitoring, auto-discovery, and more.
I tested this how-to On CentOS 6.5, although it should work on other RHEL/CentOS 6.x versions. For the testing purpose, I will use two machines.
Zabbix Server System:
Operating system: CentOS 6.5 IP Address: 192.168.1.101/24 Hostname: server.unixmen.local
Zabbix Client System:
Operating system: Ubuntu 13.04 IP Address: 192.168.1.100/24 Hostname: sk
First let us start from server side.
Before installing Zabbix, we should have install and configure LAMP stack on server. To install and configure LAMP server On Debian 7 and Ubuntu 13.10, refer the following links.
– Install LAMP Server On RHEL/CentOS/Scientific Linux 6
Server Side Configuration
Hence Zabbix is not found in the default repositories, we have to add EPEL repository to install Zabbix. To install EPEL repository, follow the below link:
– Install EPEL Repository On RHEL / CentOS 6
Now update repository and Zabbix server using commands:
# yum update # yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql
Create MySQL database and user for Zabbix
Let us create a database called ‘zabbix’ and database user called ‘zabbix’ with password ‘centos’.
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.35 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database zabbix; Query OK, 1 row affected (0.05 sec) mysql> GRANT ALL ON zabbix.* TO [email protected] IDENTIFIED BY 'centos'; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> exit Bye
Import zabbix templates to Zabbix database
Let us import the following templates. It will ask you the zabbix password during importing templates.
# mysql -uzabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-1.8.18/create/schema/mysql.sql # mysql -uzabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-1.8.18/create/data/data.sql # mysql -uzabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-1.8.18/create/data/images_mysql.sql
Configure Zabbix server
Edit file /etc/zabbix/zabbix_server.conf,
# vi /etc/zabbix/zabbix_server.conf
Set the database name, user and password which you’ve created earlier. If the lines are commented out, uncomment and set the correct values.
[...] DBName=zabbix [...] DBUser=zabbix [...] DBPassword=centos [...]
Save and close the file.
Edit file /etc/zabbix/zabbix_agentd.conf,
# vi /etc/zabbix/zabbix_agentd.conf
Set the zabbix server hostname.
[...] Hostname=server.unixmen.local [...]
Adjust PHP settings
We should adjust phip.ini file as per zabbix recommended settings.
Edit file php.ini,
# vi /etc/php.ini
Set the values as shown below. If the lines doesn’t exist, add them.
max_execution_time = 600 max_input_time = 600 memory_limit = 256M post_max_size = 32M upload_max_filesize = 16M date.timezone = Asia/Kolkata
Save and close the file.
Adjust Firewall settings
Adjust iptables to allow the zabbix ports 10050 and 10051.
# vi /etc/sysconfig/iptables
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 iptables service to take effect the changes.
# service iptables restart
Allow Zabbix web console for particular IP range (Optional)
Edit file /etc/httpd/conf.d/zabbix.conf,
# vi /etc/httpd/conf.d/zabbix.conf
Add the ip range that you want to allow to access zabbix web interface. This is optional. If you set Allow from All, you can access zabbix from any network. In my case i allowed the 192.168.1.0/24 series.
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from 192.168.1.0/24 </Directory>
Save and close the file. Start/Restart zabbix and httpd services and make them to start automatically on every reboot.
# service zabbix-server start # service zabbix-agent start # service httpd restart # service mysqld restart # chkconfig zabbix-server on # chkconfig zabbix-agent on
Access Zabbix Web console
We have completed the installation and configuration part. Now let us setup the zabbix web console. Navigate to http://ip-address/zabbix or http://domain-name/zabbix.
The installer will check for necessary prerequisites. If everything seems OK, click Next to continue, else go back and install the necessary packages.
Enter the zabbix database name, database user and password and click Test connection. If you entered the correct values, it will show a message that says: OK. Click Next to continue.
Enter your server name and Click Next:
Check the pre-installation summary, if everything good, click Next to continue or click Previous to change the parameters.
Congratulations! You’ve have successfully completed the installation. Click Finish to complete the installation.
Now you’ll be redirected to the zabbix web console page. Enter the username and password. The default username/password is admin/zabbix.
This is how the admin dashboard looks:
Initially, the zabbix server is deactivated from being monitored. To activate it, go to Configuration -> Hosts. Select the host(zabbix server) and choose Activate selected from the drop-down box and click Go.
Now you should see the host is being monitored.
Check Zabbix server Statistics
After a few seconds, click on the Monitoring tab on the top menu bar and select “Latest data”. You’ll see the zabbix server details:
Client Side Configuration
Let us install zabbix agent on our client systems. To install zabbix client packages on Fedora/RHEL clients, enter the following command in Terminal:
$ sudo yum install zabbix-agent
On Ubuntu/Debian clients:
$ sudo apt-get install zabbix-agent
Next edit file /etc/zabbix/zabbix_agentd.conf,
$ sudo vi /etc/zabbix/zabbix_agentd.conf
Add the server ip address and client hostname.
[...] Server=192.168.1.101 [...] Hostname=sk [...]
192.168.1.101 – CentOS 6.5 IP address(Zabbix server).
sk – Ubuntu 13,04 hostname(client hostname).
Now restart zabbix-agent service with command:
$ sudo service zabbix-agent start
Add Monitoring host
Go to your zabbix server dashboard. To add a monitoring target, navigate to Configuration -> Hosts. Click on Create Host on the right side.
Enter Hostname, select Groups and IP address as shown below.
Click Add on the right side and select the template to use.
Finally click Save on the bottom to go back to the previous windows. Now you will see that the new host has been added to the Monitoring list.
That’s it. I have covered only basic things. Explore all the options and tweak them as per your requirement to get better monitoring solution. Good luck!