Configure the Server Density agent to monitor SNMP to:
• Collect metrics from your SNMP devices
Monitored metrics
The SNMP plugin does not automatically collect metrics. You must configure the plugin to collect specific metrics.
Installing the SNMP Plugin
Install the SNMP plugin on Debian/Ubuntu:
sudo apt-get install sd-agent-snmp
Install the SNMP plugin on RHEL/CentOS:
sudo yum install sd-agent-snmp
Read more about agent plugins.
Configuring the agent to monitor via SNMP
1. Configure /etc/sd-agent/conf.d/snmp.yaml
The SNMP check does not automatically collect metrics. You must configure the plugin to collect specific metrics.
init_config: - mibs_folder: /path/to/your/mibs instances: - ip_address: localhost port: 161 community_string: public # snmp_version: 1 # set to 1 if your devices use SNMP v1; no need to set otherwise, the default is 2 timeout: 1 # in seconds; default is 1 retries: 5 # enforce_mib_constraints: false # set to false to NOT verify that returned values meet MIB constraints; default is true metrics: - MIB: UDP-MIB symbol: udpInDatagrams - OID: 1.3.6.1.2.1.6.5 name: tcpPassiveOpens - MIB: IF-MIB table: ifTable symbols: - ifInOctets - ifOutOctets metric_tags: - tag: interface column: ifDescr>
You can collect metrics from multiple SNMP enabled devices by listing each device as it's own instance in your snmp.yaml.
There are 3 different ways that you can specify which metrics to collect in your snmp.yaml; MIB and symbol, OID and name and MIB and table
MIB and Symbol
metrics: - MIB: UDP-MIB symbol: udpInDatagrams
OID and Name
metrics: - OID: 1.3.6.1.2.1.6.5 name: tcpActiveOpens # what to use in the metric name; can be anything
MIB and Table
metrics: - MIB: IF-MIB table: ifTable symbols: - ifInOctets # row whose value becomes metric value metric_tags: - tag: interface # tag name column: ifDescr # the column name to get the tag value from, OR #index: 1 # the column index to get the tag value from
Using your own MIB
It's possible to use your own MIBs if they are formatted via pysnmp. You can use the build-pysnmp-mibs
script that ships with the agent to generate this data.
/usr/share/python/sd-agent/bin/build-pysnmp-mib -o /path/to/your/mibs mib-input-text-file
2. Restart the agent
sudo /etc/init.d/sd-agent restart
Verifying the configuration
Execute info to verify the configuration with the following:
sudo /etc/init.d/sd-agent info
If the agent has been configured correctly you’ll see an output such as:
snmp ----- - instance #0 [OK] - Collected 32 metrics, 0 events & 0 service checks
You can also check the metrics that the check is returning with the following command
sudo -u sd-agent /usr/share/python/sd-agent/agent.py check snmp
Comments