.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "COLLECTD-SNMP 5" .TH COLLECTD-SNMP 5 2024-02-04 5.12.0.git collectd .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME collectd\-snmp \- Documentation of collectd's "snmp plugin" .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 10 \& LoadPlugin snmp \& # ... \& \& \& Table false \& Type "voltage" \& TypeInstance "input_line1" \& Scale 0.1 \& Values "SNMPv2\-SMI::enterprises.6050.5.4.1.1.2.1" \& \& \& Table false \& Type "users" \& Shift \-1 \& Values "HOST\-RESOURCES\-MIB::hrSystemNumUsers.0" \& \& \& Table true \& Type "if_octets" \& TypeInstanceOID "IF\-MIB::ifDescr" \& #FilterOID "IF\-MIB::ifOperStatus" \& #FilterValues "1", "2" \& Values "IF\-MIB::ifInOctets" "IF\-MIB::ifOutOctets" \& \& \& 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 \& \& \& 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 \& \& \& \& Address "192.168.0.2" \& Version 1 \& Community "community_string" \& Collect "std_traffic" \& Interval 120 \& Timeout 10 \& Retries 1 \& \& \& Address "192.168.0.42" \& Version 2 \& Community "another_string" \& Collect "std_traffic" "hr_users" \& \& \& 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" \& \& \& Address "tcp:192.168.0.3" \& Version 1 \& Community "more_communities" \& Collect "powerplus_voltge_input" \& Interval 300 \& Timeout 5 \& Retries 5 \& \& .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The \f(CW\*(C`snmp plugin\*(C'\fR queries other hosts using SNMP, the simple network management protocol, and translates the value it receives to collectd's internal format and dispatches them. Depending on the write plugins you have loaded they may be written to disk or submitted to another instance or whatever you configured. .PP 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. .SH CONFIGURATION .IX Header "CONFIGURATION" Since the aim of the \f(CW\*(C`snmp plugin\*(C'\fR is to provide a generic interface to SNMP, its configuration is not trivial and may take some time. .PP Since the \f(CW\*(C`Net\-SNMP\*(C'\fR library is used you can use all the environment variables that are interpreted by that package. See \fBsnmpcmd\fR\|(1) for more details. .PP There are two types of blocks that can be contained in the \&\f(CW\*(C`\*(C'\fR block: \fBData\fR and \fBHost\fR: .SS "The \fBData\fP block" .IX Subsection "The Data block" The \fBData\fR block defines a list of values or a table of values that are to be queried. The following options can be set: .IP "\fBType\fR \fItype\fR" 4 .IX Item "Type type" collectd's type that is to be used, e.\ g. "if_octets" for interface traffic or "users" for a user count. The types are read from the \fBTypesDB\fR (see \fBcollectd.conf\fR\|(5)), so you may want to check for which types are defined. See \fBtypes.db\fR\|(5) for a description of the format of this file. .IP "\fBTable\fR \fItrue|false\fR" 4 .IX Item "Table true|false" Define if this is a single list of values or a table of values. The difference is the following: .Sp When \fBTable\fR is set to \fBfalse\fR, the OIDs given to \fBValues\fR (see below) are queried using the \f(CW\*(C`GET\*(C'\fR SNMP command (see \fBsnmpget\fR\|(1)) and transmitted to collectd. \fBOne\fR value list is dispatched and, eventually, one file will be written. .Sp When \fBTable\fR is set to \fBtrue\fR, the OIDs given to \fBValues\fR, \fBTypeInstanceOID\fR, \&\fBPluginInstanceOID\fR, \fBHostOID\fR and \fBFilterOID\fR (see below) are queried using the \f(CW\*(C`GETNEXT\*(C'\fR SNMP command until the subtree is left. After all the lists (think: all columns of the table) have been read, either (\fBCount\fR set to \fBfalse\fR) \&\fBseveral\fR value sets will be dispatched and, eventually, several files will be written, or (\fBCount\fR set to \fBtrue\fR) one single value will be dispatched. If you configure a \fBType\fR (see above) which needs more than one data source (for example \f(CW\*(C`if_octets\*(C'\fR which needs \f(CW\*(C`rx\*(C'\fR and \f(CW\*(C`tx\*(C'\fR) you will need to specify more than one (two, in the example case) OIDs with the \fBValues\fR option and can't use the \fBCount\fR option. This has nothing to do with the \fBTable\fR setting. .Sp For example, if you want to query the number of users on a system, you can use \&\f(CW\*(C`HOST\-RESOURCES\-MIB::hrSystemNumUsers.0\*(C'\fR. This is one value and belongs to one value list, therefore \fBTable\fR must be set to \fBfalse\fR. Please note that, in this case, you have to include the sequence number (zero in this case) in the OID. .Sp Counter example: If you want to query the interface table provided by the \&\f(CW\*(C`IF\-MIB\*(C'\fR, e.\ g. the bytes transmitted. There are potentially many interfaces, so you will want to set \fBTable\fR to \fBtrue\fR. Because the \&\f(CW\*(C`if_octets\*(C'\fR type needs two values, received and transmitted bytes, you need to specify two OIDs in the \fBValues\fR setting, in this case likely \&\f(CW\*(C`IF\-MIB::ifHCInOctets\*(C'\fR and \f(CW\*(C`IF\-MIB::ifHCOutOctets\*(C'\fR. But, this is because of the \fBType\fR setting, not the \fBTable\fR setting. .Sp Since the semantic of \fBInstance\fR and \fBValues\fR depends on this setting you need to set it before setting them. Doing vice versa will result in undefined behavior. .IP "\fBPlugin\fR \fIPlugin\fR" 4 .IX Item "Plugin Plugin" Use \fIPlugin\fR as the plugin name of the values that are dispatched. Defaults to \f(CW\*(C`snmp\*(C'\fR. .IP "\fBPluginInstance\fR \fIInstance\fR" 4 .IX Item "PluginInstance Instance" Sets the plugin-instance of the values that are dispatched to \fIInstance\fR value. .Sp When \fBTable\fR is set to \fItrue\fR and \fBPluginInstanceOID\fR is set then this option has no effect. .Sp Defaults to an empty string. .IP "\fBTypeInstance\fR \fIInstance\fR" 4 .IX Item "TypeInstance Instance" Sets the type-instance of the values that are dispatched to \fIInstance\fR value. .Sp When \fBTable\fR is set to \fItrue\fR and \fBTypeInstanceOID\fR is set then this option has no effect. .Sp Defaults to an empty string. .IP "\fBTypeInstanceOID\fR \fIOID\fR" 4 .IX Item "TypeInstanceOID OID" .PD 0 .IP "\fBPluginInstanceOID\fR \fIOID\fR" 4 .IX Item "PluginInstanceOID OID" .IP "\fBHostOID\fR \fIOID\fR" 4 .IX Item "HostOID OID" .PD If \fBTable\fR is set to \fItrue\fR, \fIOID\fR 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 the \&\f(CW\*(C`IF\-MIB::ifDescr\*(C'\fR subtree. \fBvariables\fR\|(5) from the SNMP distribution describes the format of OIDs. When option is set to empty string, then "SUBID" will be used as the value. .Sp Prefix may be set for values with use of appropriate \fBTypeInstancePrefix\fR, \&\fBPluginInstancePrefix\fR and \fBHostPrefix\fR options. .Sp When \fBTable\fR is set to \fIfalse\fR or \fBCount\fR is set to \fItrue\fR, these options have no effect. .Sp Defaults: When no one of these options is configured explicitly, \&\fBTypeInstanceOID\fR defaults to an empty string. .IP \fBTypeInstancePrefix\fR 4 .IX Item "TypeInstancePrefix" .PD 0 .IP \fBPluginInstancePrefix\fR 4 .IX Item "PluginInstancePrefix" .IP \fBHostPrefix\fR 4 .IX Item "HostPrefix" .PD These options are intented to be used together with \fBTypeInstanceOID\fR, \&\fBPluginInstanceOID\fR and \fBHostOID\fR respectively. .Sp If set, \fIString\fR is preprended to values received by querying the agent. .Sp When \fBTable\fR is set to \fIfalse\fR or \fBCount\fR is set to \fItrue\fR, these options have no effect. .Sp The \f(CW\*(C`UPS\-MIB\*(C'\fR 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. .IP "\fBInstance\fR \fIInstance\fR" 4 .IX Item "Instance Instance" Attention: this option exists for backwards compatibility only and will be removed in next major release. Please use \fBTypeInstance\fR / \fBTypeInstanceOID\fR instead. .Sp The meaning of this setting depends on whether \fBTable\fR is set to \fItrue\fR or \&\fIfalse\fR. .Sp If \fBTable\fR is set to \fItrue\fR, option behaves as \fBTypeInstanceOID\fR. If \fBTable\fR is set to \fIfalse\fR, option behaves as \fBTypeInstance\fR. .Sp Note what \fBTable\fR option must be set before setting \fBInstance\fR. .IP "\fBInstancePrefix\fR \fIString\fR" 4 .IX Item "InstancePrefix String" Attention: this option exists for backwards compatibility only and will be removed in next major release. Please use \fBTypeInstancePrefix\fR instead. .IP "\fBValues\fR \fIOID\fR [\fIOID\fR ...]" 4 .IX Item "Values OID [OID ...]" Configures the values to be queried from the SNMP host. The meaning slightly changes with the \fBTable\fR setting. \fBvariables\fR\|(5) from the SNMP distribution describes the format of OIDs. .Sp If \fBTable\fR is set to \fItrue\fR, each \fIOID\fR must be the prefix of all the values to query, e.\ g. \f(CW\*(C`IF\-MIB::ifInOctets\*(C'\fR for all the counters of incoming traffic. This subtree is walked (using \f(CW\*(C`GETNEXT\*(C'\fR) until a value from outside the subtree is returned. .Sp If \fBTable\fR is set to \fIfalse\fR, each \fIOID\fR must be the OID of exactly one value, e.\ g. \f(CW\*(C`IF\-MIB::ifInOctets.3\*(C'\fR for the third counter of incoming traffic. .IP "\fBCount\fR \fItrue|false\fR" 4 .IX Item "Count true|false" Instead of dispatching one or multiple values per Table entry containing the \&\fIOID\fR(s) given in the \fBValues\fR option, 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. .Sp When \fBTable\fR is set to \fIfalse\fR, this option has no effect. .IP "\fBScale\fR \fIValue\fR" 4 .IX Item "Scale Value" The gauge-values returned by the SNMP-agent are multiplied by \fIValue\fR. This is useful when values are transferred as a fixed point real number. For example, thermometers may transfer \fB243\fR but actually mean \fB24.3\fR, so you can specify a scale value of \fB0.1\fR to correct this. The default value is, of course, \&\fB1.0\fR. .Sp This value is not applied to counter-values. .IP "\fBShift\fR \fIValue\fR" 4 .IX Item "Shift Value" \&\fIValue\fR is added to gauge-values returned by the SNMP-agent after they have been multiplied by any \fBScale\fR value. If, for example, a thermometer returns degrees Kelvin you could specify a shift of \fB273.15\fR here to store values in degrees Celsius. The default value is, of course, \fB0.0\fR. .Sp This value is not applied to counter-values. .IP "\fBIgnore\fR \fIValue\fR [, \fIValue\fR ...]" 4 .IX Item "Ignore Value [, Value ...]" The ignore values allows one to ignore TypeInstances based on their name and the patterns specified by the various values you've entered. The match is a glob-type shell matching. .Sp When \fBTable\fR is set to \fIfalse\fR then this option has no effect. .IP "\fBInvertMatch\fR \fItrue|false(default)\fR" 4 .IX Item "InvertMatch true|false(default)" The invertmatch value should be use in combination of the Ignore option. It changes the behaviour of the Ignore option, from a blacklist behaviour when InvertMatch is set to false, to a whitelist when specified to true. .IP "\fBFilterOID\fR \fIOID\fR" 4 .IX Item "FilterOID OID" .PD 0 .IP "\fBFilterValues\fR \fIValue\fR [, \fIValue\fR ...]" 4 .IX Item "FilterValues Value [, Value ...]" .IP "\fBFilterIgnoreSelected\fR \fItrue|false(default)\fR" 4 .IX Item "FilterIgnoreSelected true|false(default)" .PD When \fBTable\fR is set to \fItrue\fR, these options allow to configure filtering based on MIB values. .Sp The \fBFilterOID\fR declares \fIOID\fR to fill table column with values. The \fBFilterValues\fR declares values list to do match. Whether table row will be collected or ignored depends on the \fBFilterIgnoreSelected\fR setting. As with other plugins that use the daemon's ignorelist functionality, a string that starts and ends with a slash is interpreted as a regular expression. .Sp If no selection is configured at all, \fBall\fR table rows are selected. .Sp When \fBTable\fR is set to \fIfalse\fR then these options has no effect. .Sp See \fBTable\fR and \fI/"IGNORELISTS"\fR for details. .SS "The Host block" .IX Subsection "The Host block" The \fBHost\fR block defines which hosts to query, which SNMP community and version to use and which of the defined \fBData\fR to query. .PP The argument passed to the \fBHost\fR block is used as the hostname in the data stored by collectd. .IP "\fBAddress\fR \fIIP-Address\fR|\fIHostname\fR" 4 .IX Item "Address IP-Address|Hostname" Set the address to connect to. Address may include transport specifier and/or port number. .IP "\fBVersion\fR \fB1\fR|\fB2\fR|\fB3\fR" 4 .IX Item "Version 1|2|3" Set the SNMP version to use. When giving \fB2\fR version \f(CW\*(C`2c\*(C'\fR is actually used. .IP "\fBCommunity\fR \fICommunity\fR" 4 .IX Item "Community Community" Pass \fICommunity\fR to the host. (Ignored for SNMPv3). .IP "\fBUsername\fR \fIUsername\fR" 4 .IX Item "Username Username" Sets the \fIUsername\fR to use for SNMPv3 security. .IP "\fBSecurityLevel\fR \fIauthPriv\fR|\fIauthNoPriv\fR|\fInoAuthNoPriv\fR" 4 .IX Item "SecurityLevel authPriv|authNoPriv|noAuthNoPriv" Selects the security level for SNMPv3 security. .IP "\fBContext\fR \fIContext\fR" 4 .IX Item "Context Context" Sets the \fIContext\fR for SNMPv3 security. .IP "\fBAuthProtocol\fR \fIMD5\fR|\fISHA\fR" 4 .IX Item "AuthProtocol MD5|SHA" Selects the authentication protocol for SNMPv3 security. .IP "\fBAuthPassphrase\fR \fIPassphrase\fR" 4 .IX Item "AuthPassphrase Passphrase" Sets the authentication passphrase for SNMPv3 security. .IP "\fBPrivacyProtocol\fR \fIAES\fR|\fIDES\fR" 4 .IX Item "PrivacyProtocol AES|DES" Selects the privacy (encryption) protocol for SNMPv3 security. .IP "\fBPrivacyPassphrase\fR \fIPassphrase\fR" 4 .IX Item "PrivacyPassphrase Passphrase" Sets the privacy (encryption) passphrase for SNMPv3 security. .IP "\fBCollect\fR \fIData\fR [\fIData\fR ...]" 4 .IX Item "Collect Data [Data ...]" Defines which values to collect. \fIData\fR refers to one of the \fBData\fR block above. Since the config file is read top-down you need to define the data before using it here. .IP "\fBInterval\fR \fISeconds\fR" 4 .IX Item "Interval Seconds" Collect data from this host every \fISeconds\fR seconds. This option is meant for devices with not much CPU power, e.\ g. network equipment such as switches, embedded devices, rack monitoring systems and so on. Since the \&\fBStep\fR of generated RRD files depends on this setting it's wise to select a reasonable value once and never change it. .IP "\fBTimeout\fR \fISeconds\fR" 4 .IX Item "Timeout Seconds" How long to wait for a response. The \f(CW\*(C`Net\-SNMP\*(C'\fR library default is 1 second. .IP "\fBRetries\fR \fIInteger\fR" 4 .IX Item "Retries Integer" The number of times that a query should be retried after the Timeout expires. The \f(CW\*(C`Net\-SNMP\*(C'\fR library default is 5. .IP "\fBBulkSize\fR \fIInteger\fR" 4 .IX Item "BulkSize Integer" Configures the size of SNMP bulk transfers. The default is 0, which disables bulk transfers altogether. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBcollectd\fR\|(1), \&\fBcollectd.conf\fR\|(5), \&\fBsnmpget\fR\|(1), \&\fBsnmpgetnext\fR\|(1), \&\fBvariables\fR\|(5), \&\fBunix\fR\|(7) .SH AUTHORS .IX Header "AUTHORS" Florian Forster Michael Pilat