官方文檔https://www.zabbix.com/documentation/3.4/zh/manual
操作環(huán)境CentOS7:
zabbix-server:172.16.80.103
zabbix-agent :172.16.80.101
- 服務(wù)器安裝包
zabbix-server-mysql
zabbix-web-mysql
zabbix-get
zabbix-agent
zabbix-sender
- 客戶端安裝包
zabbix-agent
zabbix-sender
服務(wù)器初始化
1挎扰、安裝zabbix
[root@zabbix-server ~]#yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-get zabbix-agent zabbix-sender
2贡蓖、初始化zabbix
創(chuàng)建數(shù)據(jù)庫(kù)
[root@zabbix-server ~]#mysql
MariaDB [(none)]> create database zabbix character set 'utf8';
MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'172.16.80.%' identified by 'zabbix';
MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> quit
導(dǎo)入zabbix表格
[root@zabbix-server ~]#rpm -ql zabbix-server-mysql
...部分略
/usr/share/doc/zabbix-server-mysql-3.4.2/create.sql.gz
#zabbix-server-mysql這個(gè)包有個(gè)數(shù)據(jù)庫(kù)模板create.sql.gz苟耻,我們可以用它導(dǎo)進(jìn)數(shù)據(jù)庫(kù)中
[root@zabbix-server ~]#cp /usr/share/doc/zabbix-server-mysql-3.4.2/create.sql.g ./
[root@zabbix-server ~]#gzip -d create.sql.gz
[root@zabbix-server ~]#mysql -uzabbix -pzabbix -h172.16.80.103 zabbix <create.sql
3、配置
zabbix服務(wù)配置文件/etc/zabbix/zabbix_server.conf
四個(gè)部分:
- GENERAL PARAMETERS
- ADVANCED PARAMETERS
- LOADABLE MODULES
- TLS-RELATED PARAMETERS
[root@zabbix-server zabbix]#cat zabbix_server.conf |grep ^[^#]
ListenPort=10051
SourceIP=172.16.80.103
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
DBPort=3306
如果要用到zabbix-web,那么我們還得改一下/etc/httpd/conf.d/zabbix.conf文件
[root@zabbix-server conf.d]#cat /etc/httpd/conf.d/zabbix.conf |grep timezone
php_value date.timezone Asia/Shanghai
#把timezone改成Asia/Shanghai腮介,因?yàn)閦abbix是依賴與于imezone的
4、啟動(dòng)服務(wù)
[root@zabbix-server zabbix]#systemctl start zabbix-server
[root@centos7d zabbix]#ss -ntl |grep 10051
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 :::10051 :::*
#如果啟動(dòng)失敗,請(qǐng)查看日志文件捧弃、檢查配置文件和數(shù)據(jù)庫(kù)、數(shù)據(jù)庫(kù)帳號(hào)
[root@zabbix-server conf.d]#systemctl start httpd
#zabbix默認(rèn)用的是httpd的模塊,啟動(dòng)時(shí)注意不要與nginx服務(wù)沖突违霞,否則起不來嘴办。
5、登錄zabbix
此處默認(rèn)用戶名admin买鸽、密碼zabbix涧郊,建議登錄后修改
客戶端初始化
1、安裝客戶端包
[root@zabbix-agent~]#yum install zabbix-agent zabbix-sender
2眼五、配置/etc/zabbix/zabbix_agentd.conf
[root@zabbix-agent zabbix]#cat /etc/zabbix/zabbix_agentd.conf |grep ^[^#]
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.80.103
ListenPort=10050
ListenIP=0.0.0.0
StartAgents=3
ServerActive=172.16.80.103
Hostname=zabbix-agent
Include=/etc/zabbix/zabbix_agentd.d/*.conf
3妆艘、
[root@zabbix-agent zabbix]#systemctl start zabbix-agent