5.38. snmp

The snmp module provides SNMP polling support for reconnoiter.

loader

C

image

snmp.so

5.38.1. Module Configuration

5.38.2. Check Configuration

community
required

optional

default

public

allowed

.+

The SNMP community string providing read access.

port
required

optional

default

161

allowed

\d+

The UDP port to which SNMP queries will be sent.

version
required

optional

default

2c

allowed

(1|2c|3)

The SNMP version used for queries.

oid_.+
required

optional

allowed

.+

Defines a metric to query. Key oid_foo will establish a metric called foo. The value of the parameter should be an OID either in decimal notation or MIB name.

type_.+
required

optional

allowed

.+

Defines a coercion for a metric type. The name of the metric must identically match one of the oid_(.+) patterns. The value can be either one of the single letter codes in the metric_type_t enum or the following string variants: guess, int32, uint32, int64, uint64, double, string.

separate_queries
required

optional

default

false

allowed

^(?:true|false|on|off)$

Whether or not to query each OID separately.

Example 5.39. Simple snmp polling of two switchports

The following example configures SNMP checks against switchport 1 and 2 on the switch with the IP address 10.80.116.3.

      <noit>
        <modules>
          <module image="snmp" name="snmp"/>
        </modules>
        <checks>
          <switch target="10.80.116.3" module="snmp">
            <config>
              <community>SeKr3t</community>
              <oid_description>IF-MIB::ifName.%[name]</oid_description>
              <oid_alias>IF-MIB::ifAlias.%[name]</oid_alias>
              <oid_speed>IF-MIB::ifSpeed.%[name]</oid_speed>
              <oid_adminstatus>IF-MIB::ifAdminStatus.%[name]</oid_adminstatus>
              <oid_operstatus>IF-MIB::ifOperStatus.%[name]</oid_operstatus>
              <oid_inoctets>IF-MIB::ifHCInOctets.%[name]</oid_inoctets>
              <oid_outoctets>IF-MIB::ifHCOutOctets.%[name]</oid_outoctets>
              <oid_inerrors>IF-MIB::ifInErrors.%[name]</oid_inerrors>
              <oid_outerrors>IF-MIB::ifOutErrors.%[name]</oid_outerrors>
              <oid_indiscards>IF-MIB::ifInDiscards.%[name]</oid_indiscards>
              <oid_outdiscards>IF-MIB::ifOutDiscards.%[name]</oid_outdiscards>
              <oid_inucastpkts>IF-MIB::ifHCInUcastPkts.%[name]</oid_inucastpkts>
              <oid_outucastpkts>IF-MIB::ifHCOutUcastPkts.%[name]</oid_outucastpkts>
              <oid_inbcastpkts>IF-MIB::ifHCInBroadcastPkts.%[name]</oid_inbcastpkts>
              <oid_outbcastpkts>IF-MIB::ifHCOutBroadcastPkts.%[name]</oid_outbcastpkts>
            </config>
            <check uuid="1b4e28ba-2fa1-11d2-883f-e9b761bde3fb" name="1"/>
            <check uuid="4deb0724-ccee-4360-83bc-255e7b9d989d" name="2"/>
          </switch>
        </checks>
      </noit>
    

Example 5.40. Example using config inheritance to show reuse

Accomplising the same goal, but by using reuse:

      <noit>
        <modules>
          <module image="snmp" name="snmp"/>
        </modules>
        <checks>
          <switch target="10.80.116.3" module="snmp">
            <config inherit="SwitchPortX"/>
              <community>SeKr3t</community>
            </config>
            <check uuid="1b4e28ba-2fa1-11d2-883f-e9b761bde3fb" name="1"/>
            <check uuid="4deb0724-ccee-4360-83bc-255e7b9d989d" name="2"/>
          </switch>
        </checks>
        <config_templates>
          <config id="SwitchPortX">
            <oid_description>IF-MIB::ifName.%[name]</oid_description>
            <oid_alias>IF-MIB::ifAlias.%[name]</oid_alias>
            <oid_speed>IF-MIB::ifSpeed.%[name]</oid_speed>
            <oid_adminstatus>IF-MIB::ifAdminStatus.%[name]</oid_adminstatus>
            <oid_operstatus>IF-MIB::ifOperStatus.%[name]</oid_operstatus>
            <oid_inoctets>IF-MIB::ifHCInOctets.%[name]</oid_inoctets>
            <oid_outoctets>IF-MIB::ifHCOutOctets.%[name]</oid_outoctets>
            <oid_inerrors>IF-MIB::ifInErrors.%[name]</oid_inerrors>
            <oid_outerrors>IF-MIB::ifOutErrors.%[name]</oid_outerrors>
            <oid_indiscards>IF-MIB::ifInDiscards.%[name]</oid_indiscards>
            <oid_outdiscards>IF-MIB::ifOutDiscards.%[name]</oid_outdiscards>
            <oid_inucastpkts>IF-MIB::ifHCInUcastPkts.%[name]</oid_inucastpkts>
            <oid_outucastpkts>IF-MIB::ifHCOutUcastPkts.%[name]</oid_outucastpkts>
            <oid_inbcastpkts>IF-MIB::ifHCInBroadcastPkts.%[name]</oid_inbcastpkts>
            <oid_outbcastpkts>IF-MIB::ifHCOutBroadcastPkts.%[name]</oid_outbcastpkts>
          </config>
        </config_templates>
      </noit>