下载外网的yum源文件,配置自己的本地zabbix yum源。
1,下载
window 使用wget.exe 下载zabbix 文件
2,将下载好的文件复制到/var/www/html/zabbix目录
cd /var/www/html/zabbix
3,配置本地yum源
zabbix.repo
[zabbix]
name=Zabbix
enabled=1
gpgcheck=0
[zabbix-debuginfo]
name=debuginfo
enabled=1
gpgcheck=0
[zabbix-non-supported]
name=zabbix-non-supported
enabled=1
gpgcheck=0
4,利用Linux镜像安装http服务,并开启服务
yum -y install httpd httpd-devel
systemctl enable httpd
systemctl start httpd
第一配置zabbix yum源的时候,最好在/var/www/html/zabbix中执行下两条命令
rpm --import RPM-GPG-KEY-ZABBIX
rpm --import zabbix-official-repo.key
5,下载安装相关软件包
yum -y install httpd httpd-devel mariadb* php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml php-bcmath php-ldap
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
6,启动mysql服务
systemctl enable mariadb
systemctl start mariadb
grant all privileges on zabbix.* to zabbix@localhost identified by 'zbxpassword';
grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by 'zbxpassword';
grant all privileges on zabbix.* to zabbix@'192.168.125.10' identified by 'zbxpassword';
flush privileges;
查看用户信息:
select user,host,password from mysql.user;
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix zabbix
密码:zbxpassword
7,修改配置文件zabbix_server 服务器配置文件:
vim /etc/zabbix/zabbix_server.conf
DBHost=192.168.125.10
DBPassword=zbxpassword
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
systemctl restart httpd
8,安装,配置zabbix_agent
yum -y install zabbix-agent zabbix-sender
vi /etc/zabbix/zabbix_agentd.conf
Server=192.168.125.10
#配置agent主动模式
ServerActive=192.168.125.10
#配置agent主机名,后期页面添加hostname要一致
Hostname=Zabbix server
9,启动zabbix_server,zabbix_agent开机自启
systemctl enable zabbix-server zabbix-agent
systemctl restart zabbix-server zabbix-agent
disable 关闭开机自启
根据端口查看服务器启动情况
默认端口:
agent:10050
server:10051
查看端口是否启动:
netstat -nlp|grep 10050
ss -tnl|grep -ww 10050
#自定义key创建cpu.conf(cpu.conf自己创建的配置)
vim /etc/zabbix/zabbix_agentd.d/memory.conf
UserParameter=system.memory.used,/usr/bin/free -g|/usr/bin/awk '/^Mem/{print $3}'
#测试server能否接受agent发送的信息
zabbix_get -s 192.168.125.12 -p 10050 -k "system.memory.used"
#查看防火墙
iptabes -nL
#关闭防火墙
iptables -F
中文字体乱码解决:
在C:\Windows\Fonts中复制想要的字体,将复制出来的字体名称改为graphfont.ttf
查看服务器上graphfont.ttf 文件所在的目录
find / -name graphfont.ttf
# cd /usr/share/zabbix/assets/fonts #进入目录
# ls /usr/share/zabbix/assets/fonts #查看目录
# mv graphfont.ttf graphfont.ttf.bak #重命名原文件
#将自己准备的文件放到当前目录中,刷新网页 不需要重启
更新zabbix用户密码的操作:
UPDATE user SET password=PASSWORD('Nk_fj@2019#') WHERE user='zabbix';
FLUSH PRIVILEGES;
修改配置文件中的密码:
/etc/zabbix/web/zabbix.conf.php
/etc/zabbix/zabbix_server.conf