Hi,
Im using snmp_exporter to monitor Server, Network and USPs with snmp_exporter. I generated the snmp.yml file with the official snmp_exporter generator from github.
cat generator.yml
---
modules:
#
http://oidref.com/1.3.6.1.4.1.674.10892.5 outOfBandGroup:
walk:
- 1.3.6.1.4.1.674.10892.5
apcups:
walk:
- 1.3.6.1.4.1.318.1.1.1.12
- 1.3.6.1.4.1.318.1.1.1.2
- 1.3.6.1.4.1.318.1.1.1.3
- 1.3.6.1.4.1.318.1.1.1.4
- 1.3.6.1.4.1.318.1.1.1.7.2
- 1.3.6.1.4.1.318.1.1.10.2.3.2
- 1.3.6.1.4.1.318.1.1.26.10.2.2
- 1.3.6.1.4.1.318.1.1.26.4.3
- 1.3.6.1.4.1.318.1.1.26.6.3
- 1.3.6.1.4.1.318.1.1.26.8.3
#get:
# - 1.3.6.1.4.1.318.1.1.1.8.1.0
if_mib:
walk:
- 1.3.6.1.2.1.2
- 1.3.6.1.2.1.31.1.1
#get:
# - 1.3.6.1.2.1.1.3.0
The Server Monitoring with outOfBandGroup & if_mib does work without any problems, but apcups gets the error.
cat prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'Linux'
rule_files:
- "prometheus.rules.yml"
- "alert.rules.yml"
alerting:
alertmanagers:
- static_configs:
- targets:
- prom01.xxxx.xx:9093
scrape_configs:
- job_name: prometheus
static_configs:
- targets: [prom01.xxxx.xx:9090]
- job_name: node
scrape_interval: 15s
static_configs:
- targets: [prom01.xxx.xx:9100]
- job_name: 'snmpServer'
scrape_interval: 2m
scrape_timeout: 2m
static_configs:
- targets:
#Ansible SNMP
- server01
- server02
metrics_path: /snmp
params:
#auth: [public_v2]
module: [outOfBandGroup]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: prom01.xxx.xx:9116 # The SNMP exporter's real hostname:port.
- job_name: 'snmpNetwork'
scrape_interval: 2m
scrape_timeout: 2m
static_configs:
- targets:
#Ansible SNMPNETWORK
- switch01
- switch02
metrics_path: /snmp
params:
#auth: [public_v2]
module: [if_mib]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: prom01.xxx.xx:9116 # The SNMP exporter's real hostname:port.
- job_name: 'snmpUPS'
scrape_interval: 2m
scrape_timeout: 2m
static_configs:
- targets:
#Ansible SNMPUPS
- usv-rack01-01.xxx.xx
metrics_path: /snmp
params:
#auth: [public_v2]
module: [apcups]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: prom01.xxx.xx:9116 # The SNMP exporter's real hostname:port.
curl -g '
http://prom01.xxx.xx:9116/snmp?target=usv-rack01-01.xxx.xx&module=apcups'
An error has occurred while serving metrics:
110 error(s) occurred:
* collected metric "upsHighPrecBatteryPackSerialNumber" { label:<name:"upsHighPrecBatteryPackSerialNumber" value:"2" > gauge:<value:1 > } was collected before with the same name and label values
* collected metric "upsHighPrecBatteryPackSerialNumber" { label:<name:"upsHighPrecBatteryPackSerialNumber" value:"5" > gauge:<value:1 > } was collected before with the same name and label values
* collected metric "upsHighPrecBatteryPackTemperature" { label:<name:"upsHighPrecBatteryPackTemperature" value:"11" > gauge:<value:0 > } was collected before with the same name and label values
* collected metric "upsHighPrecBatteryPackCartridgeReplaceDate" { label:<name:"upsHighPrecBatteryPackCartridgeReplaceDate" value:"2" > gauge:<value:1 > } was collected before with the same name and label values
* collected metric "upsHighPrecBatteryPackTemperature" { label:<name:"upsHighPrecBatteryPackTemperature" value:"2" > gauge:<value:210 > } was collected before with the same name and label values
As i generated the snmp.yml with this official generator i do not know how to handle this.
I also attached the snmp.yml im using. Of course i noticed that there are labelnames(indexes) doubled but that the way the snmp.yml file was generated.
for example:
- name: upsOutletGroupStatusIndex
oid: 1.3.6.1.4.1.318.1.1.1.12.1.2.1.1
type: gauge
help: The index to the outlet group entry. - 1.3.6.1.4.1.318.1.1.1.12.1.2.1.1
indexes:
- labelname: upsOutletGroupStatusIndex
type: gauge
- name: upsOutletGroupStatusName
oid: 1.3.6.1.4.1.318.1.1.1.12.1.2.1.2
type: DisplayString
help: The name of the outlet group - 1.3.6.1.4.1.318.1.1.1.12.1.2.1.2
indexes:
- labelname: upsOutletGroupStatusIndex
type: gauge
Every help is appreciated!!!