Skip to content
Florian Forster edited this page Nov 26, 2023 · 1 revision
Name: SNMP plugin
Type: read
Callbacks: config, init, read, shutdown
Status: supported
FirstVersion: 4.1
Copyright: 2007–2012 Florian Forster
License: MIT License
Manpage: collectd.conf(5)
See also: List of Plugins

Description

The SNMP plugin uses the Net-SNMP library to read values from network devices using the Simple Network Management Protocol (SNMP). SNMP is a widespread standard to provide management data from devices such as switches, routers, rack monitoring systems, uninterruptible power supplies (UPS), etc. While theoretically possible, collecting values from other computers via this protocol is discouraged in favor of collectd's own protocol, implemented by the Network plugin.

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 section of the collectd.conf(5) manual page for an in-depth description of the plugin's configuration. The majority of documentation for this plugin has been moved to the collectd-snmp(5) manual page.

Some data definitions for the SNMP plugin can be found in the contrib/snmp-data.conf file in the source tarball. If you have additions to this file, feel free to send them to the mailing-list.

Synopsis

 LoadPlugin snmp
 # ...
 <Plugin snmp>
   <Data "powerplus_voltge_input">
     Type "voltage"
     Table false
     Instance "input_line1"
     Scale 0.1
     Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
   </Data>
   <Data "hr_users">
     Type "users"
     Table false
     Instance ""
     Shift -1
     Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
   </Data>
   <Data "std_traffic">
     Type "if_octets"
     Table true
     Instance "IF-MIB::ifDescr"
     Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
   </Data>

   <Host "some.switch.mydomain.org">
     Address "192.168.0.2"
     Version 1
     Community "community_string"
     Collect "std_traffic"
     Interval 120
   </Host>
   <Host "some.server.mydomain.org">
     Address "192.168.0.42"
     Version 2
     Community "another_string"
     Collect "std_traffic" "hr_users"
   </Host>
   <Host "some.ups.mydomain.org">
     Address "192.168.0.3"
     Version 1
     Community "more_communities"
     Collect "powerplus_voltge_input"
     Interval 300
   </Host>
 </Plugin>

Example graphs

Data center power supply

The following graphs are from a device monitoring a data center's power supply. The graphs show voltage, current, power and (\cos(\phi)) for a main line or fuse.

Plugin-snmp-voltage.png

Plugin-snmp-current.png

Plugin-snmp-power.png

Plugin-snmp-cosphi.png

Caveats

Unique instance names

You should be careful with the OID you use for the Instance parameter: For example IF-MIB::ifDescr is often not sufficiently unique, using IF-MIB::ifName may be better. In some of the provided examples this will bite you with certain devices (for example switches by Cisco).

Another problem may arise from instance names being too long. Currently there is a 63 character limit on instance names, see Naming-schema. If two strings only differ after the 63rd character, the resulting name will not be unique.

Maximum number of hosts

While collectd and the SNMP plugin don't have any limitation on the number of hosts you can configure, the library used by the SNMP plugin, libnetsnmp, uses the select(2) system call. This system call uses a fixed-size bitfield to hold file descriptors. On many systems this limits the number of hosts you can query with the SNMP plugin to 1024 (for example when using the GNU libc).

To solve this issue, the netsnmp library must be changed. A solution would be to switch to the poll(2) system call which doesn't have a static limit on the largest file descriptor it can handle.

Dependencies

See also

Clone this wiki locally