AKCP sensorProbe How-To
Subscribe

From OpenNMS

Jump to: navigation, search

AKCP makes the SensorProbe2, which measures various things (temperature, humidity, etc.). This document describes how I got the device working and graphing the sensors for Temp 1/2, Humid 1/2.

A patch in bugzilla #3357 is available. Also the converted SNMP-Trap MIB for AKCP Sensor boxes.

The device does not have support for mib2-interfaces, which causes problems in OpenNMS. The work around for this is to create a new package in collectd-configuration.xml

<package name="funkydevice">
        <filter>IPADDR != '0.0.0.0'</filter>
        <specific>10.0.0.99</specific>
        <service name="SNMP" interval="300000" user-defined="false" status="on">
                <parameter key="collection" value="funkydevice"/>
                <parameter key="port" value="161"/>
                <parameter key="retry" value="3"/>
                <parameter key="timeout" value="3000"/>
        </service>
        <outage-calendar>zzz from poll-outages.xml zzz</outage-calendar>
</package>


update <specific> with the devices IP. Make sure this package goes above example1 (the default package. This is so the device will match this package and not the default one.

Next update datacollection-config.xml with the info need to poll the correct OIDs for graphing.

<snmp-collection name="funkydevice"
                maxVarsPerPdu = "10"
                snmpStorageFlag = "select">
                <rrd step = "300">
                        <rra>RRA:AVERAGE:0.5:1:8928</rra>
                        <rra>RRA:AVERAGE:0.5:12:8784</rra>
                        <rra>RRA:MIN:0.5:12:8784</rra>
                        <rra>RRA:MAX:0.5:12:8784</rra>
                </rrd>
                <groups>
                        <group name = "SP-AGENT-MIB" ifType = "ignore">
                                <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.3" instance="0" alias="spTempDegree1" type="integer"/>
                                <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.3" instance="1" alias="spTempDegree2" type="integer"/>
                                <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.3" instance="0" alias="spHumidityPercent1" type="integer"/>
                                <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.3" instance="1" alias="spHumidityPercent2" type="integer"/>
                        </group>
                </groups>
                <systems>
                        <systemDef name = "AKCP sensorProbe">
                                <sysoidMask>.1.3.6.1.4.1.3854.1.2.2.1.1</sysoidMask>
                                <collect>
                                        <includeGroup>SP-AGENT-MIB</includeGroup>
                                </collect>
                        </systemDef>
                </systems>
        </snmp-collection>

Next update snmp-graph.properties with the graphs for each OID alias being polled

report.sensorProbe.temp1.name=sensorProbe Temperature 1
report.sensorProbe.temp1.columns=spTempDegree1
report.sensorProbe.temp1.type=nodeSnmp
report.sensorProbe.temp1.command=--title="AKCP sensorProbe Temperature 1" \
 DEF:temp={rrd1}:spTempDegree1:AVERAGE \
 LINE2:temp#54a4de:"Temperature  " \
 GPRINT:temp:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:temp:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:temp:MAX:"Max  \\: %8.2lf %s\\n" 

report.sensorProbe.temp2.name=sensorProbe Temperature 2
report.sensorProbe.temp2.columns=spTempDegree2
report.sensorProbe.temp2.type=nodeSnmp
report.sensorProbe.temp2.command=--title="AKCP sensorProbe Temperature 2" \
 DEF:temp={rrd1}:spTempDegree2:AVERAGE \
 LINE2:temp#54a4de:"Temperature  " \
 GPRINT:temp:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:temp:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:temp:MAX:"Max  \\: %8.2lf %s\\n"

report.sensorProbe.humid1.name=sensorProbe Humidity 1
report.sensorProbe.humid1.columns=spHumidityPercent1
report.sensorProbe.humid1.type=nodeSnmp
report.sensorProbe.humid1.command=--title="AKCP sensorProbe Humidity 1" \
 DEF:humid={rrd1}:spHumidityPercent1:AVERAGE \
 LINE2:humid#000000:"Humidity  " \
 GPRINT:humid:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:humid:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:humid:MAX:"Max \\: %8.2lf %s\\n"

report.sensorProbe.humid2.name=sensorProbe Humidity 2
report.sensorProbe.humid2.columns=spHumidityPercent2
report.sensorProbe.humid2.type=nodeSnmp
report.sensorProbe.humid2.command=--title="AKCP sensorProbe Humidity 2" \
 DEF:humid={rrd1}:spHumidityPercent2:AVERAGE \
 LINE2:humid#000000:"Humidity  " \
 GPRINT:humid:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:humid:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:humid:MAX:"Max \\: %8.2lf %s\\n"

And Finally update reports= (in snmp-graph.properties) with the new graph names (sensorProbe.temp1, sensorProbe.humid1, etc) the order in which they are entered into reports= determines the order that they are displayed (i.e. you can group temp1/humid1 or temp1/temp2)

That should be it. you'll need to restart opennms for all changes to take effect. if you run into problems check collectd.log for debug snmp info. you might even want to use tcpdump to analyse what is going on.

sensorProbe8 Amendements

With a sensorProbe8 running the most recent firmware available (and possibly earlier releases), the separate collectd configuration packages are not required. Edit data-collection.xml, and add the following configurations appropriately:

 ...
<resourceType name="spTempIndex" label="Temperature sensor" resourceLabel="${spTempDescr}">
  <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
  <storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
</resourceType>
<resourceType name="spHumidityIndex" label="Humidity sensor" resourceLabel="${spHumidityDescr}">
  <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
  <storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
</resourceType>
 ...
<groups>
 ...
      <group name="sensorProbe-temps" ifType="all">
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.1" instance="spTempIndex" alias="spTempDescr" type="string" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.3" instance="spTempIndex" alias="spTempDegree" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.7" instance="spTempIndex" alias="spTempHWarn" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.8" instance="spTempIndex" alias="spTempHCrit" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.9" instance="spTempIndex" alias="spTempLWarn" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.10" instance="spTempIndex" alias="spTempLCrit" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.16.1.14" instance="spTempIndex" alias="spTempMeasure" type="integer" />
      </group>
      <group name="sensorProbe-humidity" ifType="all">
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.1" instance="spHumidityIndex" alias="spHumidityDescr" type="string" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.3" instance="spHumidityIndex" alias="spHumidityPercent" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.7" instance="spHumidityIndex" alias="spHumidityHWarn" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.8" instance="spHumidityIndex" alias="spHumidityHCrit" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.9" instance="spHumidityIndex" alias="spHumidityLWarn" type="integer" />
               <mibObj oid=".1.3.6.1.4.1.3854.1.2.2.1.17.1.10" instance="spHumidityIndex" alias="spHumidityLCrit" type="integer" />
       </group>
 ...
</groups>
 ...
<systems>
 ...
             <systemDef name = "AKCP sensorProbe">
                     <sysoidMask>.1.3.6.1.4.1.3854.1</sysoidMask>
                     <collect>
                             <includeGroup>sensorProbe-temps</includeGroup>
                             <includeGroup>sensorProbe-humidity</includeGroup>
                     </collect>
             </systemDef>
 ...
</systems>

snmp-graphs.properties

######
###### Reports for AKCP SensorProbe
######
report.sensorProbe.temperature.name=sensorProbe Temperature
report.sensorProbe.temperature.columns=spTempDegree,spTempHWarn,spTempHCrit,spTempLWarn,spTempLCrit
report.sensorProbe.temperature.propertiesValues=spTempDescr
report.sensorProbe.temperature.type=spTempIndex
report.sensorProbe.temperature.command=--title="Temperature: {spTempDescr}" \
 --vertical-label="Degrees" \
 DEF:temp={rrd1}:spTempDegree:AVERAGE \
 DEF:hwarn={rrd2}:spTempHWarn:AVERAGE \
 DEF:hcrit={rrd3}:spTempHCrit:AVERAGE \
 DEF:lwarn={rrd4}:spTempLWarn:AVERAGE \
 DEF:lcrit={rrd5}:spTempLCrit:AVERAGE \
 AREA:temp#ffcc00: \
 LINE1:temp#000000:"Total " \
 GPRINT:temp:AVERAGE:" Avg  : %8.2lf %s" \
 GPRINT:temp:MIN:"Min  : %8.2lf %s" \
 GPRINT:temp:MAX:"Max  : %8.2lf %s\\n" \
 LINE1:hcrit#ff0000:"High critical threshold:  " \
 GPRINT:hcrit:MAX:"%8.2lf %s\\n" \
 LINE1:hwarn#ff9700:"High warning threshold:   " \
 GPRINT:hwarn:MAX:"%8.2lf \\n" \
 LINE1:lwarn#0084ff:"Low warning threshold:    " \
 GPRINT:lwarn:MAX:"%8.2lf %s\\n" \
 LINE1:lcrit#0000ff:"Low critical threshold:   " \
 GPRINT:lcrit:MAX:"%8.2lf %s\\n"

report.sensorProbe.humidity.name=sensorProbe Humidity
report.sensorProbe.humidity.columns=spHumidityPercent,spHumidityHWarn,spHumidityHCrit,spHumidityLWarn,spHumidityLCrit
report.sensorProbe.humidity.propertiesValues=spHumidityDescr
report.sensorProbe.humidity.type=spHumidityIndex
report.sensorProbe.humidity.command=--title="Humidity: {spHumidityDescr}" \
 --vertical-label="Humidity in %" \
 DEF:humid={rrd1}:spHumidityPercent:AVERAGE \
 DEF:hwarn={rrd2}:spHumidityHWarn:AVERAGE \
 DEF:hcrit={rrd3}:spHumidityHCrit:AVERAGE \
 DEF:lwarn={rrd4}:spHumidityLWarn:AVERAGE \
 DEF:lcrit={rrd5}:spHumidityLCrit:AVERAGE \
 AREA:humid#afc9c9: \
 LINE1:humid#000000:"Total " \
 GPRINT:humid:AVERAGE:" Avg \\: %8.2lf %s" \
 GPRINT:humid:MIN:"Min \\: %8.2lf %s" \
 GPRINT:humid:MAX:"Max \\: %8.2lf %s\\n" \
 LINE1:hcrit#ff0000:"High critical threshold:  " \
 GPRINT:hcrit:MAX:"%8.2lf %s\\n" \
 LINE1:hwarn#ff9700:"High warning threshold:   " \
 GPRINT:hwarn:MAX:"%8.2lf \\n" \
 LINE1:lwarn#0084ff:"Low warning threshold:    " \
 GPRINT:lwarn:MAX:"%8.2lf %s\\n" \
 LINE1:lcrit#0000ff:"Low critical threshold:   " \
 GPRINT:lcrit:MAX:"%8.2lf %s\\n"

Note that you'll need to verify the sensor OIDs, and amend the instance values appropriately for your configuration. This configuration automatically generates indexed data, and shows as a custom select list in the resource graphs selection.

  • If you get the sysoidMask wrong, your collectd log file will show the following (in debug mode)
    • SnmpCollector: agent Agent[nodeid = 170 ipaddr= 1.5.2.3] defines no data to collect. Skipping

Temperature and humidity sensors from AKCP measure temperature with 0,1 Celsius accuracy. The regular OID (*.16.1.3) for temperature measurement shows measurement in 1 degree accuracy. In order to see the temperature in steps of 0,1 degrees OID *.16.1.14 needs to be used. SensorProbe will only send integer values and therefore the temperature measurement is multiplied by 10 before it's sent (21,0 = 210 for example). For graphs the received value needs to be divided by 10 in order to get the temperature in Celsius. This can be done with the help of CDEF as follows.

######
###### Reports for AKCP SensorProbe
######
report.sensorProbe.temperature.name=sensorProbe Temperature
report.sensorProbe.temperature.columns=spTempMeasure,spTempHWarn,spTempHCrit,spTempLWarn,spTempLCrit
report.sensorProbe.temperature.propertiesValues=spTempDescr
report.sensorProbe.temperature.type=spTempIndex
report.sensorProbe.temperature.command=--title="Temperature: {spTempDescr}" \
 --vertical-label="Degrees" \
 DEF:temperature={rrd1}:spTempMeasure:AVERAGE \
 CDEF:temp=temperature,10,\/  \
 DEF:hwarn={rrd2}:spTempHWarn:AVERAGE \
 DEF:hcrit={rrd3}:spTempHCrit:AVERAGE \
 DEF:lwarn={rrd4}:spTempLWarn:AVERAGE \
 DEF:lcrit={rrd5}:spTempLCrit:AVERAGE \
 AREA:temp#ffcc00: \
 LINE1:temp#000000:"Total " \
 GPRINT:temp:AVERAGE:" Avg  : %8.2lf %s" \
 GPRINT:temp:MIN:"Min  : %8.2lf %s" \
 GPRINT:temp:MAX:"Max  : %8.2lf %s\\n" \
 LINE1:hcrit#ff0000:"High critical threshold:  " \
 GPRINT:hcrit:MAX:"%8.2lf %s\\n" \
 LINE1:hwarn#ff9700:"High warning threshold:   " \
 GPRINT:hwarn:MAX:"%8.2lf \\n" \
 LINE1:lwarn#0084ff:"Low warning threshold:    " \
 GPRINT:lwarn:MAX:"%8.2lf %s\\n" \
 LINE1:lcrit#0000ff:"Low critical threshold:   " \
 GPRINT:lcrit:MAX:"%8.2lf %s\\n"