实验环境
主机名 | IP | 角色 |
---|---|---|
server1 | 172.25.6.1 | server |
server2 | 172.25.6.2 | agent |
server3 | 172.25.6.3 | agent |
一、安装zabbix监控
server1:
1.下载zabbix安装包,解压并安装
[root@server1 ~]# ls
4.0
zabbix-server-mysql-4.0.5-1.el7.x86_64.rpm
zabbix-web-mysql-4.0.5-1.el7.noarch.rpm
zabbix-web-4.0.5-1.el7.noarch.rpm
php-bcmath-5.4.16-42.el7.x86_64.rpm
php-mbstring-5.4.16-42.el7.x86_64.rpm
fping-3.10-1.el7.x86_64.rpm
iksemel-1.4-2.el7.centos.x86_64.rpm
zabbix-agent-4.0.5-1.el7.x86_64.rpm
2.安装数据库,开启数据库
[root@server1 ~]# yum install -y mariadb-server
[root@server1 ~]# systemctl start mariadb
3.安全初始化
[root@server1 ~]# mysql_secure_installation
Set root password? [Y/n] y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y
4.创建一个zabbix库
[root@server1 ~]# mysql -p
Enter password:
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> CREATE DATABASE zabbix CHARACTER SET UTF8 COLLATE UTF8_BIN;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'redhat'; ##用户授权
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> Bye
5.导入zabbix库
[root@server1 4.0]# zcat /usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz | mysql -uzabbix -p zab