PhloemDocs
Markdown
Connector

SNMP

Read SNMP agents — UPSes, PDUs, sensors, network gear — and receive their traps

Category
Industrial
Kind
source
Capabilities
trellisStreamsCommandsEntitiesOperations
Runs on
Linux x64Linux ARM64macOS Apple siliconmacOS IntelWindows x64

Read UPSes, PDUs, environmental sensors, chillers, network switches and any other equipment with an SNMP agent — v1, v2c or v3 — and receive its traps and informs. Channels are named and typed from the equipment's own MIB files, so a reading arrives as upsBatteryTemperature in °C, not as a number under a dotted OID.

What you get

  • Live readings — each object you list is a channel, polled at the rate you choose. A table (every outlet of a PDU, every port of a switch) becomes one channel per row, and new rows are picked up as they appear.
  • Units and scaling from the MIB — UNITS "0.1 Volt" becomes volts, a d-1 display hint becomes one decimal place, named states (on(2)) keep their code with the names shown, true/false objects show as a state.
  • Counters you can trust — a counter channel is a running total. When a 32-bit counter rolls over, the total carries on. When the agent restarts and its counters start again from zero, the total also carries on, and the counts lost across the restart are marked as a gap rather than misread as billions of new ones.
  • Traps and informs — each notification lands on a text channel, /snmp/<agent>/traps, as one line naming what happened and its values. Informs are acknowledged, so the sender stops repeating them.
  • Writes — objects you mark writable (and that the MIB allows to be written) can be set from Trellis with ch.write(path, value). Each write is read back from the agent.
  • Many agents per input — a rack of PDUs or a row of UPSes can share one input. Channels read /snmp/<agent>/<object>.

Before you start

  • The address of each agent, and its port if it is not 161.
  • For v1 / v2c: the community the agent answers.
  • For v3: the user, the security level, and the authentication and encryption protocols and passwords configured on the agent.
  • The equipment's MIB files, from its maker, in a folder on this computer. The standard system and interface objects (sysUpTime, sysName, IF-MIB) are built in; anything vendor-specific needs its MIB.

Set up

  1. In Inputs, choose Add input and pick snmp.

  2. Agents — one per line, a name and an address:

    ups1 = 10.0.0.5
    pdu-a = 10.0.0.6:161

    The name becomes part of every channel path.

  3. SNMP version — v1 or v2c with a Community, or v3 with the security level the agent's user is set to (authenticated and encrypted, authenticated, or neither), then the User, and the Authentication / Encryption protocols and passwords that level needs. Passwords are kept with your other connection secrets and never written to logs.

  4. Objects — one per line, by name or number:

    sysUpTime
    upsBatteryTemperature
    upsOutputTable
    1.3.6.1.4.1.318.1.1.1.2.2.1.0

    When two of your MIBs use the same name, put the module in front, joined by two colons, as MIB tools write it. A scalar (sysUpTime) is read as itself. A table, a row or a column is walked, and each instance becomes a channel. A number no MIB describes is still read, under its number.

  5. MIB folders — the folder holding the vendor's MIB files.

  6. Poll rate — how often each agent is read (once a second by default).

  7. Press Test connection. It reads sysDescr, sysName and sysUpTime from every agent, so a pass means each one answered your credentials.

  8. Channels appear on Live.

Traps

Tick Receive traps and informs, choose the Trap port, and point the equipment's trap destination at this computer. Port 162 is the standard one but needs administrator rights on most systems; a port such as 1162 works without them. Set a Trap community to accept only senders that use it (leave it empty to accept any community). v3 traps and informs use the input's v3 user and passwords.

A trap from one of the input's agents lands under that agent's name; a trap from any other address lands under that address.

Writes

List the objects that may be written under Writable objects, for example ifAdminStatus. An object is writable only when it is listed here and its MIB says it can be written. A named state is written by its name ("off"), a true/false object as true or false, a scaled number in the units you read it in.

Reference

What each object becomes

objectchannel
integer, gauge with units or a display hinta number, scaled, with the unit
named states (off(1), on(2))the state's number; the names are listed on the channel
true/false (TruthValue)a state
counter (32- or 64-bit)a running total (see below)
time ticks (sysUpTime)seconds
text, addresses, identifierstext (MAC addresses and dates as the MIB formats them)
no such object or instancea sample with no value

A unit is shown only when the MIB's UNITS text is one the connector recognises; otherwise the MIB's own words are shown with the channel and no unit is set, so you can set it yourself.

Counters

  • A 32-bit counter rolls over at 4,294,967,296. One rollover between two polls is carried into the total. Two cannot be told from one by anyone: for a fast interface use its 64-bit counter (ifHCInOctets) or poll faster.
  • An agent restart is recognised by its sysUpTime going back (and, on v3, by its restart count going up). The counts between the last poll and the restart are unknown and shown as a gap; the total continues.

Timing

Each reading is stamped with this computer's clock, at the middle of the request and its answer. A poll the agent did not answer in time is shown as a gap when the next one arrives.

Limits measured on a simulator

One input polling 200 agents × 500 objects once a second — 100,000 readings a second — with 500 traps a second arriving at the same time, on a 16-core Linux machine:

v2cv3 (authenticated and encrypted)
readings landed100,454 / s (worst 10 s: 97,995)100,537 / s (worst 10 s: 97,731)
polls missednonenone
CPU13 % of one core18 % of one core
memory86–91 MB, flat86–91 MB, flat

Over a one-hour run at the same load (100 traps a second), memory stayed flat — 90–95 MB on v2c, 99 MB on v3 from the tenth minute to the end — and no poll was missed.

A burst of 20,000 traps sent as fast as one sender could (≈ 30,000 a second) all landed. The connector keeps the number of requests in flight within what the operating system's network buffer holds, so a large fleet does not lose answers to it; an agent that drops requests is sent fewer at a time.

Troubleshooting

what you seewhat to do
Test connection says the agent did not answerCheck the address and port, that SNMP is enabled on the equipment, and the community (v1/v2c), which the agent ignores silently when it is wrong.
"wrong authentication password or protocol"The v3 authentication password or protocol differs from the agent's.
"could not decrypt"The v3 encryption password or protocol differs from the agent's. With AES-192 or AES-256, try the other key extension under More settings.
"does not know this user name"The v3 user is not configured on the agent.
An object stays a number, not a nameIts MIB is not in the MIB folders, or a module it imports is missing.
The trap port will not openPorts below 1024 need administrator rights; use 1162 and point the equipment there.
Traps from a sender do not appearIts community does not match Trap community, or (v3) its user or passwords differ from the input's. The input's status counts rejected notifications by reason.

Not yet run on real equipment

whatstatus
Every agent the connector has polled so far is a simulator, net-snmp's reference agent, or a recording of a real device (Linux and Windows hosts, a UPS) replayed by an independent simulatorLive vendor agents (UPS, PDU, switch) not yet tested
AES-192/256 interoperability with a vendor's agentTested against two independent implementations, not a vendor's

Supports

  • Any SNMP v1, v2c or v3 agent (USM: SHA-1/SHA-2 authentication, AES/DES privacy)
  • Objects named and typed from the equipment's own MIB files
  • Traps and informs (v1, v2c, v3) received as events

Connection fields

Every field the Add input form shows for this connector.

FieldTypeRequiredDefault
Agents
ups1 = 10.0.0.5 pdu-a = 10.0.0.6:161
TextYes—
SNMP versionOne of
v2c · v3 · v3-auth · v3-none · v1
Yesv2c
Community
public
Secret——
UserText——
AuthenticationOne of
SHA-256 · SHA-512 · SHA-384 · SHA-224 · SHA-1 · MD5
—SHA-256
Authentication passwordSecret——
EncryptionOne of
AES-128 · AES-256 · AES-192 · DES
—AES-128
Encryption passwordSecret——
Objects
sysUpTime ifHCInOctets upsBatteryTemperature
TextYes—
MIB folders
/opt/mibs/vendor
Text——
Poll rate (Hz)Number—1
Writable objects
ifAdminStatus
Text——
Receive traps and informsOn / off—false
Trap portNumber—162
Trap communitySecret——
Context name (v3)Text——
AES-192/256 key extensionOne of
blumenthal · reeder
—blumenthal
Timeout (ms)Number—1500
RetriesNumber—1
Objects per requestNumber—40
Rows per walk requestNumber—25
Re-walk tables every (s)Number—300

Updated