Search Windows and Linux Networking

Tuesday, April 12, 2011

Installing Zabbix (Monitoring tool ) on Ubuntu 10.10


How to install Zabbix on ubuntu 10.10


Important of monitoring system :- Suppose you have many web servers that users frequently access for update your data. Everything are working on one morning when auditing are going on you company and users complete that web server is not working. To figure out the problem you may be first check router is working or not , are you able to ping web server or not and so on. And suppose your router is working ok and web server is also given reply. Then you check is it web server is running or not . If it running then you check backend of web server Database server is working or not by ping to database server but you are not able to ping database server then you will check cable is properly plug to database server and also switch and till are you not able to ping then you may be check services working or not and you find out that some service not started on database server so you may try to manually start services but if fail to start because of  IP address. Then you may check IP address but found that server not having valid IP address received from DHCP server then you fix the problem on DHCP server and after that everything come online. In between when you are trying to find out the problem every time many users will disturbing you because audit are going on it will very hearting.

    And if you have any monitoring tool like Nagios or Zabbix that will told where and when the problem is and send email or SMS on your mobile . you will know that DHCP server is down. On your mail box or mobile phone before user may know you will fix the problem and user not able to know web server was have problem because you have already fix the problem before users complaint you about web server is not working .

Zabbix and Nagios are Open source Monitoring tool . It monitor all your network infrastructure like Network, Servers, Routers, switches , services ,eg fpt, mail, exchange. It also real time graph . if something goes wrong like server down, or service fail to start it send a mail or SMS notify to saying that this server or router, switch is down or this service fail to start on this these server.  this will reduce your time to find out the problem. Zabbix and Nagios are both are very good open source software. As compare Nagios Zabbix is easy to install and configure so For now I will show you how to install Zabbix on Ubuntu 10.10 Desktop.

For More infromation about Nagios and zabbix find out the following links for your ref.


Nagios:-
http://en.wikipedia.org/wiki/Nagios
http://www.nagios.org/

Zabbix:-
http://www.zabbix.com/wiki/start
http://en.wikipedia.org/wiki/Zabbix

Install pre-requisites:
Apache MySQL-Server PHP5 Net-Snmp libraries Curl libraries
 
sudo apt-get install build-essential mysql-server libmysqlclient15-dev
sudo apt-get install php5 php5-gd php5-mysql 
sudo apt-get install snmp libsnmp-dev snmpd 
sudo apt-get install libcurl4-openssl-dev fping libiksemel3 libiksemel-dev

Setup the zabbix user:
 
sudo adduser zabbix

enter in the password "zabbix" without the quotes and confirm choice

Add the ser zabbix to the admin group:
 
sudo adduser zabbix admin

Switch to the zabbix user, dowload and extract source:
 
su - zabbix
 
Download zabbix-q.g.1.tar.gz from link  
wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Development/1.9.1/zabbix-1.9.1.tar.gz
 
 
tar zxvpf zabbix-1.9.1.tar.gz


Create zabbix database and set permissions:
 
sudo mysql -e"create database zabbix;"
sudo mysql -e"grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"

Populate the database (the order you do this matters):
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/schema/mysql.sql
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/data/images_mysql.sql
 
mysql -D zabbix -uzabbix -pzabbix < /home/zabbix/zabbix-1.9.1/create/data/data.sql

Configure, compile and install the server:
 
cd zabbix-1.9.1/
 
./configure --prefix=/usr --with-mysql --with-net-snmp --with-libcurl --with-jabber=/usr/ --enable-server --enable-agent
 
make
 
sudo make install

Setup the rest of the system:
Configure services:

sudo vi /etc/services

Add the following to the end:
 
zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

Save and exit.
 
sudo mkdir /etc/zabbix
sudo chown -R zabbix.zabbix /etc/zabbix/
cp misc/conf/zabbix_* /etc/zabbix/
Edit the server configuration file:
sudo vi /etc/zabbix/zabbix_server.conf

Set these two lines as shown ( uncomment DBPassword ):
DBUser=zabbix
DBPassword=zabbix

Save and exit.

Copy the init scripts:
sudo cp misc/init.d/debian/zabbix-server /etc/init.d
sudo cp misc/init.d/debian/zabbix-agent /etc/init.d

Edit the server init script:
 
sudo vi /etc/init.d/zabbix-server
Change the line:
DAEMON=/usr/local/sbin/${NAME}
So it reads (remove the /local):
DAEMON=/usr/sbin/${NAME}
Edit the agent init script:
sudo vi /etc/init.d/zabbix-agent
Change the line:
DAEMON=/usr/local/sbin/${NAME}
So it reads (remove the /local):
DAEMON=/usr/sbin/${NAME}

Set the correct permissions on the init scripts and set to start at boot:
 
o chmod 755 /etc/init.d/zabbix-agent
sudo sudo chmod 755 /etc/init.d/zabbix-serversudo update-rc.d zabbix-server defaultssudupdate-rc.d zabbix-agent defaults

Start the server and agent:
sudo /etc/init.d/zabbix-server start
sudo /etc/init.d/zabbix-agent start

See if they are running:
ps -aux | grep zabbix

You should see zabbix-server and zabbix-agent multiple times if everything went ok.

Configure the web interface:
 
mkdir /home/zabbix/public_html
cp -R frontends/php/* /home/zabbix/public_html/

edit the apache configuration:
sudo vi /etc/apache2/sites-enabled/000-default
And add this below the last Directory item:
 
Alias /zabbix /home/zabbix/public_html/
<Directory /home/zabbix/public_html>
  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>

Save the file and exist

Restart Appache2 Server to apply chanages

sudo /etc/init.d/appache2 restart

If Appache2 server started without any error then Point your web browser to your server IP/zabbix:

http://localhost/zabbix

Complete the install wizard:

1. Introduction
read and click Next
2. License Agreement
Read, check 'I Agree', click Next
3. Check of Pre-Requisites
Fix any problems, click retry. Click Next when all pre-requisites are OK.
(if it any test fail for PHP then make changes to /etc/php5/php.ini after change restart appache2 to take effect)
4. Configure DB Connection
Enter appropriate settings and click Test Connection. (In User Name and password type zabbix ) Click Next when OK.
5. Pre-Installation Summary
Verify installation settings, click Next.
6. Install
Click Save Configuration file and save to machine. Copy zabbix.conf.php to /home/zabbix/public_html/conf/zabbix.conf.php

Login with user "admin" and password zabbix"

1 comment:

  1. Software requirements:-

    GCC
    Automake
    MySQL
    zlib-devel
    mysql-devel (for MySQL support)
    glibc-devel
    curl-devel (for web monitoring)
    libidn-devel (curl-devel might depend on it)
    openssl-devel (curl-devel might depend on it)
    net-snmp-devel (for SNMP support)
    popt-devel (net-snmp-devel might depend on it)
    rpm-devel (net-snmp-devel might depend on it)
    OpenIPMI-devel (for IPMI support)
    libssh2-devel (for direct SSH checks)

    ReplyDelete