#====================================
# docker 安装
需要完善的事项:docker卷存储(配置文件、日志等的路径)
proxy 默认不能使用root用户启动,在 proxy 配置文件里修改‘AllowRoot‘参数。
zabbix proxy 默认监听在10051
zabbix proxy 默认监听在10050
# 接收snmptrap
# 默认配置文件/etc/snmp/snmptrapd.conf
snmpTrapdAddr udp:1162
createUser -e 800063A2805E9B20F2010000000001 snmpv3user MD5 snmpv3pw
authUser log,execute snmpv3user
disableAuthorization no
# 获取 engine ID
snmpwalk -v 3 -u snmpv3user -a md5 -A snmpv3pw -l authNoPriv 172.21.157.20 iso.3.6.1.6.3.10.2.1.1.0
docker run --name zbx5-snmptraps \
-v /home/x/zabbix-conf/snmp:/etc/snmp \
--network=host \
--restart unless-stopped \
--privileged=true \
-d zabbix/zabbix-snmptraps:5.0-centos-latest
---
/var/lib/zabbix/snmptraps
The volume contains log file snmptraps.log named with received SNMP traps.
---
/var/lib/zabbix/mibs
The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed to /var/lib/zabbix/mibs.
---
/var/lib/zabbix/snmptraps 存放接收到的trap
/var/lib/zabbix/mibs 进行mib扩展及解析,配置文件添加 'mibs +ALL',并在mibs文件夹中放入所有mib文件
# 解析oid
snmptranslate -On HH3C-ARP-ENTRY-MIB::hh3cARPEntry
--
# 出现大量 hh3cPeriodicalTrap
undo snmp-agent trap log
--
trap 升级为告警,自定义正则表达式
#TODO: 正则匹配指定字段的值来进行出发告警
---
#TODO: 通过mib来监控状态进行告警
---
docker load -i zabbix-docker.tar.gz
# 图形中文乱码 --done
# 文件存放路径 --见docker官网介绍,已保存pdf,需要挂卷,#TODO: 确认挂哪些卷
1.
docker run --name zbx5-mysql -t \
--network=host \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="root" \
--restart unless-stopped \
-d mysql:5.7 \
--character-set-server=utf8 --collation-server=utf8_bin \
--default-authentication-plugin=mysql_native_password
2.
# Server 要和 snmptraps 挂相同路径的卷来读取 traps 告警信息
docker run --name zbx5-server-mysql -t \
-e DB_SERVER_HOST="localhost" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="root" \
-e ZBX_ENABLE_SNMP_TRAPS=true \
--network=host \
--volumes-from zbx5-snmptraps \
--restart unless-stopped \
-d zabbix/zabbix-server-mysql:5.0-centos-latest
3.
docker run --name zbx5-web-nginx-mysql -t \
-e ZBX_SERVER_HOST="localhost" \
-e DB_SERVER_HOST="localhost" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix" \
-e MYSQL_ROOT_PASSWORD="root" \
--network=host \
--restart unless-stopped \
-d zabbix/zabbix-web-nginx-mysql:5.0-centos-latest
4.
docker run --name zbx5-agent \
-e ZBX_HOSTNAME="localhost" \
-e ZBX_SERVER_HOST="localhost" \
--network=host \
--restart unless-stopped \
-d zabbix/zabbix-agent:5.0-centos-latest
5.
snmp-agent
snmp-agent sys-info version v3
snmp-agent group v3 snmpv3_alibaba authentication read-view iso-ivew write-view iso-view notify-view iso-view
snmp-agent target-host trap address udp-domain 172.21.157.209 params securityname snmpv3user v3 authentication
snmp-agent mib-view included iso-view iso
snmp-agent usm-user v3 snmpv3user snmpv3_alibaba simple authentication-mode md5 snmpv3pw
6.
Security name:{$SNMP_SECNAME}
Authentication passphrase:{$SNMP_AUTH}
Privacy passphrase:{$SNMP_PRIV}
修复图形中文字体乱码
将字体包拷入容器,直接覆盖原有字体
docker cp wqy-microhei.ttc zbx5-web-nginx-mysql:/usr/share/zabbix/assets/fonts/DejaVuSans.ttf
sysName: 1.3.6.1.2.1.1.5.0