Zabbix configuration at CO office of Grmtech

Zabbix is a distributed monitoring solution to monitor servers and applications of an enterprise.

Following are the steps of configuration of Zabbix Server at Grmtech’s CO office monitoring server:-
1. Download zabbix source files.

cd /usr/src/
tar -xzf /usr/src/zabbix-1.6.2.tar.gz -C /gt/fsrvthis/

2. Create zabbix database and import the database structure, default templates and other database configurations provided with zabbix source.

mysql -u root -p
create database zabbix;
cd /gt/fsrvthis/zabbix-1.6.2/create/schema/
mysql -u root –force zabbix –password=passwd <mysql.sql
cd /gt/fsrvthis/zabbix-1.6.2/create/data
mysql -u root –force zabbix –password=passwd < data.sql
mysql -u root –force zabbix –password=passwd < images_mysql.sql

3. Compile and build zabbix source files.

cd /gt/fsrvthis/zabbix-1.6.2/
./configure –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl
make install

4. Configure zabbix server and agent settings

mkdir /etc/zabbix
cp /gt/fsrvthis/zabbix-1.6.2/misc/conf/zabbix_server.conf
Set DBPassword=passwd in /etc/zabbix/zabbix_server.conf
cp /gt/fsrvthis/zabbix-1.6.2/misc/conf/zabbix_agentd.conf /etc/zabbix/

5. Create zabbix group and zabbix user. Set zabbix to run under zabbix user and zabbix group.

groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
passwd zabbix
chown zabbix:zabbix /usr/local/sbin/zabbix

6. Install Zabbix as a service

cp /gt/fsrvthis/zabbix-1.6.2/misc/init.d/redhat/8.0/zabbix* /etc/init.d/
chmod 755 /etc/init.d/zabbix*

In /etc/init.d/zabbix_agentd file set progdir=”/usr/local/sbin/”
In /etc/init.d/zabbix_server file set progdir=”/usr/local/sbin/”

7. Auto start the zabbix server and agent when server boots

chkconfig –-add zabbix_agentd
chkconfig –-add zabbix_server
chkconfig –-level 3 zabbix_server on
chkconfig –-level 3 zabbix_agentd on

8. Start and check zabbix server

service zabbix_server start
cat /tmp/zabbix_server.log

9. Do a simple test to see if the server is listening:

telnet localhost 10051

10. Start and check zabbix agentd

service zabbix_agentd start
cat /tmp/zabbix_agentd.log

11. Configure php.ini settings

max_execution_time = 300
memory_limit = 256M
date.timezone = America/Los_Angeles

12. Restart httpd server

service httpd restart

13. Install the web interface zabbix server

cp -r /gt/fsrvthis/zabbix-1.6.2/frontends/php/*    /var/www/html/

14. Open the url http://zabbix_server_ip_address/ in a browser and follow the steps installation
Edit and put the below given code in /var/www/html/conf/zabbix.conf.php

global $DB;
$DB[“SERVER”]= “localhost”;
$DB[“PORT”]= “0”;
$DB[“DATABASE”]= “zabbix”;
$DB[“USER”]= “root”;
$DB[“PASSWORD”]= “passwd”;
$ZBX_SERVER= “localhost”;
$ZBX_SERVER_PORT= “10051”;

15. Start zabbix server in distributed mode.

cd /usr/local/sbin
./zabbix_server -n 1

16. Login to zabbix web interface and manage the zabbix server.

Uid: Admin
Pwd: zabbix

Steps of configuring Zabbix agent at any machine to be monitored by Zabbix Server:-

1. Download zabbix source files.

cd /usr/src/
tar -xzf /usr/src/zabbix-1.6.2.tar.gz -C /gt/fsrvthis/

2. Create zabbix group and zabbix user.

groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
passwd zabbix

3. Compile and build zabbix source files.

cd /gt/fsrvthis/zabbix-1.6.2/
./configure –enable-agent
make install

4. Add the following lines to /etc/services:

zabbix_agent 10050/tcp
zabbix_trap 10051/tcp

5. Configure zabbix agent settings

mkdir /etc/zabbix
cp /gt/fsrvthis/zabbix-1.6.2/misc/conf/zabbix_agentd.conf /etc/zabbix/

6. edit /etc/zabbix/zabbix_agentd.conf and set Zabbix Server ipaddress and Zabbix server hostname. Both should resolve to each other.

7. Start zabbix agentd

cd /usr/local/sbin/

Helpful links:-      #Full setup commands with sample command output #Cut and Paste walkthrough of Zabbix installation on CentOS 5 #Zabbix Install Script for CentOS 5

For ./configure …. command following may be helpful:-
For “checking for main in -lcurl… no” error
yum remove curl*
yum remove libidn-devel-0.6.5-1.1
yum install curl*
yum install libidn-devel-0.6.5-1.1

2)For “error: Not found Curl library” or “curl-config not found”
yum remove curl*
yum install curl*

For “net-snmp” error :-
yum install net-snmp*


Make sure that php-gd, php-math, php-mysql is installed or else install latest updates of php by the following:-
yum install php*


if error “Can’t open jason object” is seen in /tmp/zabbix_agentd.log file, install php jason library [not yet solved. error is still coming]

Some important locations:
1. /usr/local/sbin contains zabbix_agent, zabbix_agentd, zabbix_get, zabbix_sender and zabbix_server daemon processes.
2. /etc/zabbix contains zabbix_agentd.conf and zabbix_server.conf where parameters for corresponding daemons can be set.
3. /tmp/ contains zabbix_agentd.log and zabbix_server.log files which logs all error entries from corresponding daemon processes.

Errors yet to be solved:-
1. Mysql, httpd, zabbix_server, zabbix_agentd do not auto start on boot
2. /tmp/zabbix_server.log has error: “Send list of active checks to [] failed: host [ZABBIX Server] not found”
3. /tmp/zabbix_agentd.log has error: Can’t open jason object
4. The application is located at /var/www/html. Change its location to a proper place in filesystem