zabbix监控H3C设备

背景

常见的服务和主机已经使用Prometheus进行监控了,但是网络设备还未配置监控。使用基于SNMP对网络设备进行监控。

设备概览

主要类型为H3C的路由器和交换机。H3CS5560交换机 路由器MER5200 er8300

步骤

配置网络设备开启telnet远程;

配置启用snmp协议;

zabbix界面添加主机进行监控;

snmp简介

SNMP simple network managerment protocol 分为三代,v3较为安全,需要配置用户名和密码及v3的加密密码。

组件

  • nginx
  • php7
  • mysql
  • zabbix_server
  • zabbix_agent
  • zabbix_get

MySQL

配置MySQL,容器方式启动

MySQL采用8.0版本,配置文件,数据持久化

bash 复制代码
docker pull mysql:8.0
 
mkdir -pv /data/mysql/{conf,data,logs}
 
[root@localhost ~]# cat /data/mysql/conf/my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
character-set-server=utf8mb4
collation-server=utf8mb4_bin
default-storage-engine=INNODB
 
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
 
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password
skip-host-cache
skip-name-resolve
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
secure-file-priv=/var/lib/mysql-files
user=mysql
 
pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/var/run/mysqld/mysqld.sock
 
!includedir /etc/mysql/conf.d/
 
docker run -d --restart=always --name mysql -p 3306:3306 -v /data/mysql/conf/my.cnf:/etc/mysql/my.cnf -v /data/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xxxxxxxxxxx mysql:8.0

使用yum repo中自带的是mariadb的MySQL5.x版本的客户端连接8.0版本数据库会报错

ERROR 2059 (HY000): Authentication plugin 'sha256_password' cannot be loaded: /usr/lib64/mysql/plugin/sha256_password.so: cannot open shared object file: No such file or directory

解决:安装MySQL community的客户端

bash 复制代码
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
 
yum install mysql-community-client --nogpgcheck
 
mysql -uroot -h127.0.0.1 -pzabbix@123
 
MySQL [(none)]> create database zabbix character set utf8 collate utf8_bin;
MySQL [(none)]> create user zabbix@'%' identified by 'xxxxxxx';
MySQL [(none)]> grant all privileges on zabbix.* to zabbix@'%';
MySQL [(none)]> set global log_bin_trust_function_creators = 1;
MySQL [(none)]> flush privileges;

zabbix配置

bash 复制代码
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
 
yum install zabbix-server-mysql zabbix-agent centos-release-scl zabbix-web-mysql-scl zabbix-nginx-conf-scl
bash 复制代码
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
 
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai
 
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
# listen 80;
# server_name example.com;
 
systemctl enable --now zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

systemctl is-active zabbix-server;systemctl is-active zabbix-agent;systemctl is-active rh-php72-php-fpm;systemctl is-active rh-nginx116-nginx
bash 复制代码
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
 
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai
 
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
# listen 80;
# server_name example.com;
 
systemctl enable --now zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

检查所有的组件依赖都是ok

默认web登录账户名密码为Admin zabbix

snmp测试工具

bash 复制代码
yum install net-snmp-utils

问题

zabbix机器中使用snmpwalk命令测试可以获取到被监控节点的各个oid详细信息,但是zabbix server的web界面中显示timeout或者其他的报错信息。

解决方法:无意间重启了zabbix server,问题得到解决。

相关推荐
杨了个杨89825 天前
Zabbix告警通知设置
zabbix
lvbinemail10 天前
动环方案实践:温湿度传感器+串口服务器+Zabbix+Grafana
zabbix·监控·机房·动环
乐维_lwops15 天前
Zabbix分布式监控体系架构设计与实战优化
分布式·zabbix
七七powerful16 天前
运维养龙虾--用 AI 驾驭 Zabbix:zabbix-mcp-server 深度指南
人工智能·zabbix·zabbix mcp
tianyuanwo16 天前
Zabbix 演进史与版本选型指南:从1998到8.0
zabbix·版本管理策略·版本选型
last demo18 天前
企业级开源监控zabbit
运维·开源·zabbix
艾伦_耶格宇18 天前
【zabbix】-2 zabbix本地部署
数据库·zabbix
IT WorryFree18 天前
Zabbix 监控多线路出口IP并通过飞书告警完整教程
tcp/ip·飞书·zabbix
不爱缺氧i20 天前
iReasoning MIB 浏览器
zabbix
IT WorryFree23 天前
Zabbix 飞书机器人告警配置
机器人·飞书·zabbix