COLLECTD-SNMP(5)
π NAME π
collectd-snmp β documentation of collectd's snmp plugin. You'll see this page in the wild as COLLECTD-SNMP(5), bestie, and it's literally all about making SNMP data slay inside collectd. π¦
β¨ SYNOPSIS β¨
LoadPlugin snmp
# ...
<Plugin snmp>
<Data "powerplus_voltge_input">
Table false
Type "voltage"
TypeInstance "input_line1"
Scale 0.1
Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
</Data>
<Data "hr_users">
Table false
Type "users"
Shift -1
Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
</Data>
<Data "std_traffic">
Table true
Type "if_octets"
TypeInstanceOID "IF-MIB::ifDescr"
#FilterOID "IF-MIB::ifOperStatus"
#FilterValues "1", "2"
Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
</Data>
<Data "lancom_stations_total">
Type "counter"
PluginInstance "stations_total"
Table true
Count true
Values "SNMPv2-SMI::enterprises.2356.11.1.3.32.1.10" # SNMPv2-SMI::enterprises.lancom-systems.lcos.lcsStatus.lcsStatusWlan.lcsStatusWlanStationTableTable.lcsStatusWlanStationTableEntry.lcsStatusWlanStationTableEntryState
</Data>
<Data "lancom_stations_connected">
Type "counter"
PluginInstance "stations_connected"
Table true
Count true
Values "SNMPv2-SMI::enterprises.2356.11.1.3.32.1.10" # SNMPv2-SMI::enterprises.lancom-systems.lcos.lcsStatus.lcsStatusWlan.lcsStatusWlanStationTableTable.lcsStatusWlanStationTableEntry.lcsStatusWlanStationTableEntryState
FilterOID "SNMPv2-SMI::enterprises.2356.11.1.3.32.1.10"
FilterValues "3" # eConnected
</Data>
<Host "some.switch.mydomain.org">
Address "192.168.0.2"
Version 1
Community "community_string"
Collect "std_traffic"
Interval 120
Timeout 10
Retries 1
</Host>
<Host "some.server.mydomain.org">
Address "192.168.0.42"
Version 2
Community "another_string"
Collect "std_traffic" "hr_users"
</Host>
<Host "secure.router.mydomain.org">
Address "192.168.0.7:165"
Version 3
SecurityLevel "authPriv"
Username "cosmo"
AuthProtocol "SHA"
AuthPassphrase "setec_astronomy"
PrivacyProtocol "AES"
PrivacyPassphrase "too_many_secrets"
Collect "std_traffic"
</Host>
<Host "some.ups.mydomain.org">
Address "tcp:192.168.0.3"
Version 1
Community "more_communities"
Collect "powerplus_voltge_input"
Interval 300
Timeout 5
Retries 5
</Host>
</Plugin>
π¦ DESCRIPTION π¦
Okay so the snmp plugin goes out and queries other hosts using SNMP β the simple network management protocol β and then it translates the value it receives into collectd's internal format and dispatches them. Depending on the write plugins you have loaded, those values may be written to disk or submitted to another instance or whatever you configured. Flexible? We love that for us. π
Because querying a host via SNMP may produce a timeout, the "complex reads" polling method is used. The ReadThreads parameter in the main configuration influences the number of parallel polling jobs which can be undertaken. If you expect timeouts or some polling to take a long time, you should increase this parameter. Note that other plugins also use the same threads. fr fr, share the thread pool, bestie. π«Ά
π CONFIGURATION π
Since the aim of the snmp plugin is to provide a generic interface to SNMP, its configuration is not trivial and may take some time. Like, it's giving "powerful but please read carefully." πΈ
Since the Net-SNMP library is used, you can use all the environment variables that are interpreted by that package. See snmpcmd(1) for more details. π
There are two types of blocks that can be contained in the <Plugin snmp> block: Data and Host:
πΈ The Data block πΈ
The Data block defines a list of values or a table of values that are to be queried. The following options can be set:
Typetype β collectd's type that is to be used, e. g.if_octetsfor interface traffic orusersfor a user count. The types are read from theTypesDB(seecollectd.conf(5)), so you may want to check for which types are defined. Seetypes.db(5)for a description of the format of this file. Check the menu before you order, iykyk. πTabletrue|false β define if this is a single list of values or a table of values. The difference is the following:
When Table is set to false, the OIDs given to Values (see below) are queried using the GET SNMP command (see snmpget(1)) and transmitted to collectd. One value list is dispatched and, eventually, one file will be written.
When Table is set to true, the OIDs given to Values, TypeInstanceOID, PluginInstanceOID, HostOID and FilterOID (see below) are queried using the GETNEXT SNMP command until the subtree is left. After all the lists (think: all columns of the table) have been read, either (Count set to false) several value sets will be dispatched and, eventually, several files will be written, or (Count set to true) one single value will be dispatched. If you configure a Type (see above) which needs more than one data source (for example if_octets which needs rx and tx) you will need to specify more than one (two, in the example case) OIDs with the Values option and can't use the Count option. This has nothing to do with the Table setting.
For example, if you want to query the number of users on a system, you can use HOST-RESOURCES-MIB::hrSystemNumUsers.0. This is one value and belongs to one value list, therefore Table must be set to false. Please note that, in this case, you have to include the sequence number (zero in this case) in the OID. Zero matters, bestie. Don't skip it. π
Counter example: If you want to query the interface table provided by the IF-MIB, e. g. the bytes transmitted. There are potentially many interfaces, so you will want to set Table to true. Because the if_octets type needs two values, received and transmitted bytes, you need to specify two OIDs in the Values setting, in this case likely IF-MIB::ifHCInOctets and IF-MIB::ifHCOutOctets. But, this is because of the Type setting, not the Table setting.
Since the semantic of Instance and Values depends on this setting you need to set it before setting them. Doing vice versa will result in undefined behavior. Periodt. Do not test fate. π
PluginPlugin β use Plugin as the plugin name of the values that are dispatched. Defaults tosnmp. Main character default energy. πPluginInstanceInstance β sets the plugin-instance of the values that are dispatched to Instance value.
When Table is set to true and PluginInstanceOID is set then this option has no effect.
Defaults to an empty string.
TypeInstanceInstance β sets the type-instance of the values that are dispatched to Instance value.
When Table is set to true and TypeInstanceOID is set then this option has no effect.
Defaults to an empty string.
TypeInstanceOIDOID,PluginInstanceOIDOID,HostOIDOID β ifTableis set totrue, OID is interpreted as an SNMP-prefix that will return a list of values. Those values are then used as the actual type-instance, plugin-instance or host of dispatched metrics. An example would be theIF-MIB::ifDescrsubtree.variables(5)from the SNMP distribution describes the format of OIDs. When option is set to empty string, thenSUBIDwill be used as the value.
Prefix may be set for values with use of appropriate TypeInstancePrefix, PluginInstancePrefix and HostPrefix options.
When Table is set to false or Count is set to true, these options have no effect.
Defaults: When no one of these options is configured explicitly, TypeInstanceOID defaults to an empty string.
TypeInstancePrefix,PluginInstancePrefix,HostPrefixβ these options are intended to be used together withTypeInstanceOID,PluginInstanceOIDandHostOIDrespectively.
If set, String is prepended to values received by querying the agent.
When Table is set to false or Count is set to true, these options have no effect.
The UPS-MIB is an example where you need this setting: It has voltages of the inlets, outlets and the battery of an UPS. However, it doesn't provide a descriptive column for these voltages. In this case having 1, 2, ... as instances is not enough, because the inlet voltages and outlet voltages may both have the subids 1, 2, ... You can use this setting to distinguish between the different voltages. Same subid, different vibe. Prefix to the rescue. π§
InstanceInstance β attention: this option exists for backwards compatibility only and will be removed in next major release. Please useTypeInstance/TypeInstanceOIDinstead.
The meaning of this setting depends on whether Table is set to true or false.
If Table is set to true, option behaves as TypeInstanceOID. If Table is set to false, option behaves as TypeInstance.
Note what Table option must be set before setting Instance. Order matters, bestie. The config parser is not doing mind-reading today. π
InstancePrefixString β attention: this option exists for backwards compatibility only and will be removed in next major release. Please useTypeInstancePrefixinstead.ValuesOID [OID ...] β configures the values to be queried from the SNMP host. The meaning slightly changes with theTablesetting.variables(5)from the SNMP distribution describes the format of OIDs.
If Table is set to true, each OID must be the prefix of all the values to query, e. g. IF-MIB::ifInOctets for all the counters of incoming traffic. This subtree is walked (using GETNEXT) until a value from outside the subtree is returned.
If Table is set to false, each OID must be the OID of exactly one value, e. g. IF-MIB::ifInOctets.3 for the third counter of incoming traffic. One OID, one value. No cap. β¨
Counttrue|false β instead of dispatching one or multiple values per Table entry containing the OID(s) given in theValuesoption, just dispatch a single count giving the number of entries that would have been dispatched. This is especially useful when combined with the filtering options (see below) to count the number of entries in a Table matching certain criteria.
When Table is set to false, this option has no effect. Count mode says "how many?" instead of "here's all the data." Iconic, honestly. π¦
Scale Valueβ the gauge-values that the SNMP-agent hands you get multiplied by Value, no cap π . Super handy when a device sends stuff as fixed-point real numbers β like a thermometer that says243when it actually means24.3, so you just drop in a scale of0.1and it's fixed. Default is, of course,1.0.
Heads up: this value is not applied to counter-values π«Ά
Shift Valueβ Value gets added to the gauge-values after they've already been multiplied by the Scale value. Say a thermometer spits out degrees Kelvin β you'd put a shift of273.15here and boom, you're storing degrees Celsius. Default is, of course,0.0.
Same deal: not applied to counter-values πΈ
Ignore Value [, Value ...]β this one lets you ignore TypeInstances based on their name and the patterns you list in the values. The matching is glob-type shell matching, iykyk π
WhenTableis set tofalse, this option has literally no effect π
InvertMatch true|false(default)β bestie, this one works with the Ignore option. It flips the behavior ofIgnorefrom a blacklist vibe (whenInvertMatchisfalse) to a whitelist vibe (when it'strue) πFilterOID OIDFilterValues Value [, Value ...]FilterIgnoreSelected true|false(default)β whenTableis set totrue, these three are your filter squad, letting you configure filtering based on MIB values β¨
FilterOID declares the OID used to fill the table column with values. FilterValues declares the list of values to match against. Whether a table row gets collected or ignored depends on the FilterIgnoreSelected setting. And just like the other plugins that use the daemon's ignorelist functionality, a string that starts and ends with a slash is interpreted as a regular expression π
If no selection is configured at all, then all table rows are selected β everyone's invited π
WhenTableis set tofalse, these options have no effect π
See Table and "IGNORELISTS" for the details, fr fr.
π¦ The Host block π¦
The Host block is where you define which hosts to query, which SNMP community and version to use, and which of the defined Data to actually query π
The argument you pass to the Host block is used as the hostname in the data stored by collectd. Main character energy for real.
Address IP-Address|Hostnameβ sets the address to connect to. The address may include a transport specifier and/or a port number πVersion 1|2|3β picks the SNMP version to use. And when you give2, version"2c"is what's actually used β sneaky but true πCommunity Communityβ passes Community to the host. (Ignored for SNMPv3 π«₯)Username Usernameβ sets the Username to use for SNMPv3 security πSecurityLevel authPriv|authNoPriv|noAuthNoPrivβ selects the security level for SNMPv3 security.Context Contextβ sets the Context for SNMPv3 security.AuthProtocol MD5|SHAβ selects the authentication protocol for SNMPv3 security.AuthPassphrase Passphraseβ sets the authentication passphrase for SNMPv3 security π€«PrivacyProtocol AES|DESβ selects the privacy (encryption) protocol for SNMPv3 security.PrivacyPassphrase Passphraseβ sets the privacy (encryption) passphrase for SNMPv3 security π€Collect Data [Data ...]β defines which values to collect. Data refers to one of the Data blocks above. And since the config file is read top-down, you gotta define the data before you use it here β order matters, bestie πInterval Secondsβ collect data from this host every Seconds seconds. This one's for devices that don't have much CPU to spare β network equipment like switches, embedded devices, rack monitoring systems, that whole crew π₯οΈ. And since the Step of the generated RRD files depends on this setting, it's wise to pick a reasonable value once and never change it. Pick your fighter and commit πTimeout Secondsβ how long to wait for a response. The"Net-SNMP"library default is1second β³Retries Integerβ how many times a query should be retried after the Timeout expires. The"Net-SNMP"library default is5πBulkSize Integerβ configures the size of SNMP bulk transfers. The default is0, which disables bulk transfers altogether π«
π SEE ALSO π
collectd(1), collectd.conf(5), snmpget(1), snmpgetnext(1), variables(5), unix(7)
π AUTHORS π
Florian Forster <octo@collectd.org> and Michael Pilat <mike@mikepilat.com> β absolute icons for writing this π«Ά
And that's a wrap, bestie! β¨ This page is from version 5.12.0.git and it's dated 2026-08-22 β so go forth and SNMP responsibly, mwah ππ
π¦ where this page comes from
- ubuntu stonking: collectd-core 5.12.0-27ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms