SnmpKit.Telemetry (snmpkit v2.0.1)
:telemetry events emitted by SnmpKit.
Attach with :telemetry.attach/4 or :telemetry.attach_many/4, or point
Telemetry.Metrics / TelemetryMetricsPrometheus at the event names below.
Durations are in native time units; convert with
System.convert_time_unit(duration, :native, :millisecond).
Spans
Spans emit :start, :stop and :exception events with the standard
:telemetry.span/3 measurements (system_time on start, duration on
stop and exception).
| Event prefix | Emitted around | Metadata |
|---|---|---|
[:snmpkit, :request, _] | one single-target PDU exchange (get, get_next, set, get_bulk), retries included | operation, target, oid, version; on stop result (:ok/:error) and reason |
[:snmpkit, :walk, _] | a whole single-target walk (walk, walk_table, bulk_walk, adaptive_walk) | operation, target, root_oid; on stop result, reason, count (varbinds) |
[:snmpkit, :multi, _] | a multi-target call (get_multi, get_bulk_multi, walk_multi, walk_table_multi, execute_mixed) | operation, request_count; on stop ok_count, error_count |
Events
| Event | Measurements | Metadata |
|---|---|---|
[:snmpkit, :engine, :timeout] | %{count: 1} | request_id, target |
[:snmpkit, :trap, :received] | %{count: 1} | kind, version, trap_oid, trap_name, community, source |
[:snmpkit, :trap, :rejected] | %{count: 1} | reason (:community, :decode_error, :unsupported), source |
[:snmpkit, :sim, :request] | %{duration: native} | device_id, port, pdu_type, result (:ok/:error_injected) |
[:snmpkit, :agent, :request] | %{duration: native} | pdu_type, version, principal (community or v3 user), error_status, varbinds (in the response) |
Example
:telemetry.attach("log-slow-snmp", [:snmpkit, :request, :stop], fn _event, %{duration: d}, meta, _ ->
ms = System.convert_time_unit(d, :native, :millisecond)
if ms > 500, do: Logger.warning("slow SNMP #{meta.operation} to #{meta.target}: #{ms} ms")
end, nil)
Summary
Functions
Emits [:snmpkit | event] with the given measurements and metadata.
Runs fun inside a [:snmpkit, name, _] span. The stop metadata gets
result/reason derived from the return value, plus anything extra.(value)
returns.
Functions
Emits [:snmpkit | event] with the given measurements and metadata.
Runs fun inside a [:snmpkit, name, _] span. The stop metadata gets
result/reason derived from the return value, plus anything extra.(value)
returns.