snmp_exporter icon indicating copy to clipboard operation
snmp_exporter copied to clipboard

snmp_exporter config to show relevant values HEX string from specific MIB juniper

Open HappyFX opened this issue 6 years ago • 3 comments

I have problem with display the result in readable form: http://oidref.com/1.3.6.1.2.1.15.6.1.5

bgp4PathAttrASPathSegment OBJECT-TYPE
SYNTAX OCTET STRING (SIZE (2..255))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The sequence of AS path segments. Each AS
path segment is represented by a triple
The type is a 1-octet field which has two
possible values:
1 AS_SET: unordered set of ASs a
route in the UPDATE
message has traversed
2 AS_SEQUENCE: ordered set of ASs
a route in the UPDATE
message has traversed.
The length is a 1-octet field containing the
number of ASs in the value field.
The value field contains one or more AS
numbers, each AS is represented in the octet
string as a pair of octets according to the
following algorithm:
first-byte-of-pair = ASNumber / 256;
second-byte-of-pair = ASNumber & 255;"

For example I used Juniper as SNMP target. snmp walk result: iso.3.6.1.2.1.15.6.1.5.10.0.1.0.24.10.0.1.15 = Hex-STRING: 02 03 FD EA FF FF FF FF My config snmp.yml:

ipv4_juniper:
  walk:
    - 1.3.6.1.2.1.15.6.1.5.10.0.1.0
  metrics:
  - name: snmp_bgp_AS_path
    oid: 1.3.6.1.2.1.15.6.1.5
    type: OctetString
    help: The sequence of AS path segments - /32
    indexes:
    - labelname: snmp_addr_prefix
      type: InetAddressIPv4
    - labelname: snmp_addr_prefix_len
      type: gauge
    - labelname: snmp_attr_peer
      type: InetAddressIPv4

snmp_exporter result: snmp_bgp_AS_path{snmp_addr_prefix="10.0.1.0",snmp_addr_prefix_len="24",snmp_attr_peer="10.0.1.15",snmp_bgp_AS_path="0x0203FDEAFFFFFFFF"} 1

desire result: snmp_bgp_AS_path{snmp_addr_prefix="10.0.1.0",snmp_addr_prefix_len="24",snmp_attr_peer="10.0.1.15",snmp_as_set_type="2",snmp_as_length="3",snmp_bgp_AS_path="[65002,65535,65535]"} 1

base logic: value from snmp: Hex-STRING: 02 03 FD EA FF FF FF FF then I need to group: [[02],[03],[FDEA],[FFFF],[FFFF]] and convert hex to dec: 2 3 65002 65535 65535

HappyFX avatar Dec 04 '19 14:12 HappyFX

This is a bespoke format that requires being able to understand English in order to parse so it's pretty unlikely we'll support this - particularly as the SYNTAX is telling us that this is an arbitrary binary string with no further formatting information. I'd suggest requesting that your vendor provide the data in a form that uses more standard SNMP schema approaches, such as using a table with an entry per AS and having a separate object to indicate if it's ordered.

I also note that this information seems very log-y, and is likely not suitable for use as a metric on cardinality/churn grounds.

brian-brazil avatar Dec 04 '19 14:12 brian-brazil

I guess it's not a generator task, but it will be nice if this option will be able to config in snmp.yml by user

HappyFX avatar Dec 04 '19 14:12 HappyFX

The above is about both the exporter and generator, I'm not willing to add code to handle every time an object is discovered that has its own unique way of doing things.

brian-brazil avatar Dec 04 '19 15:12 brian-brazil