Textual Conventions
A textual convention is a named, reusable data type built on top of one of SNMP's basic ASN.1 types, adding a specific meaning, format, or set of constraints that the basic type alone doesn't capture. Rather than every MIB re-describing "this is a 32-bit integer representing a timestamp, sort of" in prose each time, a textual convention gives that pattern a name and a precise definition once, so it can be reused consistently everywhere it applies.
Common textual conventions you'll actually run into
- DisplayString - an
OCTET STRINGrestricted to printable ASCII text, used for human-readable fields likesysDescrorifDescr. - TimeTicks / TimeStamp - a count of hundredths of a second, typically since some reference point like system boot (
sysUpTimeis the canonical example). - Counter32 / Counter64 - a monotonically increasing value that wraps back to zero after reaching its maximum, rather than a value that can go up or down - used for things like total bytes transmitted, which only ever increase (or wrap) between polls.
- Gauge32 - similar to a counter, but can go both up and down, and stays pinned at its maximum or minimum rather than wrapping - used for things like current queue depth.
- IpAddress - a 4-byte value representing an IPv4 address.
- RowStatus - see the dedicated page - controls creating and deleting table rows.
- TruthValue - a simple boolean, encoded as the integers
1(true) or2(false) - notably not0/1, which trips people up coming from most programming languages.
Where they're defined
The most common, widely-reused textual conventions live in a small number of foundational MIBs - particularly SNMPv2-TC - that most other MIBs import from. Vendors also frequently define their own additional textual conventions within their own private MIBs, for values specific to their hardware (an enumerated hardware status code, a proprietary identifier format, and so on).
Why they matter for correctly interpreting a value
A textual convention changes how a raw value should actually be understood - not just displayed. A Counter32 that appears to have "gone down" between two polls hasn't necessarily done anything wrong; it may have simply wrapped around past its maximum value, which is expected, normal behavior for a counter specifically, but would be a real anomaly for a gauge. Treating a wrapping counter as if it were an ordinary integer produces confusing, misleading results - deriving a rate from two counter samples requires accounting for the possibility of a wrap in between them.
How this shows up in a MIB definition
In an OBJECT-TYPE's SYNTAX field, you'll often see a textual convention name directly instead of a raw ASN.1 type - SYNTAX DisplayString rather than a bare OCTET STRING with a size constraint spelled out inline. That's the whole point: the convention carries its full meaning and formatting rules along with its name, rather than needing to be re-derived from a generic type every time.