Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect processing of IP Address with mask using type "IpAddr" #243

Closed
edgarswed opened this issue Nov 3, 2017 · 2 comments
Closed

Incorrect processing of IP Address with mask using type "IpAddr" #243

edgarswed opened this issue Nov 3, 2017 · 2 comments

Comments

@edgarswed
Copy link

Host operating system:

Linux exporter-host 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

snmp_exporter version:

snmp_exporter, version 0.6.0 (branch: HEAD, revision: 4388d68)
build user: root@fd9cde4d0842
build date: 20170822-11:04:46
go version: go1.8.3

What did you do that produced an error?

Was trying to collect some snmp metrics from host. Faced an error:

server returned HTTP status 500 Internal Server Error

snmp_exporter error

An error has occurred during metrics gathering:

9 error(s) occurred:
* collected metric bgpPeerAdvertisedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.1" > gauge:<value:3403 >  was collected before with the same name and label values
* collected metric bgpPeerAcceptedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.1" > gauge:<value:78 >  was collected before with the same name and label values
* collected metric bgpPeerAcceptedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.3" > gauge:<value:11 >  was collected before with the same name and label values
* collected metric bgpPeerAdvertisedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.3" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric bgpPeerDeniedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.3" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric bgpPeerDeniedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.212" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric bgpPeerAdvertisedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.212" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric bgpPeerDeniedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.1" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric bgpPeerAcceptedPrefixes label:<name:"BgpRemoteIP" value:"1.1.1.212" > gauge:<value:25 >  was collected before with the same name and label values

What did you expect to see?

Not see, but to collect metrics. And it seems that type: IpAddr doesn't correctly processes IP address with mask. It takes only first 4 octets after oid and ignores last two, which are /mask. So I'm getting an error because (for example) 1.1.1.212/128 and 1.1.1.212/1 become the same and looks like: 1.1.1.212

Part of snmp.yml config

    - name: bgpPeerAcceptedPrefixes
      oid: 1.3.6.1.4.1.9.9.187.1.2.4.1.1
      type: gauge
      indexes:
      - labelname: BgpRemoteIP
        type: IpAddr
    - name: bgpPeerDeniedPrefixes
      oid: 1.3.6.1.4.1.9.9.187.1.2.4.1.2
      type: gauge
      indexes:
      - labelname: BgpRemoteIP
        type: IpAddr
    - name: bgpPeerAdvertisedPrefixes
      oid: 1.3.6.1.4.1.9.9.187.1.2.4.1.6
      type: gauge
      indexes:
      - labelname: BgpRemoteIP
        type: IpAddr

snmpwalk response:

[root@exporter-host ~]# snmpwalk -v 2c -c secret target-host.domain 1.3.6.1.4.1.9.9.187.1.2.4.1.1
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.1.1.1 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.1.1.128 = Counter32: 78
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.3.1.1 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.3.1.128 = Counter32: 11
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.212.1.1 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.1.1.1.212.1.128 = Counter32: 25
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.1.192.168.123.177.1.128 = Counter32: 123
[root@exporter-host ~]# snmpwalk -v 2c -c secret target-host.domain 1.3.6.1.4.1.9.9.187.1.2.4.1.2
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.1.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.1.1.128 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.3.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.3.1.128 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.212.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.1.1.1.212.1.128 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.2.192.168.123.177.1.128 = Gauge32: 109
[root@exporter-host ~]# snmpwalk -v 2c -c secret target-host.domain 1.3.6.1.4.1.9.9.187.1.2.4.1.6
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.1.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.1.1.128 = Gauge32: 3403
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.3.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.3.1.128 = Gauge32: 3403
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.212.1.1 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.1.1.1.212.1.128 = Gauge32: 3403
SNMPv2-SMI::enterprises.9.9.187.1.2.4.1.6.192.168.123.177.1.128 = Gauge32: 91
@SuperQ
Copy link
Member

SuperQ commented Nov 3, 2017

snmp.yml.gz
What is the generator.yml you used to produce this? It looks like your indexing is off compared to what I see from CISCO-BGP4-MIB

modules:
  cisco_bgp4:
    walk:
      - 1.3.6.1.4.1.9.9.187.1.2.4.1 # cbgpPeerAddrFamilyPrefixEntry

This produces these metrics:

cisco_bgp4:
  walk:
  - 1.3.6.1.4.1.9.9.187.1.2.4.1
  metrics:
  - name: cbgpPeerAcceptedPrefixes
    oid: 1.3.6.1.4.1.9.9.187.1.2.4.1.1
    type: counter
    help: Number of accepted route prefixes on this connection, which belong to an
      address family. - 1.3.6.1.4.1.9.9.187.1.2.4.1.1
    indexes:
    - labelname: bgpPeerRemoteAddr
      type: IpAddr
    - labelname: cbgpPeerAddrFamilyAfi
      type: gauge
    - labelname: cbgpPeerAddrFamilySafi
      type: gauge

See attached snmp.yaml

@edgarswed
Copy link
Author

Not a bug. Your proper configuration solved the issue for me.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants