Step by Step Installing Zabbix on CentOS
Install Apache Server on CentOS, RedHat, Linux
# yum install httpd
# chkconfig httpd on
# service httpd start
Starting httpd: [ OK ]
Install PHP
# yum install php
Install MySQL
# yum install mysql-server mysql php-mysql
# service mysqld start
# chkconfig mysqld on
Install Mail Server
Remove sendMail
# yum remove sendmail
# yum install postfix
The configuration file is located at /etc/postfix/main.cf. Edit the file and make sure you change the following lines with your domain name.
1) What domain name to use in outbound mail
Eg:- mydomain = example.com
myorigin = $mydomain
2) What domains to receive mail for
Eg:- mydestination =
3) What clients to relay mail from
Eg:- mynetworks = 192.168.10.0/24 , 192.168.73.0/24, 127.0.0.0/8
4) What destinations to relay mail to
Eg:- relay_domains = $mydestination
5) What delivery method: direct or indirect
(For direct delivery to Internet.)
Eg:- relayhost =
Now edit the mail configruaration file and set parameter to send mail with our register domain name.
# vi /etc/postfix/main.cf
myhostname= zabbix.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination =
mynetworks = 192.168.19.0/24 , 192.168.73.0/24, 127.0.0.0/8
relay_domains = $mydestination
relayhost =
# chkconfig postfix on
# /etc/init.d/postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
Test mail server by sending test mail from telnet
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 zabbix.glam.com ESMTP Postfix
helo
501 Syntax: HELO hostname
helo example.com
250 zabbix.example.com
mail from:zabbix@example.com
250 2.1.0 Ok
rcpt to:abc_username@gmail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject: test message
this is the test mail
.
250 2.0.0 Ok: queued as F02B840410
quit
221 2.0.0 Bye
Connection closed by foreign host.
Zabbix Installation
We will be installing following components:
Zabbix Server (for gathering data)
Zabbix Agent (for monitoring)
Net-SNMP (for SNMP Support)
Jabber (for notifications)
OpenIPMI (for monitoring)
cURL (for web monitoring)
First install all the dependencies with yum using the command
# yum install zlib-devel mysql-devel glibc-devel curl-devel gcc automake mysql libidn-devel openssl-devel net-snmp-devel rpm-devel OpenIPMI-devel
For Jabber:- we will need the packages iksemel-devel wich depends on iksemel,
however these RPM's arent in the CentOS Repo's so we will be downloadind them from a external site.
# wget http://dag.wieers.com/rpm/packages/iksemel/iksemel-1.3-1.el5.rf.i386.rpm
# wget http://dag.wieers.com/rpm/packages/iksemel/iksemel-devel-1.3-1.el5.rf.i386.rpm
# ls -l
-rw-r--r-- 1 root root 118688 Aug 6 2007 iksemel-1.3-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root 6695 Aug 6 2007 iksemel-devel-1.3-1.el5.rf.i386.rpm
# rpm -ivh iksemel-1.3-1.el5.rf.i386.rpm
warning: iksemel-1.3-1.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:iksemel ########################################### [100%]
# rpm -ivh iksemel-devel-1.3-1.el5.rf.i386.rpm
warning: iksemel-devel-1.3-1.el5.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
1:iksemel-devel ########################################### [100%]
Install Check Install for future software management
# wget http://www.asic-linux.com.mx/~izto/checkinstall/files/rpm/checkinstall-1.6.1-1.i386.rpm
# rpm -ivh checkinstall-1.6.1-1.i386.rpm
Preparing... ########################################### [100%]
1:checkinstall ########################################### [100%]
Download Zabbix tar file :-
# ls -l
-rw-r--r-- 1 root root 118688 Aug 6 2007 iksemel-1.3-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root 6695 Aug 6 2007 iksemel-devel-1.3-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root 4184672 Apr 16 01:01 zabbix-1.8.5.tar.gz
# tar -zxvf zabbix-1.8.5.tar.gz
# ls -l
-rw-r--r-- 1 root root 118688 Aug 6 2007 iksemel-1.3-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root 6695 Aug 6 2007 iksemel-devel-1.3-1.el5.rf.i386.rpm
drwxr-xr-x 12 1001 1001 4096 Apr 16 00:50 zabbix-1.8.5
-rw-r--r-- 1 root root 4184672 Apr 16 01:01 zabbix-1.8.5.tar.gz
# cd zabbix-1.8.5
# ./configure --enable-server --with-mysql --with-net-snmp --with-jabber --with-libcurl --with-openipmi --enable-agent
In the end, a summary of compiled components is printed. Verify that you have the following enabled:
Enable server: yes
Server details:
With database: MySQL
WEB Monitoring via: cURL
Native Jabber: yes
SNMP: net-snmp
IPMI: openipmi
SSH: no
# make
Now we should install it. Despite the output of configure and many How Tos suggesting so, do not run make install. It unnecessarily complicates package management and can lead to weird problems in future. Instead, you should create proper packages for your distribution.
To create a proper Zabbix package make sure that CheckInstall is installed and execute as root:
# checkinstall --nodoc --install=yes -y
You Should be able to choose what kind of package that you wish you create,
because CentOS is based on RedHat we are going for [R], type R and press Enter.
Initial configuration
Create new user as zabbix with password set as zabbix
# useradd -m -s /bin/bash zabbix
# passwd zabbix
Changing password for user zabbix.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
# pwd
/root/zabbix-1.8.5
# mkdir /etc/zabbix
# cp misc/conf/zabbix_server.conf /etc/zabbix/
# cp misc/conf/zabbix_agentd.conf /etc/zabbix/
Now edit zabbix_server.conf file to modify and database name , database user and dbpassword
Look for DBName, DBUser and DBPassword
# vi /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
# chmod 400 /etc/zabbix/zabbix_server.conf
# chown zabbix /etc/zabbix/zabbix_server.conf
Creataing and populating the database
First of make sure the mysql daemon is running using
# service mysqld status
If not you can start it with
# service mysqld start
Set root password for mysql. for now I am giving redhat
# mysqladmin -u root password redhat
# mysql_secure_installation
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
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.00 sec)
mysql> quit;
Bye
Note: - Use the same password you set in zabbix_server.conf file instead of zabbix if you have given other one.
# mysql -u zabbix -p zabbix < create/schema/mysql.sql
# mysql -u zabbix -p zabbix < create/data/data.sql
# mysql -u zabbix -p zabbix < create/data/images_mysql.sql
Cross check if zabbix database created with table for so do
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use zabbix;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_zabbix |
+-----------------------+
| acknowledges |
| actions |
| alerts |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |
| conditions |
| config |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| events |
| expressions |
| functions |
| globalmacro |
| graph_theme |
| graphs |
| graphs_items |
| groups |
| help_items |
| history |
| history_log |
| history_str |
| history_str_sync |
| history_sync |
| history_text |
| history_uint |
| history_uint_sync |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_profiles |
| hosts_profiles_ext |
| hosts_templates |
| housekeeper |
| httpstep |
| httpstepitem |
| httptest |
| httptestitem |
| ids |
| images |
| items |
| items_applications |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| mappings |
| media |
| media_type |
| node_cksum |
| nodes |
| opconditions |
| operations |
| opmediatypes |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| rights |
| screens |
| screens_items |
| scripts |
| service_alarms |
| services |
| services_links |
| services_times |
| sessions |
| slides |
| slideshows |
| sysmaps |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| timeperiods |
| trends |
| trends_uint |
| trigger_depends |
| triggers |
| user_history |
| users |
| users_groups |
| usrgrp |
| valuemaps |
+-----------------------+
88 rows in set (0.01 sec)
mysql> quit;
Bye
[root@zabbix zabbix-1.8.5]#
[ Note: - If any problems occur the easiest way is to delete the db with
# mysql> drop database Zabbix; and start from the beginning again. ]
Now login as zabbix user and execute the file to check all services are running with zabbix users
# su - zabbix
[zabbix@zabbix ~]$ /usr/local/sbin/zabbix_agentd
[zabbix@zabbix ~]$ /usr/local/sbin/zabbix_server
[zabbix@zabbix ~]$ ps -e | grep zabbix
26015 ? 00:00:00 zabbix_agentd
26016 ? 00:00:00 zabbix_agentd
26017 ? 00:00:00 zabbix_agentd
26018 ? 00:00:00 zabbix_agentd
26019 ? 00:00:00 zabbix_agentd
26020 ? 00:00:00 zabbix_agentd
26023 ? 00:00:00 zabbix_server
26025 ? 00:00:00 zabbix_server
26027 ? 00:00:00 zabbix_server
26028 ? 00:00:00 zabbix_server
26029 ? 00:00:00 zabbix_server
26030 ? 00:00:00 zabbix_server
26031 ? 00:00:00 zabbix_server
26032 ? 00:00:00 zabbix_server
26033 ? 00:00:00 zabbix_server
26034 ? 00:00:00 zabbix_server
26037 ? 00:00:00 zabbix_server
26039 ? 00:00:00 zabbix_server
26041 ? 00:00:00 zabbix_server
26042 ? 00:00:00 zabbix_server
26048 ? 00:00:00 zabbix_server
26050 ? 00:00:08 zabbix_server
26052 ? 00:00:00 zabbix_server
26054 ? 00:00:00 zabbix_server
26056 ? 00:00:00 zabbix_server
26060 ? 00:00:00 zabbix_server
26062 ? 00:00:00 zabbix_server
26064 ? 00:00:00 zabbix_server
26066 ? 00:00:00 zabbix_server
26067 ? 00:00:00 zabbix_server
26070 ? 00:00:00 zabbix_server
26072 ? 00:00:00 zabbix_server
[zabbix@zabbix ~]$
Creating startup scripts
Login in back to root
$ su -
After a successful login let us copy the scripts from our Zabbix source into our /etc/init.d/ folder. this can be done with the following command:
# cd zabbix-1.8.5
# cp misc/init.d/redhat/8.0/zabbix_* /etc/init.d/
This will copy zabbix_server and zabbix_agentd startup scripts.
# ls -l /etc/init.d/za*
-rw-r--r-- 1 root root 1718 May 27 14:39 /etc/init.d/zabbix_agentd
-rw-r--r-- 1 root root 1577 May 27 14:39 /etc/init.d/zabbix_server
Now change the progdir= location in following files
# vi /etc/init.d/zabbix_server
progdir=”/usr/local/sbin/”
# vi /etc/init.d/zabbix_agentd
progdir=”/usr/local/sbin/”
# chmod 755 /etc/init.d/zabbix_server
# chmod 755 /etc/init.d/zabbix_agentd
# chkconfig --add zabbix_server
# chkconfig --add zabbix_agentd
# chkconfig --list zabbix_server
zabbix_server 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig zabbix_server on
# chkconfig --list zabbix_server
zabbix_server 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# chkconfig --list zabbix_agentd
zabbix_agentd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig zabbix_agentd on
# chkconfig --list zabbix_agentd
zabbix_agentd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Now start the services
# /etc/init.d/zabbix_agentd start
Starting zabbix_agentd: [ OK ]
# /etc/init.d/zabbix_server start
Starting zabbix_server: [ OK ]
Check service is running and it bind with correct port
# ps -C zabbix_agentd
PID TTY TIME CMD
26224 ? 00:00:00 zabbix_agentd
26226 ? 00:00:00 zabbix_agentd
26227 ? 00:00:00 zabbix_agentd
26228 ? 00:00:00 zabbix_agentd
26229 ? 00:00:00 zabbix_agentd
26230 ? 00:00:00 zabbix_agentd
# netstat -ntpl
Installing the Web frontend
# yum install php-mysql php-gd php-bcmath php-mbstring php-xml
Once installed its time to copy the web files to the correct folder, with CentOS and Apache this would be /var/www/html/.
# cp -r frontends/php/ /var/www/html/
To make the page access able through http://localhost/zabbix we will have to to rename the folder to zabbix.
# cd /var/www/html
# mv php zabbix
Add alias in apache by editing configuration file
# vi /etc/httpd/conf/httpd.conf
Alias /zabbix /var/www/html/zabbix
<Directory /var/www/html/zabbix/>
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
Now make some changes in php.ini file to set time zone and other parameter. Most Likely Zabbix won't agree with all of your settings and will tell you to change them to the required settings.
# vi /etc/php.ini
max_execution_time = 300
date.timezone =Asia/Calcutta
memory_limit = 256M
max_input_time = 600
post_max_size = 32M
max_execution_time = 600
# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
For other time zone use following link:-
Now it's time to fire up a browser and navigate to Zabbix's address:
http://<server_ip_or_name>/zabbix.
Now follow the instruction on screen .
Most Likely Zabbix won't agree with all of your settings and will tell you to change them to the requiered settings. after changes in php.ini you should reload or restart appache server
useing command
# server httpd restart
and the try again
In Configure DB Connection Windows type zabbix as user name and password. and then click test connection.
In summary page verify all settings and then click Next.
In Configuration file check window download the configuration file and save that downloaded file to the location given and click retry. it become green then click next. at the last you will get following screen for authentication.
Now login as admin with password zabbix