zabbix分佈式架構

架構
zabbix分佈式架構php

yum install mysql-devel gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml -y
2、服務端安裝
一、安裝配置數據庫
yum -y install mariadb-server
二、數據庫開機自啓動
systemctl enable mariadb
三、啓動數據庫
systemctl start mariadb
四、初始化數據庫
mysql_secure_installation
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password: password
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Ymysql

  • Dropping test database...
    ... Success!
  • Removing privileges on test database...
    ... Success!
    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.
    Reload privilege tables now? [Y/n] Y
    ... Success!
    Cleaning up...
    All done! If you've completed all of the above steps, your MariaDB
    installation should now be secure.
    Thanks for using MariaDB!
    五、建立zabbix數據庫、用戶及密碼
    mysql -uroot -pPASSWORD -e "create database zabbix default character set utf8 collate utf8_bin;"
    mysql -uroot -pPASSWORD -e "grant all on zabbix.* to 'zabbix'@'%' identified by 'XXXXXX';"
    六、數據庫登入測試
    [root@XXXXrodm yum.repos.d]# mysql -uzabbix -pXXXXXX
    Welcome to the MariaDB monitor. Commands end with ; or \g.
    Your MariaDB connection id is 16
    Server version: 5.5.56-MariaDB MariaDB Server
    Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    MariaDB [(none)]> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | zabbix |
    +--------------------+
    2 rows in set (0.00 sec)
    MariaDB [(none)]> use zabbix
    Database changed
    MariaDB [zabbix]> show tables
    -> ;
    Empty set (0.00 sec)

3、安裝zabbix服務器端
一、安裝zabbix服務
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get
二、導入zabbix數據表結構
cd /usr/share/doc/zabbix-server-mysql-3.0.14
[root@XXX zabbix-server-mysql-3.0.14]# gzip -d create.sql.gz
[root@XXX zabbix-server-mysql-3.0.14]# cat create.sql | mysql -uzabbix -pXXXXXX zabbix
三、配置zabbix配置文件
[root@XXX ~]# cp /etc/zabbix/zabbix_server.conf{,.bak}
[root@XXX ~]# vim /etc/zabbix/zabbix_server.conf
LogFileSize=1024
DBPassword=XXXXXX
CacheSize=1024M
定義時區
[root@XXX ~]# cp /etc/httpd/conf.d/zabbix.conf{,.bak}
[root@XXX ~]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
四、開啓zabbix並設置爲開機自啓動
[root@XXX ~]# systemctl enable zabbix-server
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/z
abbix-server.service.[root@XXXprodm ~]# systemctl start zabbix-server
[root@XXX ~]# systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-01-03 12:59:44 CST; 5s ago
Process: 2445 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 2447 (zabbix_server)
CGroup: /system.slice/zabbix-server.service
└─2447 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
Jan 03 12:59:44 systemd[1]: Starting Zabbix Server...
Jan 03 12:59:44 systemd[1]: zabbix-server.service: Supervising process 2447 which is not our chi...xits.
Jan 03 12:59:44 systemd[1]: Started Zabbix Server.
Hint: Some lines were ellipsized, use -l to show in full.
五、啓動http並設置開機自啓動
[root@ ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.ser
vice.[root@ ~]# systemctl start httpd
[root@ ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-01-03 13:00:33 CST; 5s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 2479 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─2479 /usr/sbin/httpd -DFOREGROUND
├─2481 /usr/sbin/httpd -DFOREGROUND
├─2482 /usr/sbin/httpd -DFOREGROUND
├─2483 /usr/sbin/httpd -DFOREGROUND
├─2484 /usr/sbin/httpd -DFOREGROUND
└─2485 /usr/sbin/httpd -DFOREGROUND
Jan 03 13:00:30 systemd[1]: Starting The Apache HTTP Server...
Jan 03 13:00:33 httpd[2479]: AH00558: httpd: Could not reliably determine the server's fully qua...ssage
Jan 03 13:00:33 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.linux

4、進入web管理界面配置
http://172.16.65.149/zabbix
zabbix分佈式架構web

全部檢測均OKsql

zabbix分佈式架構

zabbix分佈式架構

zabbix分佈式架構

zabbix分佈式架構

zabbix管理網頁初始帳號密碼
Admin
zabbix數據庫

5、監控交換機配置
交換機SNMP配置
snmp-server community xxxxx ro
snmp-server community xxxxx rw
linux上安裝net-snmp net-snmp-tuils包測試snmp訪問
[root@ ~]# yum -y install net-snmp net-snmp-utils
snmpwalk -v 2c -c mflexnpm 10.100.0.46 1.3.6.1.2.1.2.2.1.10.1 查看端口1的計數
[root@ ~]# snmpwalk -v 2c -c xxxxxx 10.100.0.46 1.3.6.1.2.1.2.2.1.10.1
IF-MIB::ifInOctets.1 = Counter32: 1998
在zabbix上將snmp的變量加入
管理-->通常-->宏
zabbix分佈式架構apache

zabbix分佈式架構

  • zabbix_proxy安裝
    軟件安裝
    rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
    cat /etc/yum.repos.d/zabbix.repo
    yum -y install -y zabbix-proxy zabbix-proxy-mysql mariadb-server
    建立數據庫
    systemctl enable mariadb
    systemctl start mariadb
    mysql_secure_installation
    mysql -uroot -pPASSWORD -e "create database zabbix_proxy default character set utf8 collate utf8_bin;"
    mysql -uroot -pPASSWORD -e "grant all on zabbix_proxy.* to 'zabbix_proxy'@'%' identified by 'XXXXXX';"
    cd /usr/share/doc/zabbix-proxy-mysql-3.0.14
    zcat schema.sql.gz | mysql -uzabbix_proxy -pXXXXXX zabbix_proxy
    proxy配置文件修改
    cp /etc/zabbix/zabbix_proxy.conf{,.bak}

[root@XXXODPROXY ~]# grep '^[a-Z]' /etc/zabbix/zabbix_proxy.conf
Server=172.16.65.149
Hostname=XXXPRODPROXY
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=1024
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBName=zabbix_proxy
DBUser=zabbix_proxy
DBPassword=XXXXXX
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
ConfigFrequency=60 #zabbix proxy從zabbix server取得配置數據的頻率
DataSenderFrequency=60 #zabbix proxy發送監控到的數據給zabbix server的頻率
CacheSize=4G #解決內存溢出的問題,默認8M,把此參數調整至4G,加大存放hosts和items數據的緩存
ProxyOfflineBuffer=10 #當zabbix proxy與server沒法鏈接時保留數據庫的時間間隔,默認1小時,調整爲10小時,防止這段時間監控數據丟失,設置太長的話,zabbix proxy從新推送數據到zabbix server會致使雙方服務器的壓力增大
ProxyLocalBuffer=2 #zabbix_proxy在本地保留歷史數據的時間,2小時
HistoryCacheSize=512M #加大存放歷史數據的緩存
[root@XXXPRODPROXY ~]# grep '^[a-Z]' /etc/zabbix/zabbix_proxy.conf
Server=172.16.65.149
Hostname=XXXXPRODPROXY
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=1024
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBName=zabbix_proxy
DBUser=zabbix_proxy
DBPassword=XXXXXX
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
ConfigFrequency=60
DataSenderFrequency=60
CacheSize=4G
ProxyOfflineBuffer=10
systemctl enable zabbix-proxy
systemctl start zabbix-proxy
ss -tnl | grep 10051npm

在zabbix-server添加proxy
zabbix分佈式架構vim

server上添加解析
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.65.147 xxxxxODPROXY
172.16.2.178 xxxxPRODPROXY緩存

zabbix分佈式架構

zabbix分佈式架構

zabbix分佈式架構

添加測試交換機
10.1.12.8
zabbix分佈式架構

添加對zabbix_proxy的監控
一、zabbix-agent的安裝
yum install -y zabbix-agent
二、修改zabbix_agentd.conf
[root@xxxxxRODPROXY zabbix]# cat /etc/zabbix/zabbix_agentd.conf | grep '^[a-Z]'
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=1024
Server=172.16.65.147
ServerActive=172.16.65.149
Hostname=XXXRODPROXY
Include=/etc/zabbix/zabbix_agentd.d/
[root@xxxxxODPROXY ~]# cat /etc/zabbix/zabbix_agentd.conf | grep '^[a-Z]'
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=1024
Server=172.16.2.178
ServerActive=172.16.65.149
Hostname=XXXPRODPROXY
Include=/etc/zabbix/zabbix_agentd.d/

添加zabbix-proxy的host並使用zabbix-proxy模板
zabbix分佈式架構

zabbix分佈式架構

zabbix模板下載
http://www.zabbix.org/wiki/Zabbix_Templates
https://share.zabbix.com/network_devices/h3c-switch-chinese

zabbix server參數調整/etc/zabbix/zabbix_server.confCacheSize=8GTrendCacheSize=2GValueCacheSize=2G

相關文章
相關標籤/搜索