snmp_agent plugin¶
| Plugin name | snmp_agent |
| Type | write |
| Callbacks | init, config, write, missing, shutdown |
| Status | supported |
| Since | 5.8 |
| Copyright | 2017 Intel Corporation, Roman Korynkevych, Serhiy Pshyk, |
| License | MIT License |
| Configuration | collectd.conf(5) |
The SNMP Agent plugin is an AgentX subagent that receives and handles queries from SNMP master agent and returns the data collected by read plugins. The SNMP Agent plugin handles requests only for OIDs specified in configuration file. To handle SNMP queries the plugin gets data from collectd and translates requested values from collectd's internal format to SNMP format.
This plugin is a generic plugin, i.e. it cannot work without configuration, because there is no reasonable default behavior. Please read the Plugin snmp_agent section of the collectd.conf(5) manual page for an in-depth description of the plugin's configuration.
Synopsis¶
<nowiki><Plugin snmp_agent>
<Data "memAvailReal">
Plugin "memory"
Type "memory"
TypeInstance "free"
OIDs "1.3.6.1.4.1.2021.4.6.0"
</Data>
<Table "ifTable">
IndexOID "IF-MIB::ifIndex"
SizeOID "IF-MIB::ifNumber"
<Data "ifDescr">
Instance true
Plugin "interface"
OIDs "IF-MIB::ifDescr"
</Data>
<Data "ifOctets">
Plugin "interface"
Type "if_octets"
TypeInstance ""
OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
</Data>
</Table>
</Plugin></nowiki>
Parameters¶
For more information on the configuration parameters, see collectd.conf(5).
Example graph¶
None yet. Add one now!
Dependencies¶
Caveats¶
History¶
- 5.8: This new plugin implements an SNMP AgentX subagent that receives and handles queries from SNMP master agent and returns configured metrics.
- 5.9: Multiple key indexes to snmp table and other new features have been added, refactoring, coverity scan issues have been fixed.
See also¶
Configuration¶
Configuration options · from collectd.conf(5)
See this section in the full configuration reference
The snmp_agent plugin is an AgentX subagent that receives and handles queries from SNMP master agent and returns the data collected by read plugins. The snmp_agent plugin handles requests only for OIDs specified in configuration file. To handle SNMP queries the plugin gets data from collectd and translates requested values from collectd's internal format to SNMP format. This plugin is a generic plugin and cannot work without configuration. For more details on AgentX subagent see <http://www.net-snmp.org/tutorial/tutorial-5/toolkit/demon/>
Synopsis:
<Plugin snmp_agent>
<Data "memAvailReal">
Plugin "memory"
#PluginInstance "some"
Type "memory"
TypeInstance "free"
OIDs "1.3.6.1.4.1.2021.4.6.0"
</Data>
<Table "ifTable">
IndexOID "IF-MIB::ifIndex"
SizeOID "IF-MIB::ifNumber"
<Data "ifDescr">
<IndexKey>
Source "PluginInstance"
</IndexKey>
Plugin "interface"
OIDs "IF-MIB::ifDescr"
</Data>
<Data "ifOctets">
Plugin "interface"
Type "if_octets"
TypeInstance ""
OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
</Data>
</Table>
<Table "CPUAffinityTable">
<Data "DomainName">
<IndexKey>
Source "PluginInstance"
</IndexKey>
Plugin "virt"
OIDs "LIBVIRT-HYPERVISOR-MIB::lvhAffinityDomainName"
</Data>
<Data "VCPU">
Plugin "virt"
<IndexKey>
Source "TypeInstance"
Regex "^vcpu_([0-9]{1,3})-cpu_[0-9]{1,3}$"
Group 1
</IndexKey>
OIDs "LIBVIRT-HYPERVISOR-MIB::lvhVCPUIndex"
</Data>
<Data "CPU">
Plugin "virt"
<IndexKey>
Source "TypeInstance"
Regex "^vcpu_[0-9]{1,3}-cpu_([0-9]{1,3})$"
Group 1
</IndexKey>
OIDs "LIBVIRT-HYPERVISOR-MIB::lvhCPUIndex"
</Data>
<Data "CPUAffinity">
Plugin "virt"
Type "cpu_affinity"
OIDs "LIBVIRT-HYPERVISOR-MIB::lvhCPUAffinity"
</Data>
</Table>
</Plugin>
There are two types of blocks that can be contained in the <PluginE<nbsp snmp_agentE<gt>> block: Data and Table:
Data block¶
The Data block defines a list OIDs that are to be handled. This block can define scalar or table OIDs. If Data block is defined inside of Table block it reperesents table OIDs. The following options can be set:
- IndexKey block
-
IndexKey block contains all data needed for proper index build of snmp table. In case more than one table Data block has IndexKey block present then multiple key index is built. If Data block defines scalar data type IndexKey has no effect and can be omitted.
- Source String
- Source can be set to one of the following values: "Hostname", "Plugin", "PluginInstance", "Type", "TypeInstance". This value indicates which field of corresponding collectd metric is taken as a SNMP table index.
- Regex String
- Regex option can also be used to parse strings or numbers out of specific field. For example: type-instance field which is "vcpu1-cpu2" can be parsed into two numeric fields CPU = 2 and VCPU = 1 and can be later used as a table index.
- Group Number
- Group number can be specified in case groups are used in regex.
- Plugin String
- Read plugin name whose collected data will be mapped to specified OIDs.
- PluginInstance String
- Read plugin instance whose collected data will be mapped to specified OIDs. The field is optional and by default there is no plugin instance check. Allowed only if Data block defines scalar data type.
- Type String
- Collectd's type that is to be used for specified OID, e. g. "if_octets" for example. The types are read from the TypesDB (see collectd.conf(5)).
- TypeInstance String
- Collectd's type-instance that is to be used for specified OID.
- OIDs OID [OID ...]
- Configures the OIDs to be handled by snmp_agent plugin. Values for these OIDs are taken from collectd data type specified by Plugin, PluginInstance, Type, TypeInstance fields of this Data block. Number of the OIDs configured should correspond to number of values in specified Type. For example two OIDs "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets" can be mapped to "rx" and "tx" values of "if_octets" type.
- Scale Value
- The values taken from collectd are multiplied by Value. The field is optional and the default is 1.0.
- Shift Value
- Value is added to values from collectd after they have been multiplied by Scale value. The field is optional and the default value is 0.0.
The Table block¶
The Table block defines a collection of Data blocks that belong to one snmp table. In addition to multiple Data blocks the following options can be set:
- IndexOID OID
- OID that is handled by the plugin and is mapped to numerical index value that is generated by the plugin for each table record.
- SizeOID OID
- OID that is handled by the plugin. Returned value is the number of records in the table. The field is optional.