新闻详情

新闻详情

首页 / 资讯中心 / 详情

收集SNMP数据到OpenTelemetry

发布时间:2026/9/11 17:09:22来源:尧图网络
收集SNMP数据到OpenTelemetry
1. 概述我记得老年间SNMP是非常流行的监控协议因为它的设计真的很用心很精细。那时候懂SNMP的人都自我感觉很好的每个人都 显出似乎很懂技术的样子☺。后来到了移动互联网的时代这个协议就不那么吃香了因为它只是个适合局域网的协议另外只有Metrics的协议缺乏Traces和Logs等监控的关键要素。到了OpenTelemetry流行的时代SNMP就更像是一个老古董。但是其实SNMP并没有被彻底淘汰它在某些领域比如网络通信设备等还是作为一种普遍的监控标准。目前来讲业界普遍越来越倾向于使用OpenTelemetry来定义和收集监控的数据(traces, metrics, logs, profiles...)各种商业和开源的监控后端系统都推崇接入OpenTelemetry标准的数据比如采用OTLP协议。我原来在IBM的时候就有客户要求把他的支持SNMP的设备的数据转换为支持OpenTelemetry以便发送到IBM Instana上去。当然他也可以随便改一个配置把数据发送到DynatraceDatadogNew Relic之类的商业服务器上或者开源的后端服务器。也可以同时使用多个后端。2. Prometheus SNMP Exporter2.1 什么是Prometheus SNMP Exporter其实在互联网的时代SNMP社区就已经做了很大的努力把SNMP的metrics放到最流行的Prometheus服务器上。这就用到了Prometheus SNMP Exporter。这个工具非常的成熟。大家可以到“https://github.com/prometheus/snmp_exporter/releases/”下载最新的执行版本笔者写作本文时的这个Exporter的版本是0.30.1。2.2 Prometheus SNMP Exporter的配置文件Prometheus SNMP Exporter系统自带的配置文件snmp.yml就可以作为很好的参考了。当然也可以自己写或者生成自己的配置文件。我做了一个snmp0.yml(见下)实际上是摘取了系统自带的snmp.yml的一部分当然重新生成也很容易(后面会描述)。auths: public_v2: version: 2 community: public private_v2: version: 2 community: private switch_v3: version: 3 username: monitor security_level: authPriv auth_protocol: SHA password: AuthPass123 priv_protocol: AES priv_password: PrivPass123 modules: hrStorage: walk: - 1.3.6.1.2.1.25.2 metrics: - name: hrMemorySize oid: 1.3.6.1.2.1.25.2.2 type: gauge help: The amount of physical read-write main memory, typically RAM, contained by the host. - 1.3.6.1.2.1.25.2.2 - name: hrStorageAllocationUnits oid: 1.3.6.1.2.1.25.2.3.1.4 type: gauge help: The size, in bytes, of the data objects allocated from this pool - 1.3.6.1.2.1.25.2.3.1.4 indexes: - labelname: hrStorageIndex type: gauge lookups: - labels: - hrStorageIndex labelname: hrStorageDescr oid: 1.3.6.1.2.1.25.2.3.1.3 type: DisplayString - labels: - hrStorageIndex labelname: hrStorageType oid: 1.3.6.1.2.1.25.2.3.1.2 type: OctetString - name: hrStorageSize oid: 1.3.6.1.2.1.25.2.3.1.5 type: gauge help: The size of the storage represented by this entry, in units of hrStorageAllocationUnits - 1.3.6.1.2.1.25.2.3.1.5 indexes: - labelname: hrStorageIndex type: gauge lookups: - labels: - hrStorageIndex labelname: hrStorageDescr oid: 1.3.6.1.2.1.25.2.3.1.3 type: DisplayString - labels: - hrStorageIndex labelname: hrStorageType oid: 1.3.6.1.2.1.25.2.3.1.2 type: OctetString - name: hrStorageUsed oid: 1.3.6.1.2.1.25.2.3.1.6 type: gauge help: The amount of the storage represented by this entry that is allocated, in units of hrStorageAllocationUnits. - 1.3.6.1.2.1.25.2.3.1.6 indexes: - labelname: hrStorageIndex type: gauge lookups: - labels: - hrStorageIndex labelname: hrStorageDescr oid: 1.3.6.1.2.1.25.2.3.1.3 type: DisplayString - labels: - hrStorageIndex labelname: hrStorageType oid: 1.3.6.1.2.1.25.2.3.1.2 type: OctetString - name: hrStorageAllocationFailures oid: 1.3.6.1.2.1.25.2.3.1.7 type: counter help: The number of requests for storage represented by this entry that could not be honored due to not enough storage - 1.3.6.1.2.1.25.2.3.1.7 indexes: - labelname: hrStorageIndex type: gauge lookups: - labels: - hrStorageIndex labelname: hrStorageDescr oid: 1.3.6.1.2.1.25.2.3.1.3 type: DisplayString - labels: - hrStorageIndex labelname: hrStorageType oid: 1.3.6.1.2.1.25.2.3.1.2 type: OctetString这个配置文件做了如下设置首先定义了三种安全模式其中两个(public_v2和private_v2)使用SNMP v2一个(switch_v3)使用SNMP v3。定义了一个module(hrStorage)以及它设计的metrics的范围(OID1.3.6.1.2.1.25.2)。我们可以定义很多module每个module的metrics范围也可以是很多个OID。定义了若干个metrics(hrMemorySize、hrStorageAllocationUnits、hrStorageSize、hrStorageUsed、hrStorageAllocationFailures)包括其名称、类型和标签。2.3 运行snmp_exportersnmp_exporter执行程序默认使用的配置文件是本地的snmp.yml。如果要指定我自己的配置文件snmp0.yml的话使用如下的命令来运行./snmp_exporter --config.filesnmp0.ymlsnmp_exporter的默认端口是9116。如果我们在本机访问http://localhost:9116/metrics 的话只能看到snmp_exporter自己的metrics。如何才能看到某支持SNMP的设备的metrics呢假如该设备的IP是1.2.3.4我们要访问的metrics module是hrStorage我们用的安全定义是public_v2那么在snmp_exporter的本机可以用这个URLhttp://localhost:9116/snmp?target1.2.3.4modulehrStorageauthpublic_v2这个设计非常精巧可见只要安全配置和metrics配置相同无论局域网内有多少个SNMP设备都可以通过一个snmp_exporter来获取。下面是访问的返回示例就是一个标准的Prometheus端口:# HELP hrMemorySize The amount of physical read-write main memory, typically RAM, contained by the host. - 1.3.6.1.2.1.25.2.2 # TYPE hrMemorySize gauge hrMemorySize 3.2712824e07 # HELP hrStorageAllocationUnits The size, in bytes, of the data objects allocated from this pool - 1.3.6.1.2.1.25.2.3.1.4 # TYPE hrStorageAllocationUnits gauge hrStorageAllocationUnits{hrStorageDescr/,hrStorageIndex34,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/dev/shm,hrStorageIndex46,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wsl,hrStorageIndex32,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wslg,hrStorageIndex35,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wslg/distro,hrStorageIndex36,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wslg/doc,hrStorageIndex51,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wslg/run/user/1000,hrStorageIndex76,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/mnt/wslg/versions.txt,hrStorageIndex50,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/run,hrStorageIndex43,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/run/lock,hrStorageIndex44,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/run/shm,hrStorageIndex45,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/run/user,hrStorageIndex47,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/run/user/1000,hrStorageIndex75,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/snap,hrStorageIndex62,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/tmp/.X11-unix,hrStorageIndex52,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/usr/lib/modules/6.6.87.2-microsoft-standard-WSL2,hrStorageIndex31,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/usr/lib/wsl/lib,hrStorageIndex37,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescr/var/lib/docker,hrStorageIndex74,hrStorageType1.3.6.1.2.1.25.2.1.4} 4096 hrStorageAllocationUnits{hrStorageDescrAvailable memory,hrStorageIndex11,hrStorageType1.3.6.1.2.1.25.2.1.1} 1024 hrStorageAllocationUnits{hrStorageDescrCached memory,hrStorageIndex7,hrStorageType1.3.6.1.2.1.25.2.1.1} 1024 hrStorageAllocationUnits{hrStorageDescrMemory buffers,hrStorageIndex6,hrStorageType1.3.6.1.2.1.25.2.1.1} 1024 hrStorageAllocationUnits{hrStorageDescrPhysical memory,hrStorageIndex1,hrStorageType1.3.6.1.2.1.25.2.1.2} 1024 hrStorageAllocationUnits{hrStorageDescrShared memory,hrStorageIndex8,hrStorageType1.3.6.1.2.1.25.2.1.1} 1024 hrStorageAllocationUnits{hrStorageDescrSwap space,hrStorageIndex10,hrStorageType1.3.6.1.2.1.25.2.1.3} 1024 hrStorageAllocationUnits{hrStorageDescrVirtual memory,hrStorageIndex3,hrStorageType1.3.6.1.2.1.25.2.1.3} 1024 # HELP hrStorageSize The size of the storage represented by this entry, in units of hrStorageAllocationUnits - 1.3.6.1.2.1.25.2.3.1.5 # TYPE hrStorageSize gauge hrStorageSize{hrStorageDescr/,hrStorageIndex34,hrStorageType1.3.6.1.2.1.25.2.1.4} 2.63940717e08 hrStorageSize{hrStorageDescr/dev/shm,hrStorageIndex46,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/mnt/wsl,hrStorageIndex32,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/mnt/wslg,hrStorageIndex35,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/mnt/wslg/distro,hrStorageIndex36,hrStorageType1.3.6.1.2.1.25.2.1.4} 2.63940717e08 hrStorageSize{hrStorageDescr/mnt/wslg/doc,hrStorageIndex51,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/mnt/wslg/run/user/1000,hrStorageIndex76,hrStorageType1.3.6.1.2.1.25.2.1.4} 817820 hrStorageSize{hrStorageDescr/mnt/wslg/versions.txt,hrStorageIndex50,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/run,hrStorageIndex43,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/run/lock,hrStorageIndex44,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/run/shm,hrStorageIndex45,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/run/user,hrStorageIndex47,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/run/user/1000,hrStorageIndex75,hrStorageType1.3.6.1.2.1.25.2.1.4} 817820 hrStorageSize{hrStorageDescr/snap,hrStorageIndex62,hrStorageType1.3.6.1.2.1.25.2.1.4} 2.63940717e08 hrStorageSize{hrStorageDescr/tmp/.X11-unix,hrStorageIndex52,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/usr/lib/modules/6.6.87.2-microsoft-standard-WSL2,hrStorageIndex31,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/usr/lib/wsl/lib,hrStorageIndex37,hrStorageType1.3.6.1.2.1.25.2.1.4} 4.089103e06 hrStorageSize{hrStorageDescr/var/lib/docker,hrStorageIndex74,hrStorageType1.3.6.1.2.1.25.2.1.4} 2.63940717e08 hrStorageSize{hrStorageDescrAvailable memory,hrStorageIndex11,hrStorageType1.3.6.1.2.1.25.2.1.1} 3.165826e07 hrStorageSize{hrStorageDescrCached memory,hrStorageIndex7,hrStorageType1.3.6.1.2.1.25.2.1.1} 932248 hrStorageSize{hrStorageDescrMemory buffers,hrStorageIndex6,hrStorageType1.3.6.1.2.1.25.2.1.1} 3.2712824e07 hrStorageSize{hrStorageDescrPhysical memory,hrStorageIndex1,hrStorageType1.3.6.1.2.1.25.2.1.2} 3.2712824e07 hrStorageSize{hrStorageDescrShared memory,hrStorageIndex8,hrStorageType1.3.6.1.2.1.25.2.1.1} 4472 hrStorageSize{hrStorageDescrSwap space,hrStorageIndex10,hrStorageType1.3.6.1.2.1.25.2.1.3} 8.388608e06 hrStorageSize{hrStorageDescrVirtual memory,hrStorageIndex3,hrStorageType1.3.6.1.2.1.25.2.1.3} 4.1101432e07 # HELP hrStorageUsed The amount of the storage represented by this entry that is allocated, in units of hrStorageAllocationUnits. - 1.3.6.1.2.1.25.2.3.1.6 # TYPE hrStorageUsed gauge hrStorageUsed{hrStorageDescr/,hrStorageIndex34,hrStorageType1.3.6.1.2.1.25.2.1.4} 6.0941051e07 hrStorageUsed{hrStorageDescr/dev/shm,hrStorageIndex46,hrStorageType1.3.6.1.2.1.25.2.1.4} 0 hrStorageUsed{hrStorageDescr/mnt/wsl,hrStorageIndex32,hrStorageType1.3.6.1.2.1.25.2.1.4} 1 hrStorageUsed{hrStorageDescr/mnt/wslg,hrStorageIndex35,hrStorageType1.3.6.1.2.1.25.2.1.4} 63 hrStorageUsed{hrStorageDescr/mnt/wslg/distro,hrStorageIndex36,hrStorageType1.3.6.1.2.1.25.2.1.4} 6.0941051e07 hrStorageUsed{hrStorageDescr/mnt/wslg/doc,hrStorageIndex51,hrStorageType1.3.6.1.2.1.25.2.1.4} 19 hrStorageUsed{hrStorageDescr/mnt/wslg/run/user/1000,hrStorageIndex76,hrStorageType1.3.6.1.2.1.25.2.1.4} 33 hrStorageUsed{hrStorageDescr/mnt/wslg/versions.txt,hrStorageIndex50,hrStorageType1.3.6.1.2.1.25.2.1.4} 19 hrStorageUsed{hrStorageDescr/run,hrStorageIndex43,hrStorageType1.3.6.1.2.1.25.2.1.4} 276 hrStorageUsed{hrStorageDescr/run/lock,hrStorageIndex44,hrStorageType1.3.6.1.2.1.25.2.1.4} 0 hrStorageUsed{hrStorageDescr/run/shm,hrStorageIndex45,hrStorageType1.3.6.1.2.1.25.2.1.4} 0 hrStorageUsed{hrStorageDescr/run/user,hrStorageIndex47,hrStorageType1.3.6.1.2.1.25.2.1.4} 63 hrStorageUsed{hrStorageDescr/run/user/1000,hrStorageIndex75,hrStorageType1.3.6.1.2.1.25.2.1.4} 33 hrStorageUsed{hrStorageDescr/snap,hrStorageIndex62,hrStorageType1.3.6.1.2.1.25.2.1.4} 6.0941051e07 hrStorageUsed{hrStorageDescr/tmp/.X11-unix,hrStorageIndex52,hrStorageType1.3.6.1.2.1.25.2.1.4} 63 hrStorageUsed{hrStorageDescr/usr/lib/modules/6.6.87.2-microsoft-standard-WSL2,hrStorageIndex31,hrStorageType1.3.6.1.2.1.25.2.1.4} 0 hrStorageUsed{hrStorageDescr/usr/lib/wsl/lib,hrStorageIndex37,hrStorageType1.3.6.1.2.1.25.2.1.4} 0 hrStorageUsed{hrStorageDescr/var/lib/docker,hrStorageIndex74,hrStorageType1.3.6.1.2.1.25.2.1.4} 6.0941051e07 hrStorageUsed{hrStorageDescrAvailable memory,hrStorageIndex11,hrStorageType1.3.6.1.2.1.25.2.1.1} 0 hrStorageUsed{hrStorageDescrCached memory,hrStorageIndex7,hrStorageType1.3.6.1.2.1.25.2.1.1} 932248 hrStorageUsed{hrStorageDescrMemory buffers,hrStorageIndex6,hrStorageType1.3.6.1.2.1.25.2.1.1} 50448 hrStorageUsed{hrStorageDescrPhysical memory,hrStorageIndex1,hrStorageType1.3.6.1.2.1.25.2.1.2} 1.700964e06 hrStorageUsed{hrStorageDescrShared memory,hrStorageIndex8,hrStorageType1.3.6.1.2.1.25.2.1.1} 4472 hrStorageUsed{hrStorageDescrSwap space,hrStorageIndex10,hrStorageType1.3.6.1.2.1.25.2.1.3} 0 hrStorageUsed{hrStorageDescrVirtual memory,hrStorageIndex3,hrStorageType1.3.6.1.2.1.25.2.1.3} 1.700964e06 # HELP snmp_scrape_duration_seconds Total SNMP time scrape took (walk and processing). # TYPE snmp_scrape_duration_seconds gauge snmp_scrape_duration_seconds{modulehrStorage} 0.005284512 # HELP snmp_scrape_packets_retried Packets retried for get, bulkget, and walk. # TYPE snmp_scrape_packets_retried gauge snmp_scrape_packets_retried{modulehrStorage} 0 # HELP snmp_scrape_packets_sent Packets sent for get, bulkget, and walk; including retries. # TYPE snmp_scrape_packets_sent gauge snmp_scrape_packets_sent{modulehrStorage} 7 # HELP snmp_scrape_pdus_returned PDUs returned from get, bulkget, and walk. # TYPE snmp_scrape_pdus_returned gauge snmp_scrape_pdus_returned{modulehrStorage} 151 # HELP snmp_scrape_walk_duration_seconds Time SNMP walk/bulkwalk took. # TYPE snmp_scrape_walk_duration_seconds gauge snmp_scrape_walk_duration_seconds{modulehrStorage} 0.0049881442.4 设置Prometheus如果监控的后端系统就是Prometheus的话可以配置Prometheus直接从Prometheus SNMP Exporter读取数据。以下是配置示例scrape_configs: - job_name: snmp metrics_path: /snmp params: module: [hrStorage] auth: [public_v2] static_configs: - targets: - 192.168.1.1 - 192.168.1.2 - 192.168.1.3 relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: SNMP_EXPORTER_HOST:9116在这个示例里要监控的SNMP设备的IP地址有3个192.168.1.1、192.168.1.2、192.168.1.3。还需要用Prometheus SNMP Exporter的实际IP地址替换“SNMP_EXPORTER_HOST”。2.5 接入OpenTelemetry的后端服务器如果要把SNMP metrics发送给各种OpenTelemetry的后端服务器(Prometheus是其中一种)那么可以使用OpenTelemetry Collector Contrib使用Prometheus Receiver接收Prometheus SNMP Exporter的数据使用OTLP (或者其它) export输出数据。以下是一个配置的示例receivers: prometheus: config: scrape_configs: - job_name: snmp_hrstorage scrape_interval: 30s scrape_timeout: 25s metrics_path: /snmp params: module: - hrStorage static_configs: - targets: - 192.168.1.10 relabel_configs: # 将原始 target(IP) 保存到 HTTP 参数 target - source_labels: [__address__] target_label: __param_target # 保存原始 target 到 instance 标签 - source_labels: [__param_target] target_label: instance # 将真正访问地址改为 SNMP Exporter - target_label: __address__ replacement: 192.168.1.100:9116 processors: memory_limiter: check_interval: 5s limit_percentage: 80 batch: exporters: otlp: endpoint: 192.168.1.200:4317 tls: insecure: true service: pipelines: metrics: receivers: - prometheus processors: - memory_limiter - batch exporters: - otlp3. OpenTelemetry Collector Contrib的SNMP Receiver3.1 流程优化方面的考虑从基本流程的角度看如果目的是把SNMP接入OpenTelemetry那么先转化成Prometheus的协议就显得冗余。这是因为Prometheus的metrics协议并不是OpenTelemetry的标准metrics协议相当于多了一次转换另外Prometheus的metrics协议并不能百分之百表达所有penTelemetry的标准metrics协议的全部内容。如果能从SNMP直接转换为OpenTelemetry的标准OTLP协议那从效率和严谨性来看肯定是最佳的选择。于是就有了OpenTelemetry Collector Contrib的SNMP Receiver这个解决方案。当然话说回来这个SNMP Receiver还在不断完善之中其成熟度远不如Prometheus的SNMP exporter。3.2 使用OpenTelemetry Collector Contrib的SNMP Receiver我给大家一个可用的配置示例实现上述借助Prometheus SNMP Exporter的同等功能但是采用的方法是直接读取SNMP数据(使用OpenTelemetry Collector Contrib的SNMP Receiver)使用标准的OTLP输出以下是OpenTelemetry Collector Contrib的配置receivers: snmp: endpoint: udp://localhost:161 version: v2c community: public collection_interval: 30s attributes: hrStorageDescr: oid: 1.3.6.1.2.1.25.2.3.1.3 hrStorageType: oid: 1.3.6.1.2.1.25.2.3.1.2 metrics: hrMemorySize: description: Physical RAM unit: By gauge: value_type: int scalar_oids: - oid: 1.3.6.1.2.1.25.2.2.0 hrStorageAllocationUnits: description: Allocation Unit unit: By gauge: value_type: int column_oids: - oid: 1.3.6.1.2.1.25.2.3.1.4 attributes: - name: hrStorageDescr - name: hrStorageType hrStorageSize: description: Storage Size unit: {allocation_unit} gauge: value_type: int column_oids: - oid: 1.3.6.1.2.1.25.2.3.1.5 attributes: - name: hrStorageDescr - name: hrStorageType hrStorageUsed: description: Storage Used unit: {allocation_unit} gauge: value_type: int column_oids: - oid: 1.3.6.1.2.1.25.2.3.1.6 attributes: - name: hrStorageDescr - name: hrStorageType hrStorageAllocationFailures: description: Allocation Failures unit: {request} sum: aggregation: cumulative monotonic: true value_type: int column_oids: - oid: 1.3.6.1.2.1.25.2.3.1.7 attributes: - name: hrStorageDescr - name: hrStorageType exporters: debug: prometheus: endpoint: 0.0.0.0:9464 processors: batch: service: pipelines: metrics: receivers: [snmp] processors: [batch] exporters: [prometheus, debug]大家可以看到这个配置似乎更简洁了。也没有了“walk”之类让不懂SNMP的人懵圈的内容。但是我为什么说OpenTelemetry Collector Contrib的SNMP Receiver还远不如Prometheus SNMP Exporter成熟呢SNMP Receiver的所有配置都需要手写。而Prometheus SNMP Exporter有一个Generator工具可以从MIB文件直接生成。这个手写的工作量还是可观的。一份Prometheus SNMP Exporter的配置可以用于各种SNMP设备。而一个SNMP Receiver实例只能访问一个SNMP设备如果设备很多的话要配置非常多的SNMP Receiver实例使OpenTelemetry Collector Contrib的配置文件极长而难以维护。SNMP Receiver目前是alpha版。当然从长远角度看架构更优的SNMP Receiver会被不断地完善而最终能够取代Prometheus SNMP Exporter的位置。4. 总结本文探讨了SNMP协议在监控领域的演变及其现代化适配方案。文章首先回顾了SNMP作为传统局域网监控协议的地位变迁指出随着OpenTelemetry标准的兴起如何将SNMP指标融入现代监控体系成为关键问题。随后重点介绍了两种技术方案一是通过Prometheus SNMP Exporter将SNMP指标转换为Prometheus格式再通过OpenTelemetry Collector转发二是直接使用OpenTelemetry Collector的SNMP Receiver组件进行采集。文中提供了详细的配置示例和操作指南比较了两种方案的优劣——前者成熟稳定但存在协议转换冗余后者架构更优但尚处开发阶段。最后强调在特定场景如网络设备监控中SNMP仍具价值而OpenTelemetry Collector的SNMP支持功能将持续完善。
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

基于微信小程序的摩尔街网上订餐系统的设计与实现(毕业设计项目源码+文档) 2026/9/11 17:45:27

基于微信小程序的摩尔街网上订餐系统的设计与实现(毕业设计项目源码+文档)

温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:本人主页置顶文章(点我)开头有 CSDN 平台…

阅读更多 →
从零搭建移动UI性能基准测试:用Maestro给应用响应时间定标准 2026/9/11 17:45:27

从零搭建移动UI性能基准测试:用Maestro给应用响应时间定标准

从零搭建移动UI性能基准测试:用Maestro给应用响应时间定标准 【免费下载链接】Maestro Painless E2E Automation for Mobile and Web 项目地址: https://gitcode.com/GitHub_Trending/ma/Maestro 用户说"感觉变卡了",你能立刻说出是布局…

阅读更多 →
P2层PI闭环控制:目标检测中小目标定位的鲁棒性设计 2026/9/11 17:45:27

P2层PI闭环控制:目标检测中小目标定位的鲁棒性设计

1. P2层在目标检测网络中的真实定位:不是“加个头”那么简单很多人看到“P2:PI闭环控制”这个标题,第一反应是——这不就是YOLOv11里加个P2检测头的事?搜一搜“如何在YOLO11中增加一个P2检测头”,满屏都是改config、加…

阅读更多 →
如何在 3 步内跑通 CesiumJS 体素渲染 2026/9/11 17:45:27

如何在 3 步内跑通 CesiumJS 体素渲染

如何在 3 步内跑通 CesiumJS 体素渲染 【免费下载链接】cesium An open-source JavaScript library for world-class 3D globes and maps :earth_americas: 项目地址: https://gitcode.com/GitHub_Trending/ce/cesium 你有没有想过把一层云、一块岩体直接"剖开&quo…

阅读更多 →
用10秒视频克隆你的开源数字人:Duix.Avatar 本地部署实战 2026/9/11 17:45:27

用10秒视频克隆你的开源数字人:Duix.Avatar 本地部署实战

用10秒视频克隆你的开源数字人:Duix.Avatar 本地部署实战 【免费下载链接】Duix-Avatar 🚀 Truly open-source AI avatar(digital human) toolkit for offline video generation and digital human cloning. 项目地址: https://gitcode.com/GitHub_Tre…

阅读更多 →
Python解析百度迁徙指数数据:从Excel XML到人口流动分析 2026/9/11 17:42:27

Python解析百度迁徙指数数据:从Excel XML到人口流动分析

简介:这份数据包提供百度迁徙指数数据,覆盖2022年1月1日至5月13日,并含2021年全年及2019、2020年部分时段,可用于人口流动态势、节假日出行、疫情防控效果等研究场景,适合研究人员、政策分析者及数据分析学习者。压缩包…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞