Professional Documents
Culture Documents
HOWTO - Setup Zabbix Monitor
HOWTO - Setup Zabbix Monitor
t=24
VPS Hosting - VPS Media For Designers and Developers > Community
User Name User Name Remember Me?
Forums > VPS Setup
HOWTO: Setup Zabbix Monitor on CentOS Password Log in
05-02-2008, 08:13 PM #1
Hey guys,
So I thought I'd share with you a little project I've been working on. A few days ago I was asked to
install a health monitoring service on our provisioning server and VPS nodes. After some deliberation
and searching, I decided on Zabbix. Zabbix can monitor Windows and Linux (among others!) servers,
network devices, and applications. It also includes a notification system for email, IM and SMS. It's
also got a bunch of other neat stuff like performance graphs and real-time network status maps.
Another awesome feature is trending, which should help us analyze growth for budgetting new VPS
nodes. In other words, free disk space, cached memory, incoming/outgoing traffic, temperature and
active services can be monitored, processed, graphed, analyzed, and made look fancy for the big wigs.
Is that all? Hell no. Zabbix is also cake to install. I thought the manual was pretty straight-forward but
for clarity I have written my own revision for those of you planning to use this awesome software on a
CentOS VPS.
Ok, first of all, Zabbix runs a server that connects to a MySQL (also Oracle, PostgreSQL, SQLite)
database to store system health data. You then have to set up agents on each machine you wish to
monitor. For the sake of this HOWTO, I'll be installing server and agent on the same box.
First, if you're installing on a bare minimal version of Linux, such as the ones we offer, you're going to
need a few extras. First, lets update CentOS:
Code:
yum update
1 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
Code:
yum install gcc automake autoconf libtool make
Now we need to install the web server, php, mysql, and some other goodies that Zabbix depends on.
Code:
yum install php php-bcmath php-gd php-mysql httpd mysql mysql-server mysql-devel
You will also need Fping if monitoring more than one machine. Fping is a program to ping hosts in
parallel and acts as a heartbeat in Zabbix.
Code:
wget http://dag.wieers.com/rpm/packages/f...l5.rf.i386.rpm
We have one last thing to install, ntp (Network Time Protocol) which is very important because it
syncs the time between your devices in a multiple client environment.
Code:
yum install ntp
Code:
/etc/init.d/ntpd start
Next we need to create a user the server will run as. This will need to be repeated on any devices
running agent. Zabbix server is actually protected from being run under root.
Code:
useradd zabbix
Code:
2 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
wget http://downloads.sourceforge.net/zab...x-1.4.5.tar.gz
Code:
/etc/init.d/mysqld start
mysqladmin -u root password <password>
Now you need to connect to MySQL using the newly created root password, create a database and
assign a new user with privileges to the DB. I used 'zabbixuser' and 'zabbixpass' for the username and
password but you may want to change it to your own preference. Don't make it the same as your root
or DB login, since it will be stored in a plaintext file.
Code:
mysql -u root -p
Code:
cd zabbix-1.4.5
Code:
./configure -enable-server -prefix=/usr/local/zabbix -with-mysql -with-net-snmp -with
make install
make clean
Next, configure and install the agent. You will need to repeat this step on every unique host you install
the agent on (omitting the MySQL and Zabbix server setup).
Code:
./configure -enable-agent -prefix=/usr/local/zabbix
make install
3 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
Add the Zabbix server and agent ports to your /etc/services file.
Code:
echo 'zabbix_agent 10050/tcp' >> /etc/services
echo 'zabbix_trap 10051/tcp' >> /etc/services
REMEMBER: IF YOU HAVE IPTABLES TUNED ON YOU WILL NEED TO OPEN PORT 80, 10050,
& 10051
Copy the sample config files to /etc/zabbix for server and agentd.
Code:
mkdir /etc/zabbix
cp misc/conf/zabbix_agentd.conf /etc/zabbix
cp misc/conf/zabbix_server.conf /etc/zabbix
Change the DB login info and specify the correct socket using your favorite editor (mine is nano).
Don't forget to remove the #'s in front of the values that are being changed.
Code:
nano /etc/zabbix/zabbix_server.conf
Code:
DBUser=zabbixuser
BPassword=zabbixpass
DBSocket=/var/lib/mysql/mysql.sock
FpingLocation=/usr/sbin/fping
Add the server IP address and change the hostname. You will have to give each machine the agent is
installed on a unique hostname. If you are just installing on one machine you can leave 'localhost'.
Code:
nano /etc/zabbix/zabbix_agentd.conf
Code:
Server=127.0.0.1,YourServerIP
Hostname=EnterAUniqueHostNameForEachAgent
Code:
4 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
cp misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d/zabbix_agentd
cp misc/init.d/redhat/zabbix_server_ctl /etc/init.d/zabbix_server
In /etc/init.d/zabbix_agentd
Code:
BASEDIR=/usr/local/zabbix
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd
In /etc/init.d/zabbix_server:
Code:
BASEDIR=/usr/local/zabbix
ZABBIX_SUCKERD=$BASEDIR/sbin/zabbix_server
In /etc/init.d/zabbix_agentd (Note the # hash marks, they are necessary), add near the top, just
below #!/bin/sh:
Code:
# chkconfig: 345 95 95
# description: Zabbix Agentd
In /etc/init.d/zabbix_server (again, note the # Hash marks, they are required), add near the top, just
below #!/bin/sh:
Code:
# chkconfig: 345 95 95
# description: Zabbix Server
We are almost done. Now we need to set up automatic starting and stopping of certain services:
Code:
chkconfig --level 345 zabbix_server on
chkconfig --level 345 zabbix_agentd on
chkconfig --level 345 httpd on
chkconfig --level 345 mysqld on
/etc/init.d/iptables stop
Code:
5 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
cp -r frontends/php /var/www/html/zabbix
Edit /etc/php.ini and change the execution time and timezone. Make sure you substitute with your
own timezone. You can find a list of timezones here.
Code:
/etc/php.ini
Code:
max_execution_time = 300
date.timezone = America/New_York
NOTE: Sometimes when you edit max_execution_time, the "seconds" jumps to the next line. Make
sure to move it back or comment it out or otherwise you're going to get a setup error.
NOTE: Don't forget to take out the ';' in front of date.timezone, or else you will have to stop apache,
change it, and start apache again.
Start apache web server and change write permissions on the config file:
Code:
/etc/init.d/httpd start
Code:
chmod 777 /var/www/html/zabbix/conf
Open http://your.server.ip/zabbix in your web browser and follow the setup. When you configure the
DB connection use zabbixuser/zabbixpass. After setup do not log into your server yet, since we
haven't started it or agent.
Code:
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_server start
Quote:
We also need to change the permissions on the apache config file so we don't fudge it in the future.
Code:
6 of 7 7/8/2009 11:46 PM
HOWTO: Setup Zabbix Monitor on CentOS - VPS Hosting - VPS Media F... http://www.vpsmedia.com/forum/showthread.php?t=24
If everything goes through fine you can log in to the server through http://your.server.ip/zabbix. User
'admin' for the username and leave the password blank.
To monitor your Zabbix server, you can go to the Configuration Tab, and choose the “hosts” sub Tab.
Select the “Zabbix Server” host, by putting a checkmark next to it. and choose the “Activate Selected”
button below. Wait a minute or two, then select the “Monitoring” tab, and then the “latest data” sub
tab. You should start seeing performance stats appear!
That's it, your Zabbix server should now be good to go. Enjoy!
You can find a lot more info on this wonderful program on Zabbix Forums and in the ZABBIX Manual.
__________________
vpsMedia.com - Xen VPS Hosting
Last edited by ctaborda; 06-21-2008 at 09:08 PM.
Posting Rules
BB code is On
Smilies are On
[IMG] code is On Forum Jump
HTML code is Off
Go
All times are GMT -4. The time now is 11:23 AM.
Contact Us | VPS Hosting - VPS Media For Designers and Developers | Archive | Top
7 of 7 7/8/2009 11:46 PM