Skip to content

Component: SNMP Metrics

Toni Moreno edited this page Dec 27, 2017 · 29 revisions

SNMP Metrics

This component allows the user define core metrics to be collected from the device.

View

Configured SNMP Metrics are shown as table. This will appear every time you navigate from menu.

SNMP Metric List

Add/Edit SNMP Metrics

  • Add: In the SNMP Metrics list click on new button New Button

  • Edit: Click on SNMP Metric edit's button Edit Button

The Create/Modify form will show up:

Create/Modify SNMP Metrics

Configuration Parameters

Type of settings Config Parameter Description
Core settings ID Text String that uniquely identify the metric recommended use the MIB Name, should be unique in the database
FieldName Set the "field" name inside a Influx measurement, could be the same of id or not, should be unique inside the measurement where the metric will be sent.
Metric settings DataSrcType Origin data type could be one of these:
  • (SNMP SMI Type) INTEGER
  • (SNMP SMI Type)
IsTag If true data will be sent as a Influxdb "TAG". (default is false)Integer32
  • (SNMP SMI Type) Gauge32
  • (SNMP SMI Type) UInteger32
  • (SNMP SMI Type) Unsigned32
  • (SNMP SMI Type) Counter32
  • (SNMP SMI Type) Counter64
  • (SNMP SMI Type) TimeTicks
  • (SNMP SMI Type) OCTETSTRING
  • (SNMP SMI Type) IpAddress
  • (Cooked type) TIMETICKS [Compute TimeTicks to seconds]
  • (Cooked type) COUNTER32 [Compute increments for 32 bit counters]
  • (Cooked type) COUNTER64 [Compute increments for 64 bit counters]
  • (Cooked type) COUNTERXX [Compute increments only if it really increments -- as NON_NEGATIVE_DERIVATIVE does--]
  • (Cooked type) HWADDR [ Translate Hardware Address (MAC) from STRING]
  • (Cooked type) STRINGPARSER [ Compute values from Regex ]
  • (Cooked type) STRINGEVAL [evaluate data from other metrics]
  • (Cooked type) CONDITIONEVAL [evaluate OID table with boolean conditions and get number of true values]
  • (Cooked type) MULTI-STRINGPARSER (generates multiple fields or tags from an snmp returned string and an Regular expression with multiple capturing groups)
  • BaseOID Snmp OID for this metric ( could be the base OID when it belongs to a snmp indexed table), could not be set only if datasrctype is of type "String Eval".
    ExtraData data needed to special data types as String Eval(evaluated expression needed) or String Parser(regex needed)
    GetRate Only useful on counter types , if true value sent will be the computed difference and after divided by the number of elapsed seconds between snmp calls
    Metric autoscale Scale if set (as a floating point value) computed data will be scaled before sent.
    Shift if set (as a floating point value) computed data will be shifted before sent.
    Extra settings Description any useful discretion to understand data gathered for this metric ( recommended place here units of the measurement).

    Notes: The SnmpCollector Metric engine computes all its data and sent them as floating point values to the database, except for tags that will be sent as text strings

    Multi edit in SNMP Metrics

    Multi edit has 2 options: Remove and Change property

    1. Remove: Allows to remove all the selected items

    2. Change property: Allows to change the selected property of all the selected items. The properties are the same defined in the configuration.

    Property Type Options/Values
    DataSrcType Selector
  • INTEGER,Integer32,Gauge32,UInteger32,Unsigned32,Counter32,Counter64
  • TimeTicks,OCTETSTRING,IpAddress,TIMETICKS,COUNTER32,COUNTER64,COUNTERXX
  • HWADDR,STRINGPARSER,STRINGEVAL,CONDITIONEVAL
  • Scale Input Any number
    Shift Input Any number
    IsTag Selector True / False

    About MULTISTRINGPARSER Metrics

    From 0.7.6 version , there is a new metric type and the first capable to generate more than one field/tag with only one metric definition. Will parse data with regex with capturing groups and each capture group will be attached to a definition ITEM, each definition ITEM will generate a Field or a Tag. We assume that the origin got data from devices are readable strings.

    Configuration will be placed in:

    • FieldName: Comma separated value of ITEM definitions
    • ExtraData: Regular expression with multiple capturing groups

    by example:

    • FieldName: F|field_name_1|CONV1,F|field_name_2|CONV2,T|tag_name1|CONV3
    • ExtraData: '([^;]*);([^;]*);([^;]*);' <-regexp

    Is necessary configure as many ITEMS as capturing groups.

    Each ITEM in the FieldName needs for 3 parameters before to be sent.

    TYPE|NAME|CONVERSION

    configuration what means
    TYPE F = Field , T = Tag ( this parameter invalidates the use of isTag flag in the metric definition)
    NAME Field/Tag Name will be sent to the InfluxDB
    CONVERSION how should evaluate the returned string? possible values (STR

    Fields/Tag definitions will be evaluated as:

    CONVERSORS Conversion type (from String)
    STR to maintain as string ( no conversion will be done)
    INT to convert as and 64bits integer
    FP to convert as and 64 bits floating point
    BL to convert as a boolean

    About STRINGEVAL Metrics

    The StringEval Metric type let us compute any value from an "expression evalutation" , the expression could be mathematical or logical. Available documentation on what kind of evaluations could snmpcollector do could be read here EXPRESSION TUTORIAL

    Usable Variables

    What variables could I use on my expressions?, Here the variables

    Variable Description
    FieldNames Any of the fieldNames placed on the same measurement
    NF especial variable that could be used to get the "number of fields" in the measurement (as in AWK)
    NR especial variable that could be used to get the "number of rows" in the measurement (after all filters has been applied), on scalar/value measurements, NR will be always 1 . On tabular/Indexed measurements NR will be the current number of rows (after filters applied)
    NFR(>0.7.6) especial variable that could be used to get the"non filtered rows", that counts the "number of rows" as the below NR but before all filters has been applied.
    Catalog Vars( > 0.7.5) Any of the defined variables in the catalog

    About Check

    When defining a new STRINGEVAL metric, the formula in extra data is stored on the configuration database but not evaluated yet since it needs to be placed into a measurement to check if expression its ok (validating all variables used in the expression are in the before table

    Examples

    A.Creating new StringEval Metric

    Let's create a SNMP Metric that computes the TotalOctets on each port. The formula follows as:

    TotalOctets = (InBytes + OutBytes)
    

    A.1 Add needed metrics to get our new string eval metric:

    ID FieldName BaseOID DataSrcType ExtraData GetRate Scale Shift IsTag
    ifHCInOctets InBytes .1.3.6.1.2.1.31.1.1.1.6 COUNTER64 false 0 0 false
    ifHCOutOctets OutBytes .1.3.6.1.2.1.31.1.1.1.10 COUNTER64 false 0 0 false

    A.2 Add TotalOctets metric:

    ID FieldName BaseOID DataSrcType ExtraData GetRate Scale Shift IsTag
    TotalOctets TotalOctets STRINGEVAL ifHCInOctets + ifHCOutOctets 0 0 false

    A.3 Result

    The SNMP Metric list must be like:

    ID FieldName BaseOID DataSrcType ExtraData GetRate Scale Shift IsTag
    ifHCInOctets InBytes .1.3.6.1.2.1.31.1.1.1.6 COUNTER64 false 0 0 false
    ifHCOutOctets OutBytes .1.3.6.1.2.1.31.1.1.1.10 COUNTER64 false 0 0 false
    TotalOctets TotalOctets STRINGEVAL InBytes + OutBytes 0 0 false

    B. Creating new StringParser Metric

    Some OIDs results are full strings that contains on some part of its texts the value that we wants to capture. In this example we will work with an Infoblox device and the following OID that gives us Fan1 RPM: .1.3.6.1.4.1.7779.3.1.1.2.1.10.1.3.28, with an output as: FAN 1: 8725 RPM

    B.1 Define the regex that would capture the group:

    We need to capture the RPM speed, so we define the capture group as: .*: *([0-9]*)* *RPM

    B.2 Add new StringParser metric

    ID FieldName BaseOID DataSrcType ExtraData GetRate Scale Shift IsTag
    Infoblox_FanState1 fanState1 STRINGPARSER .*: *([0-9]*)* *RPM 0 0 false