Monday, January 6, 2014

Zabbix Installation on CentOS 6.X

Zabbix Installation on CentOS 6.X

1. what is Zabbix?
2. Installations
3. Usage

Here we go:

1. what is Zabbix?
Zabbix is an open source monitoring solution that can be used to monitor and track performance and availability of network servers, devices and other IT resources.
2. Requirements Installations

2.1 LAMP 
LAMP (Linux, Apache HTTP Server, MySQL database, and PHP/Perl/Python)
2.1.1 Install Apache
# yum install httpd
Start Apache and add to auto startup when every boot.
# service httpd start 
# chkconfig httpd on
Allow Port 80 through our firewall
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

# service iptables restart
2.1.2 Install MySQL
# yum install mysql mysql-server
Start MySQL and add to auto startup when every boot.
# service mysqld start 
# chkconfig mysqld on
Set MySQL root's password by:
# mysql_secure_installation

2.1.3 Install PHP
# yum install php
# yum install php-mysql

2.2 EPEL
Before we can install Zabbix or other packages we need to install EPEL (Extra Packages for Enterprise Linux) first:
For CentOS 6.x
# wget http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm 
# rpm -Uvh epel-release-6-8.noarch.rpm

we can show our repository installed by:
# yum repolist

Update Repository
#yum update
Install Zabbix services
#yum install zabbix-server-mysql zabbix-agent zabbix-web-mysql

Log in into MySQL and create database and user for Zabbix
[root@zabbix ~]# mysql -u root -p
Enter password: 
mysql> create database zabbix;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbixpassword';
mysql> flush privileges;
mysql> exit

Import zabbix templates to Zabbix database

# 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
# vi /etc/zabbix/zabbix_server.conf

[...]
DBName=zabbix
[...]
DBUser=zabbix
[...]
DBPassword=zabbixpassword
[...]

Edit file /etc/zabbix/zabbix_agentd.conf
# vi /etc/zabbix/zabbix_agentd.conf
[...]
Hostname= zabbix.vannakk.net
[...]

Edit Zabbix reqirements:
vi /etc/httpd/conf.d/zabbix.conf

php_value max_execution_time 900
php_value max_input_time 600
php_value memory_limit 256M
php_value upload_max_filesize 32M
php_value post_max_size 32M

Edit PHP.ini
# vi /etc/php.ini
date.timezone = Asia/Phnom_Penh

Adjust Firewall settings
Adjust iptables to allow the zabbix ports 10050 and 10051.
# vi /etc/sysconfig/iptables
[...]
-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
[...]
# service iptables restart

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
http://ip-address/zabbix or http://domain-name/zabbix

Follow the screen shoot and complete all the steps:










The default username/password is admin/zabbix



3. Usage
(Not yet added)

No comments:

Post a Comment