This section covers monitoring component metrics using SNMP. I assume
that you’ve completed the steps in
Component modeling and now have
temperature sensor components modeled for the NetBotz device. Currently
there will be no graphs for these temperature sensors.
We will add collection, thresholding and graphing for the temperature
monitored by each sensor.
Find the SNMP OID
In Component modeling,
we used smidump and snmpwalk to
find which values would be useful to model, and which would be useful to
monitor. We found tempSensorValueStr to be the best OID to use for
monitoring a sensor’s current temperature.
Let’s use snmpwalk again to see what tempSensorValueStr looks like
for all of the sensors on our NetBotz device.
As we go on to add a monitoring template below, we’ll need to know what
OID to poll to collect this value. The key to determining this for
components with an snmpindex attribute like TemperatureSensor has is
to find the OID for the values above and remove the SNMP index from the
end of it. Let’s use snmptranslate to do this.
snmptranslate-OnNETBOTZV2-MIB::tempSensorValueStr
This results in the following output:
.1.3.6.1.4.1.5528.100.4.1.1.1.7
This OID (minus the leading .) is what we’ll need.
Add a monitoring template
It is important to get the monitoring template’s name correct when
adding a monitoring template that will be used for components. A Zenoss
administrator has no control over which monitoring templates will be
bound to a component like they do with monitoring templates that are
bound to devices.
How do we know what to name a monitoring template that should be used to
monitor our NetBotzTemperatureSensor components? By default the
monitoring template should be named the same as the component
class’ label property with all spaces removed.
In Component modeling,
we set the label for
the NetBotzTemperatureSensor class to be Temperature Sensor. This
means out monitoring template should be named TemperatureSensor.
If you’d rather specify the monitoring template’s name, or the names of
multiple monitoring templates to use for your component class, you can
do so by specifying an explicit monitoring_templates value for it
in zenpack.yaml.
Perform the following steps to create our component’s monitoring
template.
Navigate to Advanced > Monitoring Templates.
Add a template.
Click the + in the bottom-left of the template list.
Set Name to TemperatureSensor.
Set Template Path to /NetBotz.
Click SUBMIT.
Add a data source.
Click the + at the top of the Data Sources panel.
Set Name to tempSensorValueStr.
Set Type to SNMP.
Click SUBMIT.
Double-click to edit the tempSensorValueStr data source.
Set OID to 1.3.6.1.4.1.5528.100.4.1.1.1.7
Click SAVE.
Add a threshold.
Click the + at the top of the Thresholds panel.
Set Name to high temperature.
Set Type to MinMaxThreshold.
Click ADD.
Double-click to edit the high temperature threshold.
Move the datapoint to the list on the right.
Set Maximum Value to 32.
Set Event Class to /Environ.
Click SAVE.
Add a graph.
Click the + at the top of the Graph Definitions panel.
Set Name to Temperature.
Click SUBMIT.
Double-click to edit the Temperature graph.
Set Units to degrees c.
Click SUBMIT.
Add a graph point.
Click to select the Temperature graph.
Choose Manage Graph Points from the gear menu.
Choose Data Point from the + menu.
Choose tempSensorValueStr then click SUBMIT.
Double-click to edit the tempSensorValueStr graph point.
Set Name to Temperature.
Set Format to %7.2lf.
Click SAVE then SAVE again.
You can also define monitoring templates in zenpack.yaml instead of
creating them through the web interface. For more information,
see Monitoring templates.
Test monitoring template
Use zenperfsnmp to test the data point collection aspect of your
monitoring template. For more information,
see Test monitoring template.
You can verify that your monitoring template is getting bound to each
temperature sensor properly by navigating to one of the temperature
sensors in the web interface and choosing Templates from
its Display drop-down box. Furthermore, you can verify that
your Temperature graph is shown when choosing Graphs from the
temperature sensor’s Display drop-down.