Zabbix Installation

Installing Apache and PHP

#apt-get install apache2 apache2-mpm-prefork libapache2-mod-php5 php5-cli php5-common php5-cgi

Mysql Server Installation

#apt-get install mysql-server snmp

Add the source below to your /etc/apt/sources.list.

# Zabbix
# http://mirror.opf.slu.cz/zabbix/

deb http://mirror.opf.slu.cz/zabbix unstable contrib

Next, update and install the packages

#apt-get update

#apt-get install zabbix-frontend-php zabbix-server zabbix-agent

#apt-get install build-essential fping libsnmp-dev libcurl4-openssl-dev libapache2-mod-php5 php5-gd php5-pgsql libiksemel-dev libssh2-1-dev libpq-dev
#apt-get install libmysqlclient16 libmysqlclient-dev php5-mysql

1 – Make the zabbix user and group:

#sudo adduser zabbix
password = 123
su – zabbix

wget “http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8.15/zabbix-1.8.15.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fzabbix%2Ffiles%2FZABBIX%2520Latest%2520Stable%2F1.8.15%2F&ts=1352110370&use_mirror=space”

tar xfzv zabbix-1.8.tar.gz
You might want to confirm that this is actually the latest version. You might also want to find a mirror closer to you by going to

Link To get the List the Stable Zabbix Version for downloads:
http://sourceforge.net/project/showfiles.php?group_id=23494.

Create a zabbix database and populate it
mysql -u root -pPaSSword
mysql> create database zabbix;

mysql -u root -pPaSSword -D zabbix < create/schema/mysql.sql
mysql -u root -pPaSSword -D zabbix < create/data/data.sql
mysql -u root -pPaSSword -D zabbix < create/data/images_mysql.sql
2 – Configure, compile and install the server:

cd zabbix-1.8
./configure –enable-server –enable-agent –with-net-snmp –with-libcurl –with-jabber –prefix=/zabbix –with-mysql

make
su
# Enter root password
make install
3- Prepare the rest of the system:

sudo nano /etc/services
Add at 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/ -r
Edit /etc/zabbix/zabbix_agentd.conf:

nano /etc/zabbix/zabbix_agentd.conf
Make sure that the Server parameter points to the server address, for the agent that runs on the server it is like this:

Server=127.0.0.1
Save and exit.

Edit /etc/zabbix/zabbix_server.conf:

nano /etc/zabbix/zabbix_server.conf
For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site, this is the place.

Change this:

# Database user
DBUser=zabbix
# Database password
# Comment this line if no password used
DBPassword=Secret
Save and exit.

Copy the init.d scripts to the right spot:

sudo cp misc/init.d/debian/zabbix-server /etc/init.d
sudo cp misc/init.d/debian/zabbix-agent /etc/init.d
You may need to edit these script files as the compiled versions of the zabbix files is placed under /usr/sbin (/usr/bin in older versions).
—- change it to /tmp/sbin/ instead of /usr/sbin.

sudo nano /etc/init.d/zabbix-server
Look for the following line:

DAEMON=/home/zabbix/bin/${NAME}
and replace it with:

DAEMON=/zabbix/sbin/${NAME} (old versions use /usr/bin/${NAME})
Save and exit.

sudo nano /etc/init.d/zabbix-agent
Look for the following line:

DAEMON=/home/zabbix/bin/${NAME}
and replace it with:

DAEMON=/zabbix/sbin/${NAME} (old versions use /usr/bin/${NAME})
Save and exit.

Now set the correct permissions and set ZABBIX to start when the machine boots:

sudo chmod 755 /etc/init.d/zabbix-server
sudo update-rc.d zabbix-server defaults
sudo chmod 755 /etc/init.d/zabbix-agent
sudo update-rc.d zabbix-agent defaults
Start the server :

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

sudo /etc/init.d/zabbix-agent start
Now check to make sure that they are running:

ps -aux | grep zabbix
You should see multiple instances of zabbix_server and zabbix_client running if everything has gone ok.

4 – Configure web interface

As user ‘root’:

cd /var/www
rm index.html
cp -R /home/zabbix/zabbix-1.8/frontends/php/* .
Make php.ini adjustments:

sudo nano /etc/php5/apache2/php.ini
Change the following values:

max_execution_time = 300 ; Maximum execution time of each script, in seconds
date.timezone = America/Kentucky/Louisville
(use this url to find your correct timezone format: http://us3.php.net/manual/en/timezones.php )

Restart Apache:

sudo /etc/init.d/apache2 restart
Web Interface Configuration

Now point your browser to:

http://<servername or ip>/zabbix/
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.

4. Configure DB Connection

Enter appropriate settings and click Test Connection. 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

One way to do this from a desktop machine (requires ssh installed): scp zabbix.conf.php zabbix@<serverip>:/home/zabbix/public_html/conf/

If using a windows workstation, you can use winscp http://winscp.net/eng/index.php to drag/drop the file onto your zabbix machine. This also requires ssh to be installed. (sudo apt-get install openssh-server)

Click Retry and click Next when OK.

7. Finish Click Finish to complete installation.

Your New Zabbix install will now be shown.

Log in with username: Admin / zabbix
Please check configuration parameters.
If all is correct, press “Next” button, or “Previous” button to change configuration parameters.

Database type: MySQL
Database server: localhost
Database port: 0
Database name: zabbix
Database user: root
Database password: *******

Zabbix server: localhost
Zabbix server port: 10051
Zabbix server name:

Zabbix To sent Alert Mail – Installing SMTP

#apt-get install sendEmail
Create a script “zabbix_sendemail” (chmod 755) in the AlertScriptsPath folder specified by /etc/zabbix/zabbix_server.conf (/etc/zabbix/alert.d/)
————————————–
#!/bin/sh
export smtpemailfrom=zabbix@yourdomain.com
export zabbixemailto=$1
export zabbixsubject=$2
export zabbixbody=$3
export smtpserver=yoursmtpserver.com
export smtplogin=smtpuser
export smtppass=smtppassword
/usr/bin/sendEmail -f $smtpemailfrom -t $zabbixemailto -u $zabbixsubject -m $zabbixbody -s $smtpserver:25 -xu $smtplogin -xp $smtppass
————————————–
Set a Media Type (Administration / Media types) script to zabbix_sendemail
Add that Media to the Admin user (Administration / Users / user)
Set the Action (Configurations / Actions) for the alert(s) you want to trigger on and who should get them (Admin)
checking email

/usr/sbin/exim -i <recipient-address(es)>
<message content, including all the header lines>
CTRL-D

Advertisements

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 )

Google+ photo

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

Connecting to %s