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,问题得到解决。

相关推荐
柳如烟@6 天前
从零开始配置 Zabbix 数据库监控:MySQL 实战指南
数据库·mysql·adb·zabbix
S1lent9o9 天前
CentOS stream 中部署Zabbix RPM软件包公钥验证错误
linux·centos·zabbix
佳腾_1 个月前
【Zabbix技术系列文章】第④篇——Zabbix 数据可视化
运维·信息可视化·zabbix·监控
Source、1 个月前
Zabbix监控K8s集群
docker·kubernetes·zabbix
澜堇1 个月前
企业级部署zabbix分布式监控系统
分布式·zabbix
wusam1 个月前
Centos7搭建Zabbix4.x监控HCL模拟网络设备:zabbix-server搭建及监控基础04
zabbix·hcl·getif·snmp监控
网络工程师_ling1 个月前
Zabbix—企业微信报警群通消息通知
企业微信·zabbix
xiaozhanfeng2 个月前
CentOS8+Zabbix7.2.4解决中文显示问题
zabbix
开源极客行2 个月前
(二)企业级监控系统 - ZABBIX 部署
zabbix
大刘讲IT2 个月前
Zabbix+AI大模型实战:智能故障诊断与工单预警系统设计
人工智能·zabbix