SNMP Agent
The SNMP Agent feature lets network management systems monitor and control your device over SNMP. The agent answers GET, GETNEXT (walk) and SET requests, exposes the standard MIB-2 system group, and serves any number of custom MIB objects that your application can read and write.
The agent supports SNMPv1 and SNMPv2c with community strings. SNMPv3 with the User-based Security Model (USM) can be enabled when authenticated or encrypted access is required.
Configuration
General
- SNMP Agent Enabled: turns the agent on. All other properties are disabled while the agent is off.
- Port: UDP port the agent listens on. The standard port is
161. - Read Community: community string required for read (GET) access in SNMPv1/v2c. Defaults to
public. - Write Community: community string required for write (SET) access in SNMPv1/v2c. Defaults to
private. Leave it empty to refuse all SET requests. - Custom MIB Objects: the scalar objects your device exposes. See Custom MIB Objects below.
System (MIB-2)
These values populate the standard system group that every SNMP manager queries first.
| Property | OID | Description |
|---|---|---|
| sysDescr | 1.3.6.1.2.1.1.1 | Textual description of the device. Defaults to Tibbo Device. |
| sysObjectID | 1.3.6.1.2.1.1.2 | Vendor identification of the device. Defaults to 1.3.6.1.4.1.20738. This is also the root of all custom MIB objects. |
| sysContact | 1.3.6.1.2.1.1.4 | Contact person for the device. |
| sysName | 1.3.6.1.2.1.1.5 | Administratively assigned name of the device. |
| sysLocation | 1.3.6.1.2.1.1.6 | Physical location of the device. |
SNMPv3
- SNMPv3 Enabled: enables the User-based Security Model.
- SNMPv3 Users: the accounts allowed to access the agent over SNMPv3. Each user has:
- User Name
- Security Level:
No Auth, No Priv,Auth, No Priv, orAuth & Priv(default). - Auth Protocol:
MD5orSHA(default). - Auth Password: authentication passphrase, at least 8 characters.
- Privacy Protocol:
DESorAES(default). - Privacy Password: encryption passphrase, at least 8 characters.
Enabling SNMPv3 automatically adds the MbedTLS library to the project for its cryptography.
Advanced
- MIB Object Table Size: total number of slots in the custom object table (default
16). Objects configured in the editor occupy the first slots. The remaining slots can be filled at runtime, for example by a custom plugin. The size is raised automatically if it is smaller than the number of configured objects. - Log Level: verbosity of the agent's log output, from
NonetoVerbose.
Custom MIB Objects
Each custom object is a scalar value with the following properties:
- Name: the name used to select the object in blocks.
- OID: derived automatically; it cannot be edited. See below.
- Data Type:
Integer,Octet String,Object ID,IP Address,Counter32,Gauge32,TimeTicks,Opaque, orCounter64. - Access:
Read OnlyorRead / Write. Only read/write objects can be changed by an SNMP manager. - Value: the initial value of the object. It can be bound to a variable.
Object OIDs
Custom objects live under the device's sysObjectID. The nth object in the list (counting from 1) is served at:
<sysObjectID>.1.<n>.0
With the default sysObjectID, the first object can be read with:
snmpget -v2c -c public 192.168.1.125 .1.3.6.1.4.1.20738.1.1.0
Because the OID follows the object's position, reordering or deleting objects changes the OIDs of the objects after it. Add new objects at the end of the list to keep existing OIDs stable.
To walk every custom object:
snmpwalk -v2c -c public 192.168.1.125 .1.3.6.1.4.1.20738
MIB File
When at least one custom object is defined, a matching SMIv2 MIB module named TIBBO-DEVICE-MIB is generated at app/mib/TIBBO-DEVICE-MIB.txt in the project. Load it into your SNMP manager so it displays the objects by name instead of by numeric OID.
Related Blocks
- On SNMP Object Set: runs when a manager writes one of the device's objects.
- Set SNMP Object Value: updates an object from the application.
- Get SNMP Object Value: reads an object's current value.
- Send SNMP Trap: notifies a manager as soon as something happens.
Example
To publish a temperature reading and let a manager switch a relay:
- Add two objects:
temperature(Integer, Read Only) andrelay(Integer, Read / Write). - On a timer, read the sensor and write the result with Set SNMP Object Value into
temperature. - Use On SNMP Object Set on
relayto drive the output from the writtenvalue.