Zabbix installation (practice on your own)

Source: Internet
Author: User
Tags snmp import database mysql import

1. Download the source code package

Wget http://sourceforge.net/projects/zabbix/files/

2. Extract

Tar-zxvf zabbix-2.2.3.tar.gz

3. Enter the decompressed directory.

Cd zabbix-2.2.3

4. install necessary software

Yum install-y gcc make cmake mysql-server mysql-devel php-gd php-devel php-mysql php-bcmath php-ctype php-xml php-xmlreader php-xlmwriter php- session php-net-socket php-mbstring php-gettext httpd net-snmp curl-devel net-snmp-utils net-snmp-devel perl-DBI libxml2 libxml2-devel fping

5. Compile

. /Configure -- enable-server -- enable-agent -- enable-proxy -- with-mysql -- The enable-ipv6 -- with-net-snmp -- with-libcurl -- with-libxml2 -- with-openssl -- prefix =/ opt/zabbix

6. Install

Make & make install

7. Enter the directory containing the mysql import script

Cd./database/mysql

8. Connect to mysql

Mysql-uroot-p

Enter Password

9. Add users and databases

> Create database zabbix default charset utf8;

> UPDATE mysql. user SET password = PASSWORD ('xxx') WHERE User = 'root ';

> Flush privileges;

> Exit

10. Import Database

Mysql-uroot-p zabbix <schema. SQL

Mysql-uroot-p zabbix <images. SQL

Mysql-uroot-p zabbix <data. SQL

11. Switch to the decompressed directory.

Cd ../..

12. Modify apache configuration and add a VM

<VirtualHost *: 80>

ServerName zabbix.xxxx.net

DocumentRoot/var/www/zabbix

DirectoryIndex index. php index.html index.htm

<Directory "/">

AllowOverride All

Order allow, deny

Allow from all

</Directory>

</VirtualHost>

13. Create a directory virtual host directory

Mkdir/var/www/zabbix

14. Copy necessary PHP files to the virtual host

Cp-r./frontends/php/*/var/www/zabbix

15. Restart apache

Service httpd restart

16. Switch to the zabbix configuration directory.

Cd/opt/zabbix/etc

17. Modify the zabbix_server.conf configuration (my configuration is as follows)

LogFile =/var/log/zabbix_server.log

LogFileSize = 2

DBHost = localhost

DBName = zabbix

DBUser = root

DBPassword = XXX

DBSocket =/home/data/mysql. sock

StartPollers = 50

StartIPMIPollers = 3

StartPollersUnreachable = 10

StartTrappers = 50

StartPingers = 40

StartDiscoverers = 10

StartHTTPPollers = 20

StartTimers = 20

StartVMwareCollectors = 5

VMwareFrequency = 45

VMwareCacheSize = 256 M

StartSNMPTrapper = 1

HousekeepingFrequency = 6

Maxhousekeeperdeleted = 10000

SenderFrequency = 5

CacheSize = 1G

CacheUpdateFrequency = 60

StartDBSyncers = 50

HistoryCacheSize = 1G

TrendCacheSize = 1G

HistoryTextCacheSize = 1G

ValueCacheSize = 512 M

Timeout = 30

UnavailableDelay = 30

LogSlowQueries = 3000

StartProxyPollers = 10

AllowRoot = 1 # Run the zabbix process as the root user to avoid insufficient permissions.

 

18. Vi/etc/services

Join:

Zabbix-agent 10050/tcp # Zabbix Agent

Zabbix-agent 10050/udp # Zabbix Agent

Zabbix-trapper 10051/tcp # Zabbix Trapper

Zabbix-trapper 10051/udp # Zabbix Trapper

 

19. Add a service Startup Script

Vi/etc/init. d/zabbix_agentd

Add the following content:

#! /Bin/sh

# Chkconfig: 345 95 95

# Description: Zabbix agent

# Zabbix

# Copyright (C) 2001-2013 Zabbix SIA

#

# This program is free software; you can redistribute it and/or modify

# It under the terms of the GNU General Public License as published

# The Free Software Foundation; either version 2 of the License, or

# (At your option) any later version.

#

# This program is distributed in the hope that it will be useful,

# But without any warranty; without even the implied warranty

# MERCHANTABILITY or fitness for a special PURPOSE. See

# GNU General Public License for more details.

#

# You shoshould have written ed a copy of the GNU General Public License

# Along with this program; if not, write to the Free Software

# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

 

# Start/Stop the Zabbix agent daemon.

# Place a startup script in/sbin/init. d, and link to it from/sbin/rc [023]. d

 

SERVICE = "Zabbix agent"

DAEMON =/opt/zabbix/sbin/zabbix_agentd

PIDFILE =/tmp/zabbix_agentd.pid

BASEDIR =/opt/zabbix

ZABBIX_AGENTD = $ BASEDIR/sbin/zabbix_agentd

 

Case $1 in

'Start ')

If [-x $ {DAEMON}]

Then

$ DAEMON

# Error checking here wocould be good...

Echo "$ {SERVICE} started ."

Else

Echo "Can't find file $ {DAEMON }."

Echo "$ {SERVICE} NOT started ."

Fi

;;

'Stop ')

If [-s $ {PIDFILE}]

Then

If kill 'cat $ {PIDFILE} '>/dev/null 2> & 1

Then

Echo "$ {SERVICE} terminated ."

Rm-f $ {PIDFILE}

Fi

Fi

;;

'Restart ')

$0 stop

Sleep 10

$0 start

;;

*)

Echo "Usage: $0 start | stop | restart"

;;

Esac

 

Vi/etc/init. d/zabbix_server

Add the following content:

#! /Bin/sh

#

# Chkconfig: 345 95 95

# Description: Zabbix Server

# Zabbix

# Copyright (C) 2001-2013 Zabbix SIA

#

# This program is free software; you can redistribute it and/or modify

# It under the terms of the GNU General Public License as published

# The Free Software Foundation; either version 2 of the License, or

# (At your option) any later version.

#

# This program is distributed in the hope that it will be useful,

# But without any warranty; without even the implied warranty

# MERCHANTABILITY or fitness for a special PURPOSE. See

# GNU General Public License for more details.

#

# You shoshould have written ed a copy of the GNU General Public License

# Along with this program; if not, write to the Free Software

# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

 

# Start/Stop the Zabbix server daemon.

# Place a startup script in/sbin/init. d, and link to it from/sbin/rc [023]. d

 

SERVICE = "Zabbix server"

DAEMON =/opt/zabbix/sbin/zabbix_server (you must change it to your own installation path)

PIDFILE =/tmp/zabbix_server.pid

BASEDIR =/opt/zabbix/(you need to change it to your own installation path)

ZABBIX_SERVER = $ BASEDIR/sbin/zabbix_server

 

Case $1 in

'Start ')

If [-x $ {DAEMON}]

Then

$ DAEMON

# Error checking here wocould be good...

Echo "$ {SERVICE} started ."

Else

Echo "Can't find file $ {DAEMON }."

Echo "$ {SERVICE} NOT started ."

Fi

;;

'Stop ')

If [-s $ {PIDFILE}]

Then

If kill 'cat $ {PIDFILE} '>/dev/null 2> & 1

Then

Echo "$ {SERVICE} terminated ."

Rm-f $ {PIDFILE}

Fi

Fi

;;

'Restart ')

$0 stop

Sleep 10

$0 start

;;

*)

Echo "Usage: $0 start | stop | restart"

;;

Esac

 

20. Grant the execution permission

Chmod a + x/etc/init. d/zabbix_agentd

Chmod a + x/etc/init. d/zabbix_server

21. Add boot start

Chkconfig zabbix_server on

Chkconfig zabbix_agentd on

22. Modify the/etc/php. ini configuration

Change; date. timezone = to date. timezone = "Asia/Shanghai"

Replace max_execution_time = 30 with max_execution_time = 300.

Set max_input_time = 60 to max_input_time = 300.

23. Restart apache

Service httpd restart

24. Modify zabbix. conf. php

Cp/var/www/zabbix/conf/zabbix. conf. php. example/var/www/zabbix/conf/zabbix. conf. php

Vi/var/www/zabbix/conf/zabbix. conf. php is configured as follows:

25. Disable Firewall

Service iptables stop

Setenforce 0

Chkconfig ipstables off

Vi/etc/selinux/config change SELINUX = enabled to SELINUX = disabled.

26. Solve Chinese garbled characters

Use the ftp software to upload C: \ Windows \ Fonts \ simkai. ttf to the/var/www/zabbix/fonts directory on the zabbix server.

Vi/var/www/zabbix/include/defines. inc. php

Define ('zbx _ GRAPH_FONT_NAME ', 'javusans') of 39 rows ');

Change to define ('zbx _ GRAPH_FONT_NAME ', 'simai ');

Define ('zbx _ FONT_NAME ', 'javusans') of 86 rows ');

Change to define ('zbx _ FONT_NAME ', 'simai ');

27. The installation of zabbix has been completed.

Enter the domain name or IP address in the browser for access

The default zabbix system user is admin and the password is zabbix.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.