Thursday 18 April 2013

Zabbix Installation on RHEL/CentOS 6 Linux Server



These are my instructions for installing Zabbix 2.0.x on CentOS6 using the ZabbixZone repository. I have opted to use MySQL.

Server Install

Configure the ZabbixZone package repository and GPG key
# rpm --import http://repo.zabbixzone.com/centos/RPM-GPG-KEY-zabbixzone
# rpm -Uv http://repo.zabbixzone.com/centos/zabbixzone-release-0.0-1.noarch.rpm
Install the necesarry server packages (and agent, since you'll want to monitor your server too, right?)
# yum install mysql-server zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
edit timezone in /etc/httpd/conf.d/zabbix to read this, or your own time zone:
php_value date.timezone Europe/London
Restart the httpd
# service httpd start

Database

Start MySQL Database Server and secure
# service mysqld start
# mysql_secure_installation
# mysql -u root -p
In the MySQL console:
mysql> create database zabbix character set utf8;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'password';
mysql> flush privileges;
Back in the shell we load the Zabbix SQL in the database we just created:
# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.0.2/create/schema.sql
# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.0.2/create/images.sql
# mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.0.2/create/data.sql

Zabbix Server

edit /etc/zabbix/zabbix_server.conf to set up zabbix database users' password
vim /etc/zabbix/zabbix_server.conf
Edit the below lines
-------------------------
DBUser=zabbix
DBPassword=password
DBPort=3306
Start the zabbix-server process
# service zabbix-server start
http://serverurl/zabbix

Java Gateway

The Java gateway service is used for JMX monitoring of servers like JBoss, Tomcat, Weblogic or Websphere.
We need to specify the address of the gateway in the zabbix server config (/etc/zabbix/zabbix-server.conf or zabbix-proxy.conf):
JavaGateway=10.150.164.214
StartJavaPollers=5

Start on Reboot

# chkconfig zabbix-server on
# chkconfig mysqld on
# chkconfig httpd on
# chkconfig zabbix-java-gateway on

Agent Install

Linux

#rpm --import http://repo.zabbixzone.com/centos/RPM-GPG-KEY-zabbixzone
#rpm -Uv http://repo.zabbixzone.com/centos/zabbixzone-release-0.0-1.noarch.rpm
 #yum install zabbix-agent -y
#chkconfig zabbix-agent on
#mv /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.default
#sed 's/Server=127.0.0.1/Server=10.150.164.214/' /etc/zabbix/zabbix_agentd.default > /etc/zabbix/zabbix_agentd.conf
#service zabbix-agent start