“ 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’
Thanks for the update..
Missed to update it according the new version
“zabbix” pw did not work. is default password something else. Shall I redo the instalation.
“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”.
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.
awsome..ur articles is cool.
thx gan
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
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. 🙂
thanks for ur script
Thanks for your information !
Always welcome
Excellent!
Thanks
Thanks so much! But the command “typeperf –qx | find “Network” >c:\network.txt” produces a blank network.txt file on my XP Professional laptop.
Any firewall running?
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!
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
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_
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)
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
I appreciate your web page! Handy content dealing with dwi charges in minnesota, thanks so much
for sharing with us.
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 😉
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
Heya i am for the first time here. I came across this board and I find It truly helpful & it helped me out
much. I hope to present something back and aid others such as you helped me.
Welcome
nitish, how about deleting all the spam comments – like all the ones since august 2012 ? 🙂
somehow i don’t think “Harris County Texas DUI Attorneys” or “hard knight pills” are really that thankful for this post…
Great info. Lucky me I came across your site by chance (stumbleupon).
I have saved as a favorite for later!
Thank you a lot for sharing this with all folks you actually know
what you’re talking about! Bookmarked. Please additionally visit my site =).
We will have a hyperlink exchange arrangement between us
Hi my loved one! I wish to say that thiis article
is awesome, nice written and comne with approximately all
important infos. I’d like tto look mmore posts like this .
This comic app allows you access to over 3,500 comics. But, Folder Lock allows the users to lock and hide their pictures, videos, documents, cards,
contacts and anything you wish to hide. Android will beat the Apple’s i – OS soon, a report says.
Je poste ce petit com simplement pour féliciter son auteur
Hummm êtes vous certain de ce que vous nous écrivez ?
each time i used to read smaller articles or reviews that as well clear their motive, and that is also happening with this
piece of writing which I am reading at this time.
I like the valuable info you provide in your articles. I will bookmark your weblog and check once more right here regularly.
I am moderately certain I’ll be informed lots of new stuff proper right here!
Best of luck for the next!
What’s up, after reading this remarkable piece of writing i am as
well happy to share my familiarity here with friends.
Fascinating blog! Is your theme custom made or did you download it from somewhere?
A design likke yourfs with a few simple tweeks would
really make my blog stand out.Please let mee know where
you got your design. Kudos
Thank you ffor the good writeup. It in fact was
a amusement account it. Look advanced to far added agreeable from you!
However, how can we communicate?
After I originally left a comment I appear to have clicked on the -Notify me whn new comments are added- checkbox and from
now on whenever a comment is added I get four emails with
the sazme comment. There has tto be a means
you are able to emove me from that service?
Thanks!
Because the admin of this web page is working, nno question very
shortly it will be famous, due to its quality contents.
Wonderful beat ! I would like to apprentice even as you amejd your website,
how could i subscribe for a weblog website?
The account aided me a acceptable deal. I were tiny bit
acquainted of this your broadcast provided bright clear concept
Јe suiѕ venu suг ton ppost paar hasard puis je ne le regtette point !!
WOW just what I was searching for. Came here by searching for free games for android
Genuinely when someone doesn’t understand then its up to other people that they will assist, so here it happens.
Wow that was unusual. I just wrote an really long
comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyways,
just wanted to say superb blog!
Hi! I know this is kind of off topic but I was wondering
if you knew where I could locate a captcha plugin for my comment form?
I’m using the same blog platform as yours and I’m having
problems finding one? Thanks a lot!
Je vais te dirе quee ce n’est pas faux !!!
C’est un vrɑі bonheur de parcouriг сe sitе web
Voսs écrivez sns cesse des postes fascinants
You actually make it appear so easy with your presentation but
I find this topic to be really something which I believe I’d never understand.
It seems too complicated and very broad for me.
I’m taking a look forward for your next publish, I will attempt to get the hold of it!
Link exchange is nothing else however it is simply placing
the other person’s webpage link on your page at suitable place and other person will also
do same for you.
Jе vais tee dire que cee n’est guère inexact !!
Jе vais ɗire que cе n’est pas inexact …
Bon, je n’ai guère terminé de rearder ρar contre je reviendrai ce soir
Bon, je n’ɑi pas eu l’occasion de fnir de regardrer tutefoiѕ je гepasserai dahs la semaine
This webb site definitely has all the information I wanted concerning
this subject and didn’t know who to ask.
What’s up to every one, it’s genuinely a nice for me to go to see this web page, it contains
helpful Information.
We’re a group of volunteers and opening a new scheme in our
community. Your site offered us with helpful information to work on. You have performed an impressive
process and our whole community will be thankful to you.
I’m Al B. Sure Introducing My Music Marketing brought to you by me and my buddy
Marc Alex Cool. Have your music sold on top MP3 Download Vendor Sites.
Yes, now you too can quickly and easily create a digital release for distribution to sites like ITunes, Spotify,
Amazon, Radio, Beats and dozens more. You keep 100% of
your rights and royalties. Order now for just $14.95 and we’ll throw in a Music Showcase link regularly
$9.95 a month.