一. 设置基本LINUX系统 参考 http://www.jb51.cc/article/p-ozfdicky-bgz.html
二.安装MariaDB/MysqL
1.添加MariaDB源(或者手动下载安装)
vi/etc/yum.repos.d/MariaDB.repo #MariaDB10.1CentOSrepositorylist-created2016-03-1807:33UTC #http://mariadb.org/mariadb/repositories/ [mariadb] name=MariaDB baseurl=http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
2.安装MariaDB-server MariaDB-client
yuminstallMariaDB-serverMariaDB-client-y DependenciesResolved ================================================================================================== PackageArchVersionRepositorySize ================================================================================================== Installing: MariaDB-clientx86_6410.1.15-1.el7.centosmariadb39M MariaDB-serverx86_6410.1.15-1.el7.centosmariadb100M MariaDB-sharedx86_6410.1.15-1.el7.centosmariadb1.3M replacingmariadb-libs.x86_641:5.5.44-2.el7.centos Installingfordependencies: MariaDB-commonx86_6410.1.15-1.el7.centosmariadb43k boost-program-optionsx86_641.53.0-25.el7base155k galerax86_6425.3.15-1.rhel7.el7.centosmariadb7.7M jemallocx86_643.6.0-1.el7mariadb104k lsofx86_644.87-4.el7base331k perl-Compress-Raw-Bzip2x86_642.061-3.el7base32k perl-Compress-Raw-Zlibx86_641:2.061-4.el7base57k perl-DBIx86_641.627-4.el7base802k perl-Data-Dumperx86_642.145-3.el7base47k perl-IO-Compressnoarch2.061-2.el7base260k perl-Net-Daemonnoarch0.48-5.el7base51k perl-PlRPCnoarch0.2020-14.el7base36k rsyncx86_643.0.9-17.el7base360k TransactionSummary ================================================================================================== Install3Packages(+13Dependentpackages)
3.设置MariaDB
mkdir-pv/data/zabbix chown-RMysqL.MysqL/data MysqL_install_db--user=MysqL--datadir=/data/zabbix mv/etc/my.cnf/etc/my.cnf.old cp/usr/share/MysqL/my-large.cnf/etc/my.cnf
vim/etc/my.cnf [client] default-character-set=utf8 [MysqLd] socket=/var/lib/MysqL/MysqL.sock datadir=/data/zabbix innodb_file_per_table=on skip_name_resolve=on character-set-server=utf8 [MysqL] default_character_set=utf8
设置mariadb起动,并开机起动
systemctlstartmariadb systemctlenablemariadb
4.设置zabbix账号连接信息
MysqL CREATEDATABASEzabbixCHARACTERSETutf8; GRANTALLonzabbix.*TO'zabbix'@'10.10.10.%'IDENTIFIEDBY'zabbix'; GRANTALLonzabbix.*TO'zabbix'@'zabbix'IDENTIFIEDBY'zabbix'; GRANTALLonzabbix.*TO'zabbix'@'localhost'IDENTIFIEDBY'zabbix'; FLUSHPRIVILEGES;
三.安装zabbix
1.下载zabbix http://www.zabbix.com/download.PHP
zabbix-agent
zabbix-get
zabbix-server-MysqL
zabbix-web
zabbix-web-MysqL
2.设置阿里云的epel源
yuminstallwget-y wgethttp://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm rpm-ivhepel-release-latest-7.noarch.rpm rpm-ivhhttp://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
3.安装zabbix
yumlocalinstallzabbix*-y DependenciesResolved =================================================================================================================== PackageArchVersionRepositorySize =================================================================================================================== Installing: zabbix-agentx86_643.0.3-1.el7/zabbix-agent-3.0.3-1.el7.x86_641.0M zabbix-getx86_643.0.3-1.el7/zabbix-get-3.0.3-1.el7.x86_64829k zabbix-java-gatewayx86_643.0.3-1.el7/zabbix-java-gateway-3.0.3-1.el7.x86_641.3M zabbix-proxy-MysqLx86_643.0.3-1.el7/zabbix-proxy-MysqL-3.0.3-1.el7.x86_642.1M zabbix-releasenoarch3.0-1.el7/zabbix-release-3.0-1.el7.noarch20k zabbix-senderx86_643.0.3-1.el7/zabbix-sender-3.0.3-1.el7.x86_64853k zabbix-server-MysqLx86_643.0.3-1.el7/zabbix-server-MysqL-3.0.3-1.el7.x86_643.3M zabbix-webnoarch3.0.3-1.el7/zabbix-web-3.0.3-1.el7.noarch29M zabbix-web-MysqLnoarch3.0.3-1.el7/zabbix-web-MysqL-3.0.3-1.el7.noarch0.0 Installingfordependencies: OpenIPMI-libsx86_642.0.19-11.el7base501k OpenIPMI-modaliasx86_642.0.19-11.el7base15k aprx86_641.4.8-3.el7base103k apr-utilx86_641.5.2-6.el7base92k dejavu-fonts-commonnoarch2.33-6.el7base64k dejavu-sans-fontsnoarch2.33-6.el7base1.4M fontpackages-filesystemnoarch1.44-8.el7base9.9k fpingx86_643.10-4.el7epel46k httpdx86_642.4.6-40.el7.centos.1updates2.7M httpd-toolsx86_642.4.6-40.el7.centos.1updates82k iksemelx86_641.4-6.el7epel50k java-1.8.0-openjdk-headlessx86_641:1.8.0.91-1.b14.el7_2updates31M javapackages-toolsnoarch3.4.1-11.el7base73k libX11x86_641.6.3-2.el7base605k libX11-commonnoarch1.6.3-2.el7base162k libXaux86_641.0.8-2.1.el7base29k libXpmx86_643.5.11-3.el7base54k libjpeg-turBox86_641.2.90-5.el7base134k libpngx86_642:1.5.13-7.el7_2updates213k libtool-ltdlx86_642.4.2-21.el7_2updates49k libxcbx86_641.11-4.el7base189k libxsltx86_641.1.28-5.el7base242k libzipx86_640.10.1-8.el7base48k lksctp-toolsx86_641.0.13-3.el7base87k mailcapnoarch2.1.41-2.el7base31k net-snmp-libsx86_641:5.7.2-24.el7_2.1updates747k PHPx86_645.4.16-36.1.el7_2.1updates1.4M PHP-bcmathx86_645.4.16-36.1.el7_2.1updates56k PHP-clix86_645.4.16-36.1.el7_2.1updates2.7M PHP-commonx86_645.4.16-36.1.el7_2.1updates563k PHP-gdx86_645.4.16-36.1.el7_2.1updates126k PHP-ldapx86_645.4.16-36.1.el7_2.1updates51k PHP-mbstringx86_645.4.16-36.1.el7_2.1updates503k PHP-MysqLx86_645.4.16-36.1.el7_2.1updates99k PHP-pdox86_645.4.16-36.1.el7_2.1updates97k PHP-xmlx86_645.4.16-36.1.el7_2.1updates124k python-javapackagesnoarch3.4.1-11.el7base31k python-lxmlx86_643.2.1-4.el7base758k t1libx86_645.1.2-14.el7base166k tzdata-javanoarch2016e-1.el7updates180k unixODBCx86_642.3.1-11.el7base413k TransactionSummary =================================================================================================================== Install9Packages(+41Dependentpackages)
4.将zabbix数据库信息导入MariaDB
cd/usr/share/doc/zabbix-server-MysqL-3.0.3/#根据版本号 gunzipcreate.sql.gz MysqL-urootzabbix<create.sql
5.设置zabbix_server
vi/etc/zabbix/zabbix_server.conf $ListenPort=10051 #DBHost=localhost#如果MysqL和zabbix不在同一主机,这里填写IP DBName=zabbix#zabbix数据库名 DBUser=zabbix#zabbix数据库连接用户 DBPassword=zabbix#zabbix数据库连接密码 DBSocket=/var/lib/MysqL/MysqL.sock#和MysqLsocket配置填写一至,如果MysqL和zabbix不在同一主机,这里不填写
6.设置PHP信息
vi/etc/PHP.ini date.timezone=Asia/Chongqing#修改PHP的时区
7.设置httpd和zabbix-server启动并开机起动
systemctlstarthttpd systemctlenablehttpd systemctlstartzabbix-server systemctlenablezabbix-server
8.设置zabbix页面
cat/etc/zabbix/web/zabbix.conf.PHP <?PHP //ZabbixGUIconfigurationfile. global$DB; $DB['TYPE']='MysqL'; $DB['SERVER']='localhost'; $DB['PORT']='0'; $DB['DATABASE']='zabbix'; $DB['USER']='zabbix'; $DB['PASSWORD']='zabbix'; //Schemaname.UsedforIBMDB2andPostgresql. $DB['SCHEMA']=''; $ZBX_SERVER='localhost'; $ZBX_SERVER_PORT='10051'; $ZBX_SERVER_NAME=''; $IMAGE_FORMAT_DEFAULT=IMAGE_FORMAT_PNG;
四.安装zabbix-agent
1.去http://www.zabbix.com/download.PHP根据系统下载agent版本
实验为centos6的agent
2.安装agnet
yumlocalinstallzabbix-agent-3.0.3-1.el6.x86_64.rpm DependenciesResolved ======================================================================================================================================= PackageArchVersionRepositorySize ======================================================================================================================================= Installing: zabbix-agentx86_643.0.3-1.el6/zabbix-agent-3.0.3-1.el6.x86_641.0M Installingfordependencies: libtool-ltdlx86_642.2.6-15.5.el6base44k unixODBCx86_642.2.14-14.el6base378k
3.设置agent
vi/etc/zabbix/zabbix_agentd.conf PidFile=/var/run/zabbix/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agentd.log LogFileSize=0 Server=10.10.10.220 ServerActive=10.10.10.220 #Hostname=Zabbixserver#可以不用填写,会自动读取hostname Include=/etc/zabbix/zabbix_agentd.d/
4.启动agent,并设置为开机起动
servicezabbix-agentstart chkconfigzabbix-agenton
五.windows agent安装
下载windows版本的agent解压到C:\Program Files\ ,执行命令
cdc: cd\ cdC:\ProgramFiles\zabbix_agents\bin\win32\ "C:\ProgramFiles\zabbix_agents\bin\win32\zabbix_agentd.exe"--config"C:\ProgramFiles\zabbix_agents\conf\zabbix_agentd.win.conf"--install "C:\ProgramFiles\zabbix_agents\bin\win32\zabbix_agentd.exe"--start
server和agent安装完成