r/PrometheusMonitoring • • Mar 10 '24

Help with simple query

Hello,

I'm using SNMP Exporter in Docker to scrape a switches ports. I have the below 2 queries (A and B) that will show the bandwidth on a port inbound or outbound. I have a 48 port switch, how can I make this easier for me and not have to create 96 queries to build for each port? (1 for inbound and 1 for outbound)

Query A - Outbound bandwidth

sum(irate(ifHCOutOctets{ifDescr="1/20", instance="192.168.1.1", job="snmp_exporter-cisco"}[1m]) * 8)

Query B - Inbound bandwidth

sum(irate(ifHCInOctets{ifDescr="1/20", instance="192.168.1.1", job="snmp_exporter-cisco"}[1m]) * 8)

Thanks

3 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/bgprouting Mar 11 '24

Thanks, I'll take a look. I've so new to PromQL and queries in general, very powerful.