Grafana 普罗米修斯:帮助编辑/配置snmp导出器&x27;Cisco MIB的s generator.yml文件
我一直在尝试配置Prometheus从Cisco设备收集SNMP信息,然后将该数据发送到Grafana。我遇到的问题是配置生成snmp.yml的generator.yml文件 我遵循了下面列出的说明: 我能够毫无问题地遵循这些步骤。在完成这些步骤时,请下载Cisco MIB。我把它们放在一个目录里。我认为我的主要问题是我不知道如何引用generator.yml文件中的Cisco MIBGrafana 普罗米修斯:帮助编辑/配置snmp导出器&x27;Cisco MIB的s generator.yml文件,grafana,prometheus,prometheus-node-exporter,Grafana,Prometheus,Prometheus Node Exporter,我一直在尝试配置Prometheus从Cisco设备收集SNMP信息,然后将该数据发送到Grafana。我遇到的问题是配置生成snmp.yml的generator.yml文件 我遵循了下面列出的说明: 我能够毫无问题地遵循这些步骤。在完成这些步骤时,请下载Cisco MIB。我把它们放在一个目录里。我认为我的主要问题是我不知道如何引用generator.yml文件中的Cisco MIB ./generator.yml ./mibs/CISCO-MIB ./mibs/CICSO-OTHER-MI
./generator.yml
./mibs/CISCO-MIB
./mibs/CICSO-OTHER-MIB
我尝试了下面列出的示例:
作者给出了一个关于如何为华为编辑generator.yml文件的简短示例
默认的generator.yml将创建一个snmp.yml文件,其中包含预配置的所有模块。所以,我就快到了。我只是需要一点帮助添加我想要的思科模块到它
有谁碰巧知道我会怎么做吗?或者有没有将生成器文件与他们添加的模块/MIB一起使用的经验
以下是默认的generator.yml:
modules:
# Default IF-MIB interfaces table with ifIndex.
if_mib:
walk: [sysUpTime, interfaces, ifXTable]
lookups:
- source_indexes: [ifIndex]
lookup: ifAlias
- source_indexes: [ifIndex]
lookup: ifDescr
- source_indexes: [ifIndex]
# Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
overrides:
ifType:
type: EnumAsInfo
# Cisco Wireless LAN Controller
cisco_wlc:
walk:
- interfaces
- ifXTable
- 1.3.6.1.4.1.14179.2.1.1.1.38 # bsnDot11EssNumberofMobileStations
- 1.3.6.1.4.1.14179.2.2.2.1.2 # bsnAPIfType
- 1.3.6.1.4.1.14179.2.2.2.1.4 # bsnAPIfPhyChannelNumber
- 1.3.6.1.4.1.14179.2.2.2.1.15 # bsnApIfNoOfUsers
- 1.3.6.1.4.1.14179.2.2.6.1 # bsnAPIfDot11CountersTable
- 1.3.6.1.4.1.14179.2.2.13.1.3 # bsnAPIfLoadChannelUtilization
- 1.3.6.1.4.1.14179.2.2.15.1.21 # bsnAPIfDBNoisePower
lookups:
- source_indexes: [bsnDot11EssIndex]
lookup: bsnDot11EssSsid
drop_source_indexes: true
- source_indexes: [bsnAPDot3MacAddress]
lookup: bsnAPName
drop_source_indexes: true
overrides:
ifType:
type: EnumAsInfo
# APC/Schneider UPS Network Management Cards
#
# Note: older management cards only support SNMP v1 (AP9606 and
# AP9607, possibly others). Older versions of the firmware may only
# support v1 as well. If you only have newer cards you can switch to
# version v2c or v3.
#
# The management cards have relatively slow processors so don't poll
# very often and give a generous timeout to prevent spurious
# errors. Alternatively you can eliminate the interface polling (OIDs
# beginning with 1.3.6.1.2.1) to reduce the time taken for polling.
#
# MIB: https://download.schneider-electric.com/files?p_File_Name=powernet426.mib
# Guide: http://www.apc.com/salestools/ASTE-6Z5QEY/ASTE-6Z5QEY_R0_EN.pdf
# Download site: http://www.apc.com/us/en/tools/download/index.cfm
apcups:
version: 1
walk:
- sysUpTime
- interfaces
- 1.3.6.1.4.1.318.1.1.1.2 # upsBattery
- 1.3.6.1.4.1.318.1.1.1.3 # upsInput
- 1.3.6.1.4.1.318.1.1.1.4 # upsOutput
- 1.3.6.1.4.1.318.1.1.1.7.2 # upsAdvTest
- 1.3.6.1.4.1.318.1.1.1.8.1 # upsCommStatus
- 1.3.6.1.4.1.318.1.1.1.12 # upsOutletGroups
- 1.3.6.1.4.1.318.1.1.10.2.3.2 # iemStatusProbesTable
- 1.3.6.1.4.1.318.1.1.26.8.3 # rPDU2BankStatusTable
lookups:
- source_indexes: [upsOutletGroupStatusIndex]
lookup: upsOutletGroupStatusName
drop_source_indexes: true
- source_indexes: [iemStatusProbeIndex]
lookup: iemStatusProbeName
drop_source_indexes: true
overrides:
ifType:
type: EnumAsInfo
rPDU2BankStatusLoadState:
type: EnumAsStateSet
upsAdvBatteryCondition:
type: EnumAsStateSet
upsAdvBatteryChargingCurrentRestricted:
type: EnumAsStateSet
upsAdvBatteryChargerStatus:
type: EnumAsStateSet
# ServerTech Sentry 3 MIB
#
# Used by ServerTech PDUs
#
# ftp://ftp.servertech.com/Pub/SNMP/sentry3/Sentry3OIDTree.txt
# ftp://ftp.servertech.com/Pub/SNMP/sentry3/Sentry3.mib
servertech_sentry3:
walk:
- sysUpTime
- 1.3.6.1.4.1.1718.3.2.2 # infeedTable
- 1.3.6.1.4.1.1718.3.2.3 # outletTable
overrides:
infeedCapacityUsed:
ignore: true # Composite metric: infeedLoadValue / infeedCapacity * 100
infeedVACapacityUsed:
ignore: true # Composite metric: infeedApparentPower / infeedVACapacity * 100
# Palo Alto Firewalls
#
# Palo Alto MIBs can be found here:
# https://www.paloaltonetworks.com/documentation/misc/snmp-mibs.html
#
# PanOS 7.0 enterprise MIBs:
# https://www.paloaltonetworks.com/content/dam/pan/en_US/assets/zip/technical-documentation/snmp-mib-modules/PAN-MIB-MODULES-7.0.zip
#
# Tested on a Palo Alto Networks PA-3020 series firewall
#
paloalto_fw:
walk:
- sysUpTime
- interfaces
- hrDevice
- hrSystem
- hrStorage
- 1.3.6.1.4.1.25461.2.1.2.1 # panSys
- 1.3.6.1.4.1.25461.2.1.2.3 # panSession
- 1.3.6.1.4.1.25461.2.1.2.5 # panGlobalProtect
# Arista Networks
#
# Arista Networks MIBs can be found here: https://www.arista.com/en/support/product-documentation/arista-snmp-mibs
#
# https://www.arista.com/assets/data/docs/MIBS/ARISTA-ENTITY-SENSOR-MIB.txt
# https://www.arista.com/assets/data/docs/MIBS/ARISTA-SW-IP-FORWARDING-MIB.txt
#
# Tested on Arista DCS-7010T-48 switch
#
arista_sw:
walk:
- sysUpTime
- interfaces
- ifXTable
- 1.3.6.1.2.1.25.3.3.1.2 # hrProcessorLoad
- 1.3.6.1.2.1.25.2.3.1.6 # hrStorageUsed
- 1.3.6.1.4.1.30065.3.1.1 # aristaSwFwdIp
overrides:
ifType:
type: EnumAsInfo
# Synology
#
# Synology MIBs can be found here:
# http://www.synology.com/support/snmp_mib.php
# http://dedl.synology.com/download/Document/MIBGuide/Synology_MIB_File.zip
#
# Tested on RS2414rp+ NAS
#
synology:
walk:
- interfaces
- sysUpTime
- ifXTable
- laNames
- laLoadInt
- ssCpuUser
- ssCpuSystem
- ssCpuIdle
- memory
- hrStorage
- 1.3.6.1.4.1.6574.1 # synoSystem
- 1.3.6.1.4.1.6574.2 # synoDisk
- 1.3.6.1.4.1.6574.3 # synoRaid
- 1.3.6.1.4.1.6574.4 # synoUPS
- 1.3.6.1.4.1.6574.5 # synologyDiskSMART
- 1.3.6.1.4.1.6574.6 # synologyService
- 1.3.6.1.4.1.6574.101 # storageIO
- 1.3.6.1.4.1.6574.102 # spaceIO
- 1.3.6.1.4.1.6574.104 # synologyiSCSILUN
lookups:
- source_indexes: [spaceIOIndex]
lookup: spaceIODevice
drop_source_indexes: true
- source_indexes: [storageIOIndex]
lookup: storageIODevice
drop_source_indexes: true
- source_indexes: [serviceInfoIndex]
lookup: serviceName
drop_source_indexes: true
- source_indexes: [ifIndex]
# Use OID to avoid conflict with Netscaler NS-ROOT-MIB.
lookup: 1.3.6.1.2.1.31.1.1.1.1 # ifName
drop_source_indexes: true
- source_indexes: [diskIndex]
lookup: diskID
drop_source_indexes: true
- source_indexes: [raidIndex]
lookup: raidName
drop_source_indexes: true
- source_indexes: [laIndex]
lookup: laNames
drop_source_indexes: true
- source_indexes: [hrStorageIndex]
lookup: hrStorageDescr
drop_source_indexes: true
overrides:
ifType:
type: EnumAsInfo
# DD-WRT
#
# The list of SNMP OIDs to care about for DD-WRT can be found here: https://www.dd-wrt.com/wiki/index.php/SNMP#Known_OID.C2.B4s_via_SNMP
#
# Tested on DD-WRT v3.0-r31825 (04/06/17) with an ASUS RT-AC66U
#
ddwrt:
walk:
- sysUpTime
- interfaces
- ifXTable
- 1.3.6.1.2.1.25.2 # hrStorage
- 1.3.6.1.4.1.2021.4 # memory
- 1.3.6.1.4.1.2021.10.1.1 # laIndex
- 1.3.6.1.4.1.2021.10.1.2 # laNames
- 1.3.6.1.4.1.2021.10.1.5 # laLoadInt
- 1.3.6.1.4.1.2021.11 # systemStats
lookups:
- source_indexes: [ifIndex]
lookup: ifDescr
drop_source_indexes: true
- source_indexes: [laIndex]
lookup: laNames
drop_source_indexes: true
overrides:
ifType:
type: EnumAsInfo
# Ubiquiti / AirMAX
#
# https://dl.ubnt.com/firmwares/airos-ubnt-mib/ubnt-mib.zip
#
ubiquiti_airmax:
version: 1
walk:
- sysUpTime
- interfaces
- ifXTable
- 1.3.6.1.4.1.41112.1.4 # ubntAirMAX
overrides:
ifType:
type: EnumAsInfo
# Ubiquiti / UniFi
#
# http://dl.ubnt-ut.com/snmp/UBNT-MIB
# http://dl.ubnt-ut.com/snmp/UBNT-UniFi-MIB
#
ubiquiti_unifi:
walk:
- sysUpTime
- interfaces
- ifXTable
- 1.3.6.1.4.1.41112.1.6 # ubntUniFi
overrides:
ifType:
type: EnumAsInfo
# keepalived
#
# https://github.com/acassen/keepalived/blob/master/doc/KEEPALIVED-MIB.txt
keepalived:
walk:
- vrrpInstanceTable # Table of VRRP instances.
- vrrpSyncGroupTable # Table of sync groups.
- virtualServerGroupTable # Table of virtual server groups.
- virtualServerTable # Table of virtual servers.
- realServerTable # Table of real servers. This includes regular real servers and sorry servers.
overrides:
vrrpSyncGroupScriptMaster:
ignore: true # Non-metric display string.
vrrpSyncGroupScriptBackup:
ignore: true # Non-metric display string.
vrrpSyncGroupScriptFault:
ignore: true # Non-metric display string.
vrrpSyncGroupScript:
ignore: true # Non-metric display string.
vrrpSyncGroupScriptStop:
ignore: true # Non-metric display string.
vrrpInstanceLvsSyncDaemon:
ignore: true # Deprecated.
vrrpInstanceLvsSyncInterface:
ignore: true # Deprecated.
vrrpInstanceScriptMaster:
ignore: true # Non-metric display string.
vrrpInstanceScriptBackup:
ignore: true # Non-metric display string.
vrrpInstanceScriptFault:
ignore: true # Non-metric display string.
vrrpInstanceScriptStop:
ignore: true # Non-metric display string.
vrrpInstanceScript:
ignore: true # Non-metric display string.
vrrpInstanceScriptMstrRxLowerPri:
ignore: true # Non-metric display string.
# Printer: RFC 3805
#
# https://tools.ietf.org/html/rfc3805
# https://www.iana.org/assignments/ianaprinter-mib/ianaprinter-mib.xhtml
printer_mib:
walk:
- sysUpTime
- hrPrinterStatus
- prtGeneralReset
- prtConsoleDisable
- prtGeneralPrinterName
- prtGeneralSerialNumber
- prtAlertCriticalEvents
- prtAlertAllEvents
- prtCoverStatus
- prtMarkerSuppliesLevel
- prtMarkerSuppliesMaxCapacity
- prtMarkerSuppliesType
lookups:
- source_indexes: [hrDeviceIndex, prtMarkerSuppliesIndex]
lookup: prtMarkerSuppliesType
overrides:
hrPrinterStatus:
type: EnumAsStateSet
prtGeneralReset:
type: EnumAsStateSet
prtConsoleDisable:
type: EnumAsStateSet
prtGeneralPrinterName:
type: DisplayString
prtGeneralSerialNumber:
type: DisplayString
prtCoverStatus:
type: EnumAsStateSet
MIB应位于目录
MIBS
,该目录与generator.yml文件位于同一根目录中
./generator.yml
./mibs/CISCO-MIB
./mibs/CICSO-OTHER-MIB
我建议使用Docker映像来构建snmp.yml文件,这样NetSNMP将只使用工作区中的MIB,而不使用操作系统中的其他MIB
docker run -ti -v "${PWD}:/opt/" snmp-generator generate
如果生成器失败,可以搜索缺少OID的MIB,也可以是MIB引用了需要添加到目录中的其他OID。您可以通过以下方式看到这一点:
docker run -ti -v "${PWD}:/opt/" snmp-generator parse_errors | head
它将告诉您找不到哪些MIB。MIB应放在与generator.yml文件位于同一根目录中的目录
MIBS
./generator.yml
./mibs/CISCO-MIB
./mibs/CICSO-OTHER-MIB
我建议使用Docker映像来构建snmp.yml文件,这样NetSNMP将只使用工作区中的MIB,而不使用操作系统中的其他MIB
docker run -ti -v "${PWD}:/opt/" snmp-generator generate
如果生成器失败,可以搜索缺少OID的MIB,也可以是MIB引用了需要添加到目录中的其他OID。您可以通过以下方式看到这一点:
docker run -ti -v "${PWD}:/opt/" snmp-generator parse_errors | head
它将告诉您找不到哪些MIB。“由于对NetSNMP的动态依赖性,您必须自己构建生成器。”
起初我并不清楚这一点。它的实际含义是,
“…您必须自己构建生成器.yml文件”
我的期望是生成器将使用我放在mibs目录下的MIB文件创建snmp.yml,但事实并非如此
但是,您仍然需要将mib文件放在mib下,因为生成器在生成snmp.yml文件时会查找这些值
./generator.yml
./mibs/CISCO-MIB
./mibs/CICSO-OTHER-MIB
# Qnap
qnap:
walk:
- 1.3.6.1.4.1.24681.1.2.11.1.3.1 # HdTemperature.1
- 1.3.6.1.4.1.24681.1.2.11.1.3.2 # HdTemperature.2
- 1.3.6.1.4.1.24681.1.2.11.1.3.3 # HdTemperature.3
- 1.3.6.1.4.1.24681.1.2.11.1.3.4 # HdTemperature.4
满意后,按照说明中的指示运行模块(目前为2021年3月)
由于对NetSNMP的动态依赖性,您必须自己生成生成器
起初我并不清楚这一点。它的实际含义是,
“…您必须自己构建生成器.yml文件”
我的期望是生成器将使用我放在mibs目录下的MIB文件创建snmp.yml,但事实并非如此
但是,您仍然需要将mib文件放在mib下,因为生成器在生成snmp.yml文件时会查找这些值
./generator.yml
./mibs/CISCO-MIB
./mibs/CICSO-OTHER-MIB
# Qnap
qnap:
walk:
- 1.3.6.1.4.1.24681.1.2.11.1.3.1 # HdTemperature.1
- 1.3.6.1.4.1.24681.1.2.11.1.3.2 # HdTemperature.2
- 1.3.6.1.4.1.24681.1.2.11.1.3.3 # HdTemperature.3
- 1.3.6.1.4.1.24681.1.2.11.1.3.4 # HdTemperature.4
满意后,按照说明中的指示运行模块(目前为2021年3月)