Prometheus SNMP exporter/generator lookups

38 views
Skip to first unread message

Marko Juričić

unread,
May 8, 2020, 5:11:10 AM5/8/20
to Prometheus Users
Hi,

in our devices we have devices that provide this kind of metrics trough SNMP Exporter and Prometheus:

ifAlias{ifAlias="IP Phones",ifIndex="10013",instance="instance="XX"",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifHCInOctets{ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifOutUcastPkts{ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-2"}

Is it possible to add ifAlias label from IfAlias metrics to other metrics that have the same ifIndex value?

Goal output: 

ifHCInOctets{ifAlias="IP Phones",ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifOutUcastPkts{ifAlias="IP Phones",ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-2"}

Goal is to add ifAlias to all instances that have the same ifIndex. Lookups in generator were my first idea but somehow I am unable to make it work.
Data is delivered trough snmp_exporter using generator to generate snmp.yml file.

Thank you!

Brian Brazil

unread,
May 8, 2020, 5:21:01 AM5/8/20
to Marko Juričić, Prometheus Users
Lookups can do this, what did you try in the generator.yml?

--

Marko Juričić

unread,
May 8, 2020, 5:27:22 AM5/8/20
to Prometheus Users
  cisco_switch_community:
    walk:
      - 1.3.6.1.2.1.2.2.1.10
      - 1.3.6.1.2.1.2.2.1.11
      - 1.3.6.1.2.1.2.2.1.16
      - 1.3.6.1.2.1.2.2.1.17
      - 1.3.6.1.2.1.31.1.1.1.10
      - 1.3.6.1.2.1.31.1.1.1.11
      - 1.3.6.1.2.1.31.1.1.1.6
      - 1.3.6.1.2.1.31.1.1.1.7
      - 1.3.6.1.2.1.31.1.1.1.18
      - 1.3.6.1.2.1.4.6
      - 1.3.6.1.4.1.43.45.1.6.1.1.1.2.65536
      - 1.3.6.1.4.1.9.10.106.1.5.1.1
      - 1.3.6.1.4.1.9.10.106.1.5.1.2
      - 1.3.6.1.4.1.9.10.106.1.5.1.3
      - 1.3.6.1.4.1.9.10.106.1.5.1.4
      - 1.3.6.1.4.1.9.2.1.57
      - 1.3.6.1.4.1.9.2.1.58
      - 1.3.6.1.4.1.9.9.109.1.1.1.1.7
      - 1.3.6.1.4.1.9.9.109.1.1.1.1.8
      - 1.3.6.1.4.1.9.9.13.1.3.1.3
      - 1.3.6.1.4.1.9.9.91.1.1.1.1.4
      - 1.3.6.1.4.1.9.9.48.1.1.1.5.1
      - 1.3.6.1.4.1.9.9.48.1.1.1.6.1
      - 1.3.6.1.4.1.9.9.48.1.1.1.5.2
      - 1.3.6.1.4.1.9.9.48.1.1.1.6.2
    
    lookups:
      - source_indexes: [ifIndex]
        lookup: ifAlias

    version: 2
    max_repetitions: 0
    retries: 3
    timeout: 10s

    auth:
      community: community

result of generate:
WARN[0001] NetSNMP reported 7 parse errors               source="main.go:103"
FATA[0001] Error parsing yml config: yaml: unmarshal errors:
  line 450: field source_indexes not found in type main.Lookup
  line 451: field lookup not found in type main.Lookup  source="main.go:44"

I also tried:
    lookups:
      - source_indexes: [ifAlias]
        lookup: ifIndex

Thank You for quick response!

Brian Brazil

unread,
May 8, 2020, 5:36:27 AM5/8/20
to Marko Juričić, Prometheus Users
You've an old version of the generator, build the latest off master.

Brian
 

I also tried:
    lookups:
      - source_indexes: [ifAlias]
        lookup: ifIndex

Thank You for quick response!

Dana petak, 8. svibnja 2020. u 11:21:01 UTC+2, korisnik Brian Brazil napisao je:
On Fri, 8 May 2020 at 10:11, Marko Juričić <markoju...@gmail.com> wrote:
Hi,

in our devices we have devices that provide this kind of metrics trough SNMP Exporter and Prometheus:

ifAlias{ifAlias="IP Phones",ifIndex="10013",instance="instance="XX"",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifHCInOctets{ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifOutUcastPkts{ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-2"}

Is it possible to add ifAlias label from IfAlias metrics to other metrics that have the same ifIndex value?

Goal output: 

ifHCInOctets{ifAlias="IP Phones",ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-1"}
ifOutUcastPkts{ifAlias="IP Phones",ifIndex="10013",instance="XX",job="CISCO_SWITCH",name="sw-lan-1kat-2"}

Goal is to add ifAlias to all instances that have the same ifIndex. Lookups in generator were my first idea but somehow I am unable to make it work.

Lookups can do this, what did you try in the generator.yml?

--

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1b4589ff-c4fd-4655-b5b2-05f12201e60c%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages