安装zabbix之前的准备工作:
1.关闭防火墙和selinux
# systemctl stop firewalld.service #关闭防火墙服务
# systemctl disable firewalld.service #开机不启动
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #替换文本参数
# grep SELINUX=disabled /etc/selinux/config #查文本状态
# setenforce 0 #关闭当前SELINUX
2.配置163 的yum源
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup #备份本地yum源
# cd /etc/yum.repos.d/
# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #下载163yum用root用户传入yum.repos.d文件下
zabbix 3.4.1 Server安装
一、下载3.4.1 rpm
[root@node3 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
二、服务端安装
[root@node3 ~]# yum install zabbix-server-mysql zabbix-web-mysql zabbix-get httpd
三、安装mariadb数据库
1.安装mariadb 数据库
[root@node3 ~]# yum install mariadb mariadb-server -y
2.启动mariadb 数据库
[root@node3 ~]# systemctl start mariadb
3.开机自启动
[root@node3 ~]# systemctl enable mariadb.service
4.创建zabbix数据库
[root@node3 ~]# mysql MariaDB
[(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.29 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.30 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'192.168.170.%' identified by 'zabbix';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]>flush privileges;
Query OK, 0 rows affected (0.49 sec)
MariaDB [(none)]> exit #退出
5.初始化数据库
[root@node3 ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.1/
[root@node3 zabbix-server-mysql-3.4.1]# zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz | mysql -uzabbix -p zabbix 密码输入 zabbix
6.查看下数据库表单是否有生成导入
[root@node3 ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11924
Server version: 5.5.60-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [zabbix]> show tables;
140 rows in set (0.00 sec)
MariaDB [zabbix]> exit
7.配置数据库为zabbixserver
[root@node3 ~]# vim /etc/zabbix/zabbix_server.conf #修改zabbixserver配置文本
DBHost=localhost #去掉前面#
DBName=zabbix #不需要修改
DBUser=zabbix #不需要修改
DBPassword=zabbix #去掉前面#修改数据库密码=zabbix
8.启动zabbix服务及设置开机启动
[root@node3 ~]# #systemctl start zabbix-server #启动zabbix服务
[root@node3 ~]# #systemctl enable zabbix-server #开机自启动
9.配置修正php内部参数
[root@node3 ~]# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M #16M/32M 都可
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/shanghai #修改时区
10.重新启动httpd,刷新配置
[root@node3 ~]# systemctl start httpd
查看服务是否正常启动
[root@node3 ~]# ss -tunl
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
udp UNCONN 0 0 127.0.0.1:323 *:*
udp UNCONN 0 0 *:123 *:*
udp UNCONN 0 0 ::1:323 :::*
tcp LISTEN 0 128 *:10051 *:*
tcp LISTEN 0 50 *:3306 *:*
tcp LISTEN 0 128 *:22 *:*
tcp LISTEN 0 100 127.0.0.1:25 *:*
tcp LISTEN 0 128 :::10051 :::*
tcp LISTEN 0 128 :::80 :::*
tcp LISTEN 0 128 :::22 :::*
tcp LISTEN 0 100 ::1:25 :::*
Zabbix-Agent安装
一、下载3.4.1 rpm包
[root@node3 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
二、客户端安装
[root@node1 ~]# yum install zabbix-agent zabbix-sender #客户端安装
三、启动agent端
[root@node1 ~]# systemctl start zabbix-agent
11.zabbix网页安装http://192.168.170..10/zabbix 默认用户名/密码:Admin/zabbix 登录成功后,进入zabbix欢迎页面
检查预配置信息是否正确,如果有错误会有报错,需要修改配置信息,刷新该页面使所有状态项均为OK,才能进入下一步操作。
配置zabbix数据库信息,需要和之前的配置信息保持一致。
配置zabbix server信息
预安装信息的汇总显示,没有问题即可点击下一步,进入zabbix主页