You are here
Installing Zabbix on CentOS
Wed, 2013-06-12 15:49 — Krishna
Zabbix is an enterprise-class open source software for monitoring of networks and applications. It is designed to monitor and track the status of various network services, servers and applications. It offers advanced monitoring, alerting, and visualization features.
This is a step by step guide on "Installing Zabbix on CentOS" for MySQL monitoring. Monitoring mysql will be posted in seperate article.
Install Apache httpd
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
Order deny,allow
Deny from all
PHP Tuning
[root@localhost html]# vi /etc/php.ini
max_execution_time = 300
date.timezone =Asia/Calcutta
memory_limit = 256M
post_max_size = 32M
[root@localhost html]# /etc/init.d/httpd restart
Setup Web Frontend
Step:1
In browser, open Zabbix URL: http:///zabbix and follow the screen steps to complete the zabbix installation.
[root@localhost ~]# yum -y install httpd
Start httpd service
[root@localhost ~]# /etc/init.d/httpd start [ OK ]
[root@localhost ~]# ps -ef | grep http
root 2011 1 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2013 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2014 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2015 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2016 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2017 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2018 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2019 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
apache 2020 2011 0 11:46 ? 00:00:00 /usr/sbin/httpd
Location of httpd error & configuration file
[root@localhost ~]# cat /var/log/httpd/error_log
[root@localhost ~]# cat /etc/httpd/conf/httpd.conf
Now, apache should be working fine.
Install PHP and it's extension
[root@localhost ~]# yum -y install php
[root@localhost ~]# yum -y install php-mysql
PHP configuration file
[root@localhost ~]# cat /etc/php.ini
Install MySQL Server
[root@localhost ~]# yum -y install mysql-server mysql mysql-devel
[root@localhost ~]# /etc/init.d/mysqld start
MySQL configuration and error log file
[root@localhost ~]# cat /etc/my.cnf
[root@localhost ~]# cat /var/log/mysqld.log
Verification of apache, php and mysql
Create a 'phpinfo.php' file and copy and paste the following line into it:
Zabbix Installations
Installing php extensions
[root@localhost ~]# yum -y install php-bcmath
[root@localhost ~]# yum -y install php-xml
[root@localhost ~]# yum -y install php-mbstring
Server
Requirement Description
OpenIPMI Required for IPMI support.
libssh2 Required for SSH support. Version 1.0 or higher.
fping Required for ICMP ping items.
libcurl Required for web monitoring.
libiksemel Required for Jabber support.
net-snmp Required for SNMP support.
[root@localhost ~]# yum install OpenIPMI libssh2 fping libcurl net-snmp gcc automake curl-devel net-snmp-devel OpenIPMI-devel
[root@localhost ~]# wget http://dag.wieers.com/rpm/packages/iksemel/iksemel-1.4-1.el6.rf.i686.rpm
[root@localhost ~]# wget http://dag.wieers.com/rpm/packages/iksemel/iksemel-devel-1.4-1.el6.rf.i6...
[root@localhost ~]# rpm -ivh iksemel-1.4-1.el6.rf.i686.rpm
warning: iksemel-1.4-1.el6.rf.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing... ########################################### [100%]
1:iksemel ########################################### [100%]
[root@localhost ~]# rpm -ivh iksemel-devel-1.4-1.el6.rf.i686.rpm
warning: iksemel-devel-1.4-1.el6.rf.i686.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY
Preparing... ########################################### [100%]
1:iksemel-devel ########################################### [100%]
[root@localhost ~]#
Download zabbix source.
[root@localhost ~]# wget http://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2....
[root@localhost ~]# ls -ltrh zabbix*
-rw-r--r--. 1 root root 13M Apr 22 08:34 zabbix-2.0.6.tar.gz
[root@localhost ~]#
Extract the source
[root@localhost ~]# tar -zxvf zabbix-2.0.6.tar.gz
User account for zabbix
[root@localhost ~]# groupadd zabbix
[root@localhost ~]# useradd -g zabbix zabbix
Creating user and database in mysql
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.01 sec)
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.02 sec)
Loading data into mysql
[root@localhost zabbix-2.0.6]# ls -ltrh database/mysql/
total 2.8M
-rw-rw-r--. 1 1000 1000 1.9M Apr 22 08:31 images.sql
-rw-rw-r--. 1 1000 1000 96K Apr 22 08:32 schema.sql
-rw-rw-r--. 1 1000 1000 782K Apr 22 08:32 data.sql
[root@localhost zabbix-2.0.6]# mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
[root@localhost zabbix-2.0.6]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql
[root@localhost zabbix-2.0.6]# mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
Configure the source
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
make
make install
[root@localhost zabbix-2.0.6]# ls -ltrh /usr/local/sbin/zabbix_*
-rwxr-xr-x. 1 root root 570K Jun 9 15:40 /usr/local/sbin/zabbix_agent
-rwxr-xr-x. 1 root root 653K Jun 9 15:40 /usr/local/sbin/zabbix_agentd
-rwxr-xr-x. 1 root root 2.2M Jun 9 15:41 /usr/local/sbin/zabbix_server
If any package is missing, we will know at this step.
Edit configuration files
[root@localhost zabbix-2.0.6]# ls -ltrh /usr/local/etc/zabbix_*
-rw-r--r--. 1 root root 1.6K Jun 9 15:40 /usr/local/etc/zabbix_agent.conf
-rw-r--r--. 1 root root 5.6K Jun 9 15:40 /usr/local/etc/zabbix_agentd.conf
-rw-r--r--. 1 root root 11K Jun 9 15:41 /usr/local/etc/zabbix_server.conf
Edit /usr/local/etc/zabbix_server.conf configuration file and add database, user and password.
Start zabbix services
[root@localhost zabbix-2.0.6]# zabbix_server
[root@localhost zabbix-2.0.6]# zabbix_agentd
[root@localhost zabbix-2.0.6]#
[root@localhost zabbix-2.0.6]# ps -ef | grep zabbix
zabbix 26578 1 0 16:01 ? 00:00:00 zabbix_server status
zabbix 26580 26578 0 16:01 ? 00:00:00 zabbix_server status
zabbix 26581 26578 0 16:01 ? 00:00:00 zabbix_server status
....
zabbix 26622 26578 0 16:01 ? 00:00:00 zabbix_server status
zabbix 26636 1 0 16:02 ? 00:00:00 zabbix_agentd
zabbix 26637 26636 0 16:02 ? 00:00:00 zabbix_agentd
....
zabbix 26641 26636 0 16:02 ? 00:00:00 zabbix_agentd
[root@localhost zabbix-2.0.6]#
Setup Web Interface
[root@localhost zabbix-2.0.6]# pwd
/root/zabbix-2.0.6
[root@localhost zabbix-2.0.6]# cp -r frontends/php /var/www/html/
[root@localhost zabbix-2.0.6]# cd /var/www/html/
[root@localhost html]# ls -ltrh
total 8.0K
-rw-r--r--. 1 root root 20 Jun 9 12:07 phpinfo.php
drwxr-xr-x. 11 root root 4.0K Jun 9 16:09 php
[root@localhost html]# mv php zabbix
[root@localhost html]# ls -ltrh
total 8.0K
-rw-r--r--. 1 root root 20 Jun 9 12:07 phpinfo.php
drwxr-xr-x. 11 root root 4.0K Jun 9 16:09 zabbix
Add alias in apache configuration
[root@localhost html]# vi /etc/httpd/conf/httpd.conf
Alias /zabbix /var/www/html/zabbix