Making Zabbix Monitoring Server from Scratch: The Dummies Manual
“ 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.
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



















note that since zabbix 1.6 default password is not blank, it’s ‘zabbix’
r
January 4, 2010 at 5:54 pm
Thanks for the update..
Missed to update it according the new version
Nitish Kumar
January 4, 2010 at 8:03 pm
[...] 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 [...]
Zabbix Server: Some issues and some tips « Nitish Kumar's Blog
January 7, 2010 at 2:04 pm
[...] wrote about Zabbix Installation for Layman sometimes back and really recommended it for all system administrators out there, due to its [...]
Zabbix: Really frustrating me now « Nitish Kumar's Blog
January 28, 2010 at 11:52 am
[...] 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 [...]
Zabbix 1.8 Network Monitoring Book from Packt Publication « Nitish Kumar's Blog
April 15, 2010 at 2:04 am
[...] 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 [...]
Zabbix Monitoring-Simplest becomes more simpler « Nitish Kumar's Blog
April 24, 2010 at 2:04 am
[...] 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 [...]
SpiceWorks IT Desktop: IT Management for Dummies « Nitish Kumar's Blog
April 24, 2010 at 4:42 pm
“zabbix” pw did not work. is default password something else. Shall I redo the instalation.
showbiz
June 4, 2010 at 11:56 pm
“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
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
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
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
[...] 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. [...]
Restricting Browsing with Mozilla Firefox for Business Scenario « Nitish Kumar's Blog
June 25, 2010 at 2:54 am
thanks for ur script
herupriadi
June 30, 2010 at 10:29 am
[...] 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 [...]
How to install Zabbix on CentOS !!!
October 25, 2010 at 12:58 pm
Thanks for your information !
456@hotmail.com
December 4, 2010 at 6:59 am
Always welcome
Nitish Kumar
December 4, 2010 at 12:29 pm
Excellent!
Dário
March 12, 2011 at 12:54 am
Thanks
Nitish Kumar
March 12, 2011 at 1:08 am
[...] source Author: WladyX on 3 May, 2011 Category: Zabbix Older: KDE disable kmix tray icon [...]
Zabbix remote command « Linux T&T
May 3, 2011 at 1:34 pm
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
Any firewall running?
Nitish Kumar
July 7, 2011 at 11:16 am
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
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
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
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
I appreciate your web page! Handy content dealing with dwi charges in minnesota, thanks so much
for sharing with us.
Harris County Texas DUI Attorneys
October 31, 2012 at 10:59 pm
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
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