Nitish Kumar's Blog

Layman's take on technology | Doesn't need to have a super brain | Just do your bit

Making Zabbix Monitoring Server from Scratch: The Dummies Manual

with 31 comments


Update: Wrote this post long back.. just was meant to show that how easy it could be…many things needs to be Add to Google Buzzupdated in reference to new features and UI.. will update soon. Recently I received a book over Zabbix from Packt Publicing. Amazing book and probably the only available for the same. Worth buying….

“ How we system administrators work in case of any trouble? If something goes down or anything wrong would have happened and we get asked about how it happened? We just run into logs or try to guess what would have been happened, was it high CPU, low disk space or tremendous network traffic? Sometimes we get our answers, sometime not and we keep on saying ourselves that we can’t be everywhere to monitor each and everything all the time. But it’s the time to update yourself and get optimized. I went through a few of monitoring solutions and with their pros and cons, finally I got settled with the Open Source Solution developed by Zabbix SIA. ”

 

What is Zabbix? Before the configuration and installation part, I am starting with a little history.zabbix1_thumb Zabbix is a network management system application created by Alexei Vladishev in 1998 (public release in 2001) to monitor and track the status of various network services, servers, and other network hardware. Zabbix uses MySQL, PostgreSQL, SQLite or Oracle to store data. Its backend is written in C and the web frontend is written in PHP and javascript.

Zabbix offers several monitoring options. Simple checks can verify the availability and responsiveness of standard services such as SMTP or HTTP without installing any software on the monitored host. A Zabbix agent can also be installed on UNIX and Windows hosts to monitor statistics such as CPU load, network utilization, disk space, etc. As an alternative to installing an agent on hosts, Zabbix includes support for monitoring via SNMP, TCP and ICMP checks, IPMI and custom parameters. Zabbix supports a variety of real-time notification mechanisms, including XMPP.



Installation and Configuration to monitor Windows\ Linux Servers:

Although I tried and found it extremely efficient , but even then I didn’t went along with the wonderful easy install procedure made by Brendon Baumgartner, not due to some fault in that one, but due to inherent problems with I guess not stable yet latest version of zabbix. But I sure be waiting for BB to write other magic scripts in the same way to make things one Enter only.

Here comes the way, I followed to install zabbix in manual way over the servers.

Step by Step Implementations with details:

Base machine: As for most of Linux Development I choose, even here I am choosing CentOS as the base system to build the solution upon. One should go for at least CentOS 5.x as there are a few options not available with older CentOS 4.x. As per recommendation for CentOS, machine should have at least 512 MB RAM and decent processor, LAN card etc. and although not kind of requirement but the machine should has ample space in it to store logs for as many days.

As usually I do, installation was customized with 1GB swap, 200 MB of boot partition, all PHP/ MySQL related packages checked, all libraries checked, SendMail package checked. In next, as the installation will pull updates, packages from internet directly, so Ethernet configurations should be ready and internet should be working fine over the same machine. Also note that it would be around 27-28 mb download size in total while installation.

Pre-requisites for the installation:

First of all, we need to finish installation/ update of all required packages in reference with zabbix installation.

yum install httpd php mysql mysql-server mysql-devel php-gd php-mysql php-bcmath gcc net-snmp net-snmp-libs net-snmp-utils net-snmp-devel curl-devel

Once finished with this, one need to check whether the crucial components are configured to start with the system and are working well.

# service httpd start
# chkconfig –add httpd
# chkconfig httpd on
# service mysqld start
# chkconfig –add mysqld
# chkconfig mysqld on

Possible issues and resolutions first:

Need to check whether things are working fine.

# mysql –u root

This should leave one to MySQL prompt, if not then need to check. In next, need to check whether httpd is working fine (Apache is properly installed and configured). Type the IP Address of the target Zabbix Installation Server in browser from some other computer, if you are able to see Apache page, then its fine otherwise you will be needed to check things like SELINUX.

How to check selinux status?

Execute the following command:

# sestatus

If its showing it enabled, then could disable it by

# setenforce 0

To permanently disabled the same, we need to do some editing in configuration file, otherwise it will be back with the next boot

# vi /etc/selinux/config

The file must look like (after setting SELINUX=disabled)

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection.
SELINUXTYPE=targeted

Check if the browser started opening apache page after this, if yes, then we are done, otherwise should look down in /var/log/httpd/error.log for other possible reasons.

Installation and configuration steps:

Here I am assuming that you are using CentOS 5.x as base, otherwise the configurations might be altered.

# cd /usr/src
#wget
http://internap.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.4.5.tar.gz
# tar zxf zabbix-1.4.5.tar.gz
# cd zabbix-1.4.5
# mysql -u root
# mysql> create database zabbix;
# mysql> quit
# cat create/schema/mysql.sql | mysql -u root zabbix
# cat create/data/data.sql | mysql -u root zabbix
# cat create/data/images_mysql.sql | mysql -u root zabbix
# ./configure –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl
# make install
# mkdir /etc/zabbix
# cp misc/conf/* /etc/zabbix
# groupadd zabbix
# useradd -g zabbix zabbix
# chown zabbix:zabbix /usr/local/sbin/zabbix*
# cp misc/init.d/redhat/8.0/zabbix* /etc/init.d
# vi /etc/init.d/zabbix_agentd

change BASEDIR=/opt/zabbix to BASEDIR=/usr/local/sbin

change FULLPATH=$BASEDIR/bin/$BINARY_NAME to FULLPATH=$BASEDIR/$BINARY_NAME

# vi /etc/init.d/zabbix_server

Make the same changes as above.

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

Now, installing the web application….

# mkdir /var/www/html/zabbix
# cp -R frontends/php/* /var/www/html/zabbix
# chown apache:apache /var/www/html/zabbix/conf
# vi /etc/php.ini

Find resource limits section and change max_execution_time to 300

;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;;

max_execution_time = 300 ; Maximum execution time of each script, in seconds

Also make changes for date.timezone entry, it should be commented, uncomment it and set it accordingly like in case of India ..

date.timezone=ASIA/CALCUTTA

At the end, start zabbix services

# service zabbix_server start
# service zabbix_agentd start

Add zabbix ports to be listened to the configuration of services.

# vi /etc/services

And put the following two lines at the very end of the file.

zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

Zabbix Server console installation is ready to and web installation is ready to go from here.

After finishing all the above steps, now go to url http://IP_ADDRESS/zabbix (Here IP_ADDRESS is what you have given to the server Ethernet port)

It should ask for installation steps, if you have followed my steps exactly, then it must go like next, next only. After finishing all the steps, you will get a login prompt, user name will be admin here and password is blank. After login, go to profile link and change the password to whatever suits to you. Logout and login again. Click monitoring and then go to screens in second row. You should get five screens on the same page for the zabbix server itself. One screen must be having map only. Check that rest all showing you graphs or not. If yes, then server side work is done and you are ready to move towards adding clients.

Zabbix Agent Installation over Linux Clients:

First part is to download the appropriate zabbix agent package from the official page. I assume, your clients (Servers to monitor) are updated and have kernel at least 2.6.x (If not then choose the suitable package).

# yum install net-snmp net-snmp-libs net-snmp-utils net-snmp-devel curl-devel (Optional)
# groupadd zabbix
# useradd -g zabbix zabbix
# cd /usr/src
#wget
http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/1.8/zabbix-1.8.tar.gz/download
# tar zxvf zabbix-1.8.tar.gz
# cd zabbix-1.8
# chmod 7555 *
# ./configure -enable-agent -with-mysql -with-net-snmp -with-libcurl
# make install
# chown zabbix:zabbix /usr/local/sbin/zabbix*
# mkdir /etc/zabbix
# cp misc/conf/* /etc/zabbix
# cp misc/init.d/redhat/8.0/* /etc/init.d
# chmod +x /etc/init.d/zabbix_*

Now, Change the binary location to /usr/local/sbin

# vi /etc/init.d/zabbix_agentd

In next, make the zabbix agent point to your Zabbix Server by putting Server’s IP Address in configuration file of agent

# vi /etc/zabbix/zabbix_agentd.conf

And as final step on client side, set up the services

# chkconfig –add zabbix_agentd
# chkconfig –level 3 zabbix_agentd on
# service zabbix_agentd start

Getting the graphs from data coming from agents:

You will see that Zabbix Server itself added in the WebUI. In place of creating a new monitoring scenario, first it’s easier to copy the same entries to the newly added Linux Servers.

Go to Hosts, create a new host with the name of your agent (whatever name you choose), select group as Linux Server, then put the right IP Address and set the tab below to it on IP Address and save.

After this, go to Items, from combo box at right top, select zabbix server, it will show up items already configured for zabbix server, you need to select all the items and press copy selected items to button at the bottom and then when it will show the list of all templates and hosts configured, choose the one, you just created.

From here, you have setup items to fetch data from agent, now how to use it. Go to graphs, from right top select zabbix server and copy all the graphs to newly created server. Graphs are ready from here.

Finally, make a screen to monitor. Make a screen of 2×2 and give it the name as per your choice. Once screen created, click edit. Then configure CPU Loads, CPU Utilization, Disk Space and Network Utilization graphs for the agent, you setup and you are ready to monitor your Linux Server.

Zabbix Agent Installation over Windows Clients:

I find Windows Installation easier in first part and little bit complicated in second part. First need to download the windows agent from here

http://www.zabbix.com/downloads/1.8/zabbix_agents_1.8.win.zip

Then install it and it will ask for server IP Address, give zabbix server’s IP Address. Now, go to WebUI of Zabbix Server, Create host/items/graphs/screens in similar ways and you are ready to go.

There are many features that are there in Linux Agent but nowhere in Windows one. One workaround is to use data fetched from Windows Performance Monitor (permon.exe).

For example: Network Utilization

Go to cmd, type typeperf –qx |find “Network” >c:\network.txt

Now, check the network.txt file created in C: drive, it would be containing the exact network resource/ variable name for bytes sent and bytes received.

Now, how to call it?

Go to C:\program files\zabbix agent\zabbix_agentd.conf

Add something like following lines at the end…

PerfCounter= Server1NetIn,"\Network Interface(Intel Pro Server Adapter)\Bytes Received/sec",60
PerfCounter= Server1NetOut,"\Network Interface(Intel Pro Server Adapter)\Bytes Sent/sec",60

Note that the value placed in inverted commas is exactly the same, which you must have obtained from that network.txt file. Restart the Zabbix Service from services.msc. Now, go to Zabbix Server WebUI, create an item in target Windows Server area with any name for Network and put Server1NetIn or Server1NetOut as key. Save item and you are ready to use it in your graphs :)

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

About these ads

Written by Nitish Kumar

January 3, 2010 at 12:07 pm

31 Responses

Subscribe to comments with RSS.

  1. note that since zabbix 1.6 default password is not blank, it’s ‘zabbix’

    r

    January 4, 2010 at 5:54 pm

  2. Thanks for the update..
    Missed to update it according the new version

    Nitish Kumar

    January 4, 2010 at 8:03 pm

  3. [...] addition to the implementation details, I wrote few days back, I would like the add up some precautions and resolution to some issues, which would [...]

  4. [...] wrote about Zabbix Installation for Layman sometimes back and really recommended it for all system administrators out there, due to its [...]

  5. [...] when I was contacted by Sandeep Patil from Packt Publications to take a look over their book over Zabbix. I have seen the book earlier and was already knowing that its one of the biggest book on the [...]

  6. [...] already have recommended Zabbix as complete monitoring solution and even wrote a dummies manual about deployment of the same on your Windows/ Linux workstations and Servers. Once I even been complaining about the complexity [...]

  7. [...] and is written in Ruby on Rails, Its not a complete and detailed Monitoring Solution like Zabbix (I already wrote about), but for me it covers another other aspects of your IT management in a powerful way like [...]

  8. “zabbix” pw did not work. is default password something else. Shall I redo the instalation.

    showbiz

    June 4, 2010 at 11:56 pm

  9. “zabbix” is the default password since zabbix 1.6, in 1.4 and before it was empty. so anything recent (like 1.8) should have “zabbix” as the default password. what you could try, uppercase “A” in username – “Admin”.

    Richlv

    June 5, 2010 at 12:41 am

  10. You can go through the official link that is
    http://www.zabbix.com/wiki/howto/install/ubuntu/ubuntuinstall

    If you are using the new version then username should be “Admin” and Password should be “zabbix“.

    In case, you could have forgotten password, then at one place, its suggested that the following could be used on MySql prompt
    update users set passwd=encrypt(‘My_New_Password’) where alias=’Admin’;

    Or if you are using PHPMyAdmin or anything like that then I have noticed that most of the open source are using MD5 for encryption, so what you might need to do is
    mysql> select userid, alias, name, passwd from users;

    That will give you an encrypted HASH and you could find some MD5 encrypter from web to encrypt your given password to generate a new hash. now you just need to place this new hash at the same place.

    Though I don’t think you will be needed all this, but putting this for reference if someone else needed the same.

    Nitish Kumar

    June 5, 2010 at 6:01 am

  11. awsome..ur articles is cool.
    thx gan

    ipangsan

    June 17, 2010 at 2:49 pm

    • Hi,
      This article is to good dude….
      I need u r help for execution of remote command from zabbix server to monitoring server through action….

      Thanks
      sachin

      sachin

      June 22, 2010 at 11:47 am

  12. Giving you an example that how that thing could be done.

    Navigate to Configuration | Actions,
    click Create Action.
    In the Name field, enter Restart Apache.

    Click the New button in the Action conditions block. In the New condition block that just appeared, choose Host in the first dropdown, then click on Select button. In the pop up, choose Linux servers in the Group dropdown, then click on Another Host. Click Add button.

    Let’s create another condition—again, click the New button in the Action conditions block. In the New condition block, in the first dropdown leave dropdowns to the defaults, Trigger description and like respectively.

    In the input field next to them enter WEB service is down, then click on Add.

    Now to the operations. In the Action operations block click on New. In the Edit operation block that just appeared, choose Remote command in the Operation type field. That presents us with a single textbox. Remote actions are to be entered here, with the syntax hostname:command.

    Let’s change the contents of this field now to:
    {HOSTNAME}:sudo /etc/init.d/apache2 restart

    This is a simplest example of monitoring apache status and restarting it, if failed in any case.

    Hope it help. :)

    Nitish Kumar

    June 22, 2010 at 12:03 pm

  13. [...] I have already written a number of dummies posts about some of the important elements related to System administration in corporate scenario like Windows Deployment Services, robust, systematic yet simplest approach over Squid Proxy Server and it reporting and Zabbix Mentoring Server. [...]

  14. thanks for ur script

    herupriadi

    June 30, 2010 at 10:29 am

  15. [...] have been installed "zabbix-1.6.4.tar.gz", make step by step as this link (referenced to http://nitishkumar.net/2010/01/03/za…for-corporate/) I thought the version zabbix-1.4.5.tar.gz different zabbix-1.6.4.tar.gz at this install step, so i [...]

  16. Thanks for your information !

    456@hotmail.com

    December 4, 2010 at 6:59 am

  17. Excellent!

    Dário

    March 12, 2011 at 12:54 am

  18. [...] source Author: WladyX on 3 May, 2011 Category: Zabbix Older: KDE disable kmix tray icon [...]

  19. Thanks so much! But the command “typeperf –qx | find “Network” >c:\network.txt” produces a blank network.txt file on my XP Professional laptop.

    Andrew

    July 7, 2011 at 7:03 am

  20. I have installed version 1.8.8 on a Fedora 15 box. After a restart, I always have to restart the Zabbix Server service in order for the web front end to show ‘Zabbix Server is running’ = Yes. Any ideas?
    Thanks in advance!

    Wade

    November 10, 2011 at 8:40 pm

  21. hi nitish, I installed the Zabbix Server in Cent box and its running well. I tried connecting one the Win 2008 R2 server as agent, but in hosts its shows in red “Get value from agent failed: ZBX_TCP_READ() failed: [104] Connection reset by peer”. could not fix it. so thought I can add a linux agent and started ur instructions steps as above, but am stuck up in # make install. it states “make: *** No rule to make target `install’. Stop.” can u plz help me out. am just a newbie, so plz be in detail. thanks

    hariharan

    November 21, 2011 at 10:01 pm

    • Try the short method link i gave in post that should do it. Instructions are old now as new versions are out

      Regards Nitish Kumar @nkumar_

      Nitish Kumar

      November 21, 2011 at 10:15 pm

  22. Hi Nitish,
    I want to monitor ping like we do normaly and it should mail me the that if fails and second thing
    can we monitor RAID array(HDD and other things)

    Santosh

    August 22, 2012 at 1:33 am

  23. Thanks for sharing some great advice, thanks for sharing and making it simple enough for anyone to be able to understand!
    It will help me write my Custom writing service

    essay

    August 28, 2012 at 9:28 am

  24. I appreciate your web page! Handy content dealing with dwi charges in minnesota, thanks so much
    for sharing with us.

  25. I would like to thank you for the efforts you have put in writing this website.

    I really hope to see the same high-grade blog posts by you later on as well.
    In truth, your creative writing abilities has inspired me to get my own, personal
    site now ;)

    sinwindows.wordpress.com

    February 14, 2013 at 9:26 pm

  26. I really was basically searching for recommendations for my personal blog site and found ur post,
    “Making Zabbix Monitoring Server from Scratch: The Dummies Manual
    Nitish Kumar’s Blog”, do you mind in the event that I really use some of your own suggestions? Thx ,Vaughn

    Patti

    February 19, 2013 at 3:05 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,329 other followers

%d bloggers like this: