From OpenNMS
Introduced in the 1.3 branch is the ability to define an indirect index other than "ifIndex" in the datacollection-config.xml file.
For example, if the need is to collect statistics on the entries in the Net-SNMP agent's "dskTable". Previous the entry would look something like this:
<group name="net-snmp-disk" ifType="ignore">
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="1" alias="ns-disk-1-name" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="1" alias="ns-disk-1-tot" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="1" alias="ns-disk-1-avail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="1" alias="ns-disk-1-used" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="1" alias="ns-disk-1-pct" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="2" alias="ns-disk-2-name" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="2" alias="ns-disk-2-tot" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="2" alias="ns-disk-2-avail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="2" alias="ns-disk-2-used" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="2" alias="ns-disk-2-pct" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="3" alias="ns-disk-3-name" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="3" alias="ns-disk-3-tot" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="3" alias="ns-disk-3-avail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="3" alias="ns-disk-3-used" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="3" alias="ns-disk-3-pct" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="4" alias="ns-disk-4-name" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="4" alias="ns-disk-4-tot" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="4" alias="ns-disk-4-avail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="4" alias="ns-disk-4-used" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="4" alias="ns-disk-4-pct" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="5" alias="ns-disk-5-name" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="5" alias="ns-disk-5-tot" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="5" alias="ns-disk-5-avail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="5" alias="ns-disk-5-used" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="5" alias="ns-disk-5-pct" type="gauge" />
</group>
Note that this is just the first five OIDs repeated over and over with a different instance. If there are more than 5 entries in the table, this group would need to be modified to support them. Furthermore, for each index a separate report had to be created that would reference each index.
report.netsnmp.disk1.name=Disk Space on 1
report.netsnmp.disk1.columns=ns-disk-1-tot, ns-disk-1-used
report.netsnmp.disk1.type=nodeSnmp
report.netsnmp.disk1.propertiesValues=ns-disk-1-name
report.netsnmp.disk1.command=--title="Disk Space on {ns-disk-1-name}" \
DEF:dtotalk={rrd1}:ns-disk-1-tot:AVERAGE \
DEF:dusedk={rrd2}:ns-disk-1-used:AVERAGE \
CDEF:dtotal=dtotalk,1024,* \
CDEF:dused=dusedk,1024,* \
LINE2:dtotal#0000ff:"Disk Space Total" \
GPRINT:dtotal:AVERAGE:" Avg \\: %8.2lf %s" \
GPRINT:dtotal:MIN:"Min \\: %8.2lf %s" \
GPRINT:dtotal:MAX:"Max \\: %8.2lf %s\n" \
LINE2:dused#ff0000:"Disk Space Used" \
GPRINT:dused:AVERAGE:"Avg \\: %8.2lf %s" \
GPRINT:dused:MIN:"Min \\: %8.2lf %s" \
GPRINT:dused:MAX:"Max \\: %8.2lf %s\n"
Making adding such things a chore.
In 1.3 there is a simple way. First, in datacollection-config.xml create the index:
<resourceType name="dskIndex" label="Disk Table Index (UCD-SNMP MIB)">
<persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
<storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
</resourceType>
There are other examples to follow. Then, instead of specifying the index explicitly, simply use the newly created index:
<group name="net-snmp-disk" ifType="ignore">
<mibObj oid=".1.3.6.1.4.1.2021.9.1.2" instance="dskIndex" alias="ns-dskPath" type="string" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.6" instance="dskIndex" alias="ns-dskTotal" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.7" instance="dskIndex" alias="ns-dskAvail" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.8" instance="dskIndex" alias="ns-dskUsed" type="gauge" />
<mibObj oid=".1.3.6.1.4.1.2021.9.1.9" instance="dskIndex" alias="ns-dskPercent" type="gauge" />
</group>
In the SNMP directory for each particular node that supports this OID, there will be a subdirectory called "dskIndex". In that directory will be a subdirectory for each value of dskIndex, i.e. "1", "2", etc. Even if there are 20 indices for the device, each value will be automatically collected.
It makes the reporting easier too:
report.netsnmp.disk.name=Net-SNMP Disk Space
report.netsnmp.disk.columns=ns-dskTotal, ns-dskUsed
report.netsnmp.disk.type=dskIndex
report.netsnmp.disk.propertiesValues=ns-dskPath
report.netsnmp.disk.command=--title="Disk Space on {ns-dskPath}" \
DEF:dtotalk={rrd1}:ns-dskTotal:AVERAGE \
DEF:dusedk={rrd2}:ns-dskUsed:AVERAGE \
CDEF:dtotal=dtotalk,1024,* \
CDEF:dused=dusedk,1024,* \
LINE2:dtotal#0000ff:"Total" \
GPRINT:dtotal:AVERAGE:" Avg \\: %8.2lf %s" \
GPRINT:dtotal:MIN:"Min \\: %8.2lf %s" \
GPRINT:dtotal:MAX:"Max \\: %8.2lf %s\\n" \
LINE2:dused#ff0000:"Used" \
GPRINT:dused:AVERAGE:" Avg \\: %8.2lf %s" \
GPRINT:dused:MIN:"Min \\: %8.2lf %s" \
GPRINT:dused:MAX:"Max \\: %8.2lf %s\\n"
That one report will cover all available instances.
Version History/Availability
- This feature was added in version 1.3.0






