zabbix监控安装
1、准备环境
IP地址查看
ifconfig eth0 | awk 'NR==2{print$2}'
关闭selinux
getenforce
2、zabbix-server内存尽量大点,4G更好
3、安装Zabbix存储库,清除yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
![](https://img-blog.csdnimg.cn/34e77cae5bac47aeb27a6389db7c1023.png)
yum clean all
![](https://img-blog.csdnimg.cn/0961110835644cc598332badbbaaf868.png)
4、安装Zabbix服务器和代理
yum install zabbix-server-mysql zabbix-agent
5、安装Zabbix前端,启用Red Hat软件集合
yum install centos-release-scl
6、编辑配置文件 /etc/yum.repos.d/zabbix.repo
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
7、安装Zabbix前端包
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
8、创建初始数据库失败,首先yum下载mariadb-server数据库
[root@backup ~]# mysql -uroot -p
-bash: mysql: command not found
[root@backup ~]# systemctl start mariadb.service
Failed to start mariadb.service: Unit not found.
yum -y install mariadb-server
启动数据库
[root@backup ~]# systemctl start mariadb.service
[root@backup ~]# systemctl status mariadb.service
数据库启动后再执行以下命令
mysql -uroot -p #直接回车
password
#创建数据库zabbix字符集utf8 collate utf8\u bin
mysql> create database zabbix character set utf8 collate utf8_bin;
#创建用户zabbix@localhost由“密码”标识;
mysql> create user zabbix@localhost identified by 'password';
#将zabbix.*上的所有特权授予zabbix@localhost;
mysql> grant all privileges on zabbix.* to zabbix@localhost;
#退出数据库
mysql> quit;
[root@backup ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-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)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit;
Bye
9、导入初始架构和数据,系统将提示您输入新创建的密码
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
![](https://img-blog.csdnimg.cn/40d662f25118471a874ff96588c16596.png)
10、为Zabbix server配置数据库,编辑配置文件 /etc/zabbix/zabbix_server.conf
vim /etc/zabbix/zabbix_server.conf
126 行添加 DBPassword=password
11、为Zabbix前端配置PHP,编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
; php_value[date.timezone] = Europe/Riga #去掉注释;
![](https://img-blog.csdnimg.cn/1578bd8d440e447ba5884b97d3d500ca.png)
12、启动Zabbix server和agent进程,并为它们设置开机自启
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
![](https://img-blog.csdnimg.cn/665e6498a2944f8d83f3c27c9c8ec772.png)
13、在网页输入http://ip地址/zabbix进入网页端
14、登录账号密码默认
Admin
zabbix