This has been bothering me for a while, and hopefully someone has a solution I am simply overlooking.
I use snmp_exporter to pull power metrics from a bunch of different PDU vendors (APC, Raritan, Geist, ServerTech, etc). I have one Prometheus scrape job & module per vendor to store all the PDU total power data in a metric named pduInputPowerConsumption
All of these vendors report the power in Watts, except for APC - which reports in " hundredths of kilowatts (decawatts)"
So throughout all my Grafana dashboards where I have to aggregate the total power consumption from all the different PDU vendors I currently just multiply the APC metrics by 10 to convert to watts like the other PDUs.
sum(pduInputPowerConsumption{job="apc_pdus"}*10 OR on() vector(0))
+
sum(pduInputPowerConsumption{job!="apc_pdus"} OR on() vector(0))
Is there a way that I can just scale *10 the apc_pdu collected metric on the prometheus backend via the prometheus.yml scrape config along with my relabel_configs or metric_relabel_configs?
Is there something else I am blatantly overlooking?
# Scrape config for snmp_exporter polling APC PDU power metric pduInputPowerConsumption
- job_name: 'apc_pdus'
scrape_interval: 3m # Set the SNMP scrape inverval for every 3 mins
scrape_timeout: 45s # Set the scrape timeout to 45 seconds (3 retries = 2.25 mins)
metrics_path: /snmp
params:
module: [apc_pdus]
file_sd_configs:
- files:
- /etc/prometheus/snmp-targets/apc_pdus_*.json
# Attempt to re-read files every five minutes.
refresh_interval: 5m
relabel_configs:
- source_labels: [__meta_filepath]
regex: '.*_(\w{4})\.json'
replacement: $1
target_label: site
- source_labels: [__address__]
target_label: ip_address
- source_labels: [__address__]
target_label: __param_target
- target_label: __address__
replacement: 10.0.XX.XX:9116 # SNMP exporter.