快速安装配置Zabbix

一、安装部署Zabbix Server
   Zabbix Server可以运行在 CentOS 、 RedHat Linux 、 Debain 等 Linux 系统上,这里以Centos-6.6-X86_X64 作为部署环境。

1.1 服务端安装 lamp 环境
yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql
httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel iotop iftop

1.2 服务端配置 lamp 使用环境
如果不想手工修改,可以使用以下 sed 命令操作:
sed -i "s/;date.timezone =/date.timezone = Asia\/Shanghai/g"  /etc/php.ini
sed -i "s#max_execution_time = 30#max_execution_time = 300#g" /etc/php.ini
sed -i "s#post_max_size = 8M#post_max_size = 32M#g"   /etc/php.ini
sed -i "s#max_input_time = 60#max_input_time = 300#g" /etc/php.ini
sed -i "s#memory_limit = 128M#memory_limit = 128M#g"  /etc/php.ini
sed -i "/;mbstring.func_overload = 0/ambstring.func_overload = 2\n" /etc/php.ini
sed -i "s@#ServerName www.example.com:80@ServerName localhost:80@g" /etc/httpd/conf/httpd.conf

开启 httpd , mysqld 服务
chkconfig mysqld on
chkconfig httpd on
service mysqld start
service httpd start

1.3 服务端的安装过程
1.3.1、rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm   #安装zabbix官方2.2的yum源,推荐用2.2,2.4的目前用的人少,坑太多,出了问题不好解决,2.2的网上资料一大堆,坑少,而且官方对2.2的版本支持时间也比2.4长的多,2.4只是一个过度产品!!!!


yum install zabbix-server-mysql zabbix-web-mysql -y

1.3.2、Creating initial database
# mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> exit

# cd /usr/share/doc/zabbix-server-mysql-2.2.11/create
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql

1.3.3、Starting Zabbix server process
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

sed -i 's/# DBHost=localhost/DBHost=localhost/g' /etc/zabbix/zabbix_server.conf  #快速修改
sed -i 's/# DBPassword=/DBPassword=zabbix/g' /etc/zabbix/zabbix_server.conf  

egrep "DBHost|DBName|DBUser|DBPassword" /etc/zabbix/zabbix_server.conf  
### Option: DBHost
DBHost=localhost
### Option: DBName
#       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
# DBName=
DBName=zabbix
### Option: DBUser
# DBUser=
DBUser=zabbix
### Option: DBPassword
DBPassword=zabbix

# service zabbix-server start
# rpm -qa zabbix*
zabbix-release-2.2-1.el6.noarch
zabbix-server-2.2.11-1.el6.x86_64
zabbix-web-2.2.11-1.el6.noarch
zabbix-2.2.11-1.el6.x86_64
zabbix-server-mysql-2.2.11-1.el6.x86_64
zabbix-web-mysql-2.2.11-1.el6.noarch
zabbix-agent-2.2.11-1.el6.x86_64

rpm -ql zabbix-web   #查看yum安装的zabbix的web安装文件位置
cd /usr/share/zabbix
# ls
acknow.php                     index.php
actionconf.php                 items.php
adm.gui.php                    js
adm.housekeeper.php            jsLoader.php
adm.iconmapping.php            jsrpc.php
adm.images.php                 latest.php
adm.macros.php                 locale
adm.other.php                  maintenance.php
adm.regexps.php                map.php
adm.triggerdisplayoptions.php  maps.php
adm.triggerseverities.php      media_types.php
adm.valuemapping.php           nodes.php
adm.workingtime.php            overview.php
api                            popup_bitem.php
api_jsonrpc.php                popup_httpstep.php
applications.php               popup_media.php
audio                          popup_period.php
auditacts.php                  popup.php
auditlogs.php                  popup_right.php
authentication.php             popup_trexpr.php
browserwarning.php             popup_usrgrp.php
chart2.php                     profile.php
chart3.php                     proxies.php
chart4.php                     queue.php
chart5.php                     report1.php
chart6.php                     report2.php
chart7.php                     report3.php
chart_bar.php                  report4.php
chart.php                      report5.php
charts.php                     report6.php
conf                           robots.txt
conf.import.php                screenconf.php
dashboard.php                  screenedit.php
dashconf.php                   screens.php
discoveryconf.php              scripts_exec.php
discovery.php                  scripts.php
disc_prototypes.php            search.php
events.php                     services.php
fonts                          setup.php
graphs.php                     slideconf.php
history.php                    slides.php
host_discovery.php             srv_status.php
hostgroups.php                 styles
hostinventoriesoverview.php    sysmap.php
hostinventories.php            sysmaps.php
host_prototypes.php            templates.php
host_screen.php                tr_comments.php
hosts.php                      tr_events.php
httpconf.php                   trigger_prototypes.php
httpdetails.php                triggers.php
httpmon.php                    tr_logform.php
image.php                      tr_status.php
images                         tr_testexpr.php
imgstore.php                   usergrps.php
include                        users.php


mv * /var/www/html
/etc/init.d/httpd restart   #注意,此处一定要重启apache,否则,呵呵,你懂得
Stopping httpd:                                      [  OK  ]
Starting httpd:                                      [  OK  ]
重启完httpd,就可以进入Web界面安装zabbix的web程序了。
安装zabbix的web程序过程中,如果出现意想不到的情况,麻烦各位请返回前面的步骤重新认真查看再次操作,笔者按照以上方法是没有任何问题的。
登录  账号Admin  密码  zabbix  哈哈成功!!!!!!!!

二、客户端安装及配置
2.1 安装客户端
yum install zabbix-agent -y
2.2 配置客户端
# vi /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=zabbix-server

   其中 Server和ServerActive 都指定zabbixserver 的IP地址,不同的是,前者是被动后者是主动。也就是说 Server 这个配置是用来允许127.0.0.1这个 ip来我这取数据。而 serverActive的127.0.0.1的意思是,客户端主动提交数据给他。明白了吗?为什么要分主动和被动?后续再来讨论这个问题! 其他主机安装客户端记得添加 zabbix用户。

你可能感兴趣的:(zabbix)