zabbix安装

zabbix源码方式安装

环境准备

  • 下载zabbix源码
  • 上传zabbix源码到目标机器后执行下面命令

    1
    2
    3
    [root@master ~]# tar -zxvf zabbix-4.0.1.tar.gz
    [root@master ~]# groupadd zabbix
    [root@master ~]# useradd -g zabbix zabbix
  • 配置数据库【安装mysql数据库略】

    1
    2
    3
    4
    5
    6
    7
    8
    9
    [root@master ~]# mysql -uroot -p<password>
    MYSQL> create database zabbix character set utf8 collate utf8_bin;
    MYSQL> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
    MYSQL> quit;
    [root@master ~]# cd zabbix-4.0.1/database/mysql/
    [root@master mysql]# mysql -uzabbix -pzabbix zabbix < schema.sql
    [root@master mysql]# #stop here if you are creating database for Zabbix proxy
    [root@master mysql]# mysql -uzabbix -pzabbix zabbix < images.sql
    [root@master mysql]# mysql -uzabbix -pzabbix zabbix < data.sql

安装server

1
2
3
4
5
[root@master ~]# ./configure --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[root@master ~]# make install
[root@master ~]# #启动服务:zabbix_server
[root@master ~]# su - zabbix
[zabbix@master ~]# zabbix_agentd

错误处理

  • configure: error: LIBXML2 library not found

    1
    [root@master ~]# yum -y install libxml2-devel
  • configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config

    1
    [root@master ~]# yum -y install net-snmp-devel
  • configure: error: Unable to use libevent (libevent check failed)

    1
    [root@master ~]# yum install libevent-devel
  • configure: error: Curl library not found

    1
    [root@master ~]# yum -y install curl-devel
  • zabbix_server: error while loading shared libraries: libmysqlclient.so.20:
    cannot open shared object file: No such file or
    directory
    ===========》

    1
    2
    [root@master ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/mysql/libmysqlclient.so.20
    [root@master ~]# ldconfig

安装配置web

1
2
3
4
5
6
7
[root@master ~]# yum install httpd
[root@master ~]# mkdir /var/www/html/zabbix
[root@master ~]# cd zabbix-4.0.1/frontends/php
[root@master php]# cp -a . /var/www/html/zabbix
[root@master php]# systemctl start httpd
[root@master php]# systemctl enable httpd
[root@master php]# yum install php php-mysql

打开URLhttp://ip/zabbix/setup.php


按照提示处理依赖

1
2
3
4
5
6
7
8
9
10
[root@master ~]# yum install php-ldap
[root@master ~]# yum install php-gd
[root@master ~]# yum install php-xmlreader
[root@master ~]# yum install php-mbstring
[root@master ~]# yum install php-bcmath
#修改php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300






cd /var/www/html/zabbix/conf

Zabbix-agent安装

1
2
3
4
5
6
7
8
[root@master ~]# tar -xzvf zabbix-4.0.1.tar.gz
[root@master zabbix-4.0.1]# cd zabbix-4.0.1/
[root@master zabbix-4.0.1]# ./configure --enable-agent
[root@master zabbix-4.0.1]# make install
[root@master zabbix-4.0.1]# vi /usr/local/etc/zabbix_agentd.conf #配置
[root@master zabbix-4.0.1]# groupadd zabbix
[root@master zabbix-4.0.1]# useradd -g zabbix zabbix
[root@master zabbix-4.0.1]# zabbix_agentd

选择中文语言

Zabbix中文监控服务器图形图表显示乱码处理

复制下图中的字体到linux中的zabbix中


并做如下修改