首先要安装LAMP环境;安装zabbix3.4.2版本
服务器:192.168.160.2
客户端:192.168.160.3
1、安装zabbix源
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2、安装Zabbix server and agent:(配置自己监控自己,所以安装了zabbix-agent):
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3、编辑 file /etc/httpd/conf.d/zabbix:
vi /etc/httpd/conf.d/zabbix.conf
更新时区:
php_value date.timezone Asia/Shanghai
重启httpd
systemctl restart httpd
4、创建MySQL 数据库和用户
登录MariaDB:
mysql –u root –p
创建一个数据库‘zabbixdb’和数据库用户‘zabbix’
MariaDB [(none)]> create database zabbixcharacter set utf8;
MariaDB [(none)]> grant all privilegeson zabbix.* to 'zabbix'%' identified by 'zabbix';
MariaDB [(none)]> flush privileges;
5、数据库导入zabbixtemplate
使用数据库用户zabbix登录数据库
mysql –uzabbix –p
切换到zabbix数据库
use zabbix
导入模板数据
切换到zabbix-server目录
[root@localhost ~]# cd/usr/share/doc/zabbix-server-mysql-3.2.4/
解压create.sql.gz这个文件:
[root@localhost zabbix-server-mysql-3.2.4]#gunzip create.sql.gz
[root@localhost zabbix-server-mysql-3.2.4]#mysql -uzabbix -p zabbix < create.sql
6、配置Zabbix server
配置Zabbixserver
vim /etc/zabbix/zabbix_server.conf
DBHost=localhost 数据库ip地址
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
配置本机zabbix-agent
vi /etc/zabbix/zabbix_agentd.conf
配置zabbix server 的ip
Server=127.0.0.1 #<==其他agent机器输入服务器ip
ServerActive=127.0.0.1 #<==其他agent机器输入服务器ip
Hostname=localhost
systemctl start zabbix-server zabbix-agent
systemctl restart httpd mariadb
systemctl enable zabbix-server zabbix-agent
浏览器访问http://ip/zabbix
安装完成后,重定向到zabbix控制台登录页面. 输入用户名和密码,默认的用户名和密码为admin/Zabbix
其他zabbix_agent安装配置
客户端安装
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
yum install zabbix-agent -y
vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.160.2
#用于被动模式,数据获取,主动模式和被动模式按照自己需求选择。
ServerActive=192.168.1.60.2
#用于主动模式,数据提交,主动模式和被动模式按照自己需求选择。
Hostname=node1
systemctl start zabbix-agent
#启动zabbix agent