zabbix proxy install

  1. zabbix-proxy yum source

    1
    2
    3
    [root@localhost ~]# hostname zabbixproxy
    [root@localhost ~]# echo zabbixproxy| tee /etc/hostname
    [root@zabbixproxy ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
  2. zabbix-proxy install mysql

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    [root@zabbixproxy ~]# yum -y install mariadb-server mariadb
    [root@zabbixproxy ~]# cat > /etc/my.cnf <<EOF
    > [mysqld]
    > character-set-server=utf8
    > datadir=/mnt/data/mysql
    > socket=/mnt/data/mysql/mysql.sock
    > symbolic-links=0
    > [mysqld_safe]
    > log-error=/var/log/mariadb/mariadb.log
    > pid-file=/var/run/mariadb/mariadb.pid
    > !includedir /etc/my.cnf.d
    > [mysql]
    > socket=/mnt/data/mysql/mysql.sock
    > [client]
    > default-character-set=utf8
    > socket=/mnt/data/mysql/mysql.sock
    > EOF
    [root@zabbixproxy ~]# mkdir -p /mnt/data/mysql
    [root@zabbixproxy ~]# chown -R mysql.mysql /mnt/data/mysql
    [root@zabbixproxy ~]# systemctl start mariadb
    [root@zabbixproxy ~]# systemctl enable mariadb
  3. zabbix-proxy install

    1
    2
    [root@zabbixproxy ~]# yum -y install zabbix-proxy-mysql
    [root@zabbixproxy ~]# yum -y install zabbix-get zabbix-java-gateway zabbix-sender
  4. zabbix-proxy mysql configuration

    1
    2
    3
    4
    5
    [root@zabbixproxy ~]# mysql
    MariaDB [(none)]> create database zabbix_proxy character set utf8 collate utf8_bin;
    MariaDB [(none)]> grant all privileges on zabbix_proxy.* to zabbix@'localhost' identified by 'zabbixproxy';
    MariaDB [(none)]> flush privileges;
    [root@zabbixproxy ~]# zcat /usr/share/doc/zabbix-proxy-mysql-3.2.3/schema.sql.gz | mysql -uzabbix -pzabbixproxy -hlocalhost -B zabbix_proxy
  5. zabbix-proxy configuration

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    [root@zabbixproxy ~]# vim /etc/zabbix/zabbix_proxy.conf
    ProxyMode=0
    Server=192.168.13.202
    ServerPort=10051
    Hostname=zabbix-proxy-company
    HostnameItem=system.hostname
    ListenPort=10051
    LogFile=/var/log/zabbix/zabbix_proxy.log
    LogFileSize=512
    DebugLevel=3
    PidFile=/var/run/zabbix/zabbix_proxy.pid
    DBHost=192.168.13.204
    DBName=zabbix_proxy
    DBUser=zabbix
    DBPassword=xxxxxxxxxxxx
    DBSocket=/mnt/data/mysql/mysql.sock
    DBPort=3306
    ProxyLocalBuffer=48
    ProxyOfflineBuffer=24
    HeartbeatFrequency=60
    ConfigFrequency=600
    DataSenderFrequency=1
    StartPollers=15
    StartTrappers=10
    StartPingers=10
    StartDiscoverers=10
    StartHTTPPollers=5
    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    CacheSize=512M
    StartDBSyncers=8
    HistoryCacheSize=2048M
    HistoryIndexCacheSize=128M
    Timeout=4
    TrapperTimeout=300
    UnreachablePeriod=45
    UnavailableDelay=60
    UnreachableDelay=15
    ExternalScripts=/etc/zabbix/zabbix_exec
    FpingLocation=/usr/sbin/fping
    LogSlowQueries=3000
    User=zabbix
    Include=/etc/zabbix/zabbix_proxy.d/*.conf
  6. zabbix-proxy start

    1
    2
    [root@zabbixproxy ~]# systemctl start zabbix-proxy
    [root@zabbixproxy ~]# systemctl enable zabbix-proxy
  7. zabbix-server

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    open: http://zabbix-server

    open: Administration -> Proxies -> Create proxy
    Proxy name = zabbixproxy($hostname)
    Proxy mode = active(主动)
    Add(添加)

    open: Configuration -> Hosts -> Create host
    host:
    Host name=zabbix-proxy-company($hostname)
    Visible name=192.168.13.204($zabbix-proxy-ip)
    New group=zabbix proxy
    Agent interfaces=($zabbix-proxy-ip:port)
    Monitored by proxy=zabbixproxy(Proxy name)
    Template:
    Link new templates(添加模板)