1. Create a directory
Mkdir-p/maichuang/ServerScript
2. install necessary software
Yum install-y fping (if installation fails) or wget http://pkgs.repoforge.org/fping/fping-3.1-1.el6.rf.i686.rpm
Yum install-y gcc make cmake mysql-server mysql-devel php-gd php-devel php-mysql php-bcmath php-ctytpe php-xml php-xmlreader php-xlmwriter php- session php-net-socket php-mbstring php-gettext httpd net-snmp curl-devel net-snmp-devel perl-DBI libxml libxml2-devel
On 192.168.8.185
Scp/maichuang/ zabbix-2.2.0.tar.gz root @ IP:/root/
3. Add a user
Groupadd zabbix
Useradd-g zabbix-s/sbin/nologin
4. Create a database
Service mysqld start
Mysql-uroot-p
> Create database zabbix default charset utf8;
> Grant all on zabbix. * to zabbix @ localhost identified by '123 ';
> Flush privileges;
> Exit
5. Import tables from the database
Cd/root/zabbix-2.2.0/database/mysql
# Mysql-uzabbix-p123456 zabbix <schema. SQL (the proxy only needs this step and does not need data)
6. Compile and install (proxy)
Cd/root/zabbix-2.2.0
./Configure -- enable-agent -- enable-proxy -- with-mysql -- enable-ipv6 -- with-net-snmp -- with-libcurl -- with-libxml2 -- prefix =/maichuang/zabbix
Make & make install
7. Edit the configuration file
Cd/maichuang/zabbix/etc/
Vi/maichuang/zabbix/etc/zabbix_proxy.conf
Server = 192.168.8.1 (based on the actual situation)
Hostname = 192.168.8.2-proxy (changed based on the actual situation)
DBName = zabbix
DBUser = zabbix
DBPassword = 123456 (based on the actual situation)
ProxyLocalBuffer = 24
ProxyOfflineBuffer = 24
ConfigFrequency = 300
DataSenderFrequency = 3
StartPollers = 20
StartIPMIPollers = 2
StartPollersUnreachable = 2
StartTrappers = 10
StartPingers = 15
StartHTTPPollers = 3
StartVMwareCollectors = 3
VMwareCacheSize = 40 M
StartSNMPTrapper = 1
CacheSize = 100 M
StartDBSyncers = 6
HistoryCacheSize = 100 M
HistoryTextCacheSize = 200 M
Timeout = 30
LogSlowQueries = 3000
AllowRoot = 1
Vi/maichuang/zabbix/etc/zabbix_agentd.conf
Modify the following content:
Server = 192.168.8.1
ServerActive = 192.168.8.1
Hostname = 192.168.8.2-proxy
RefreshActiveChecks = 60
MaxLinesPerSecond = 800
Timeout = 30
AllowRoot = 1
UnsafeUserParameters = 1
UserParameter = system. agent. checkSecure,/maichuang/ServerScript/check_secure.sh
8. Add to services
# Vi/etc/services
Add the following content at the end of the file:
Zabbix-agent 10050/tcp # Zabbix Agent
Zabbix-agent 10050/udp # Zabbix Agent
Zabbix-trapper 10051/tcp # Zabbix Trapper
Zabbix-trapper 10051/udp # Zabbix Trapper
9. Start the daemon process
Vi/etc/init. d/zabbix_proxy
Vi/etc/init. d/zabbix_agentd
Add subsequent scripts
Chmod a + x/etc/init. d/zabbix_proxy
Chmod a + x/etc/init. d/zabbix_agentd
Service zabbix_proxy start
Service zabbix_agentd start
10. Add boot start
Chkconfig zabbix_proxy on
Chkconfig zabbix_agentd on
11. Allow 10050 and 10051 to pass through the firewall
Iptables-a input-p tcp -- dport 10050-j ACCEPT
Iptables-a input-p tcp -- dport 10051-j ACCEPT
Or disable the firewall.
Service iptables stop
Setenforce 0
11. Start the service
Service zabbix_proxy start
Service zabbix_agentd start
12. Modify the client configuration file
Vi/maichuang/zabbix/etc/zabbix_agentd.conf
Modify the following content:
Change Server = xxxx to proxy Server IP Address
Change ServerActive = xxxx to the IP address of the proxy server
Restart the client
Service zabbix_agentd restart
Script zabbix_proxy
#! /Bin/sh
# Chkconfig: 345 95 95
# Desctription: Zabbix Proxy
# 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 proxy"
DAEMON =/maichuang/zabbix/sbin/zabbix_proxy
PIDFILE =/tmp/zabbix_agentd.pid
BASEDIR =/maichuang/zabbix/
ZABBIX_AGENTD = $ BASEDIR/sbin/zabbix_proxy
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
Script zabbix_agentd
#! /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 =/maichuang/zabbix/sbin/zabbix_agentd
PIDFILE =/tmp/zabbix_agentd.pid
BASEDIR =/maichuang/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