-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b316646
commit 5d87c33
Showing
1 changed file
with
278 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
# SNMP Input Plugin | ||
|
||
The SNMP input plugin gathers metrics from SNMP agents | ||
|
||
### Configuration: | ||
|
||
Very Simple Example | ||
|
||
```toml | ||
# Very Simple Example | ||
[[inputs.snmp]] | ||
|
||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Simple list of OIDs to get, in addition to "collect" | ||
get_oids = [".1.3.6.1.2.1.2.2.1.4.1"] | ||
``` | ||
|
||
Simple example | ||
|
||
```toml | ||
# Simple example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which get/bulk do you want to collect for this host | ||
collect = ["interface_speed", "ifnumber"] | ||
|
||
[[inputs.snmp.get]] | ||
name = "interface_speed" | ||
oid = "ifSpeed" | ||
instance = "1" | ||
|
||
[[inputs.snmp.get]] | ||
name = "ifnumber" | ||
oid = "ifNumber" | ||
``` | ||
|
||
Simple bulk example | ||
|
||
```toml | ||
# Simple bulk example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which get/bulk do you want to collect for this host | ||
collect = ["interface_speed", "if_number", "if_out_octets"] | ||
|
||
[[inputs.snmp.get]] | ||
name = "interface_speed" | ||
oid = "ifSpeed" | ||
instance = "1" | ||
|
||
[[inputs.snmp.get]] | ||
name = "if)number" | ||
oid = "ifNumber" | ||
|
||
[[inputs.snmp.host.table]] | ||
name = "if_out_octets" | ||
oid = "ifOutOctets" | ||
max_repetition = 4 | ||
``` | ||
|
||
Simple (bulk) table example | ||
|
||
```toml | ||
# Simple table example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which get/bulk do you want to collect for this host | ||
collect = ["interface_speed", "if_number", "if_out_octets"] | ||
# Which table do you want to collect | ||
[[inputs.snmp.host.table]] | ||
name = "iftable1" | ||
|
||
# table without mapping neither subtables | ||
# This is like bulk request | ||
[[inputs.snmp.table]] | ||
name = "iftable1" | ||
oid = ".1.3.6.1.2.1.31.1.1.1" | ||
|
||
[[inputs.snmp.get]] | ||
name = "interface_speed" | ||
oid = "ifSpeed" | ||
instance = "1" | ||
|
||
[[inputs.snmp.get]] | ||
name = "if)number" | ||
oid = "ifNumber" | ||
|
||
[[inputs.snmp.host.table]] | ||
name = "if_out_octets" | ||
oid = "ifOutOctets" | ||
max_repetition = 4 | ||
``` | ||
|
||
Table with subtable example | ||
|
||
```toml | ||
# Simple table with subtable example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which table do you want to collect | ||
[[inputs.snmp.host.table]] | ||
name = "iftable2" | ||
|
||
# table without mapping but with subtables | ||
[[inputs.snmp.table]] | ||
name = "iftable2" | ||
oid = ".1.3.6.1.2.1.31.1.1.1" | ||
sub_tables = [".1.3.6.1.2.1.2.2.1.13"] | ||
``` | ||
|
||
Table with mapping example | ||
|
||
```toml | ||
# Simple table with mapping example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which table do you want to collect | ||
[[inputs.snmp.host.table]] | ||
name = "iftable3" | ||
include_instances = ["enp5s0", "eth1"] | ||
|
||
# table with mapping but without subtables | ||
[[inputs.snmp.table]] | ||
name = "iftable3" | ||
oid = ".1.3.6.1.2.1.31.1.1.1" | ||
# if empty. get all instances | ||
mapping_table = ".1.3.6.1.2.1.31.1.1.1.1" | ||
# if empty, get all subtables | ||
``` | ||
|
||
Table with both mapping and subtable example | ||
|
||
```toml | ||
# Table with both mapping and subtable example | ||
[[inputs.snmp]] | ||
## Use 'oids.txt' file to translate oids to names | ||
## To generate 'oids.txt' you need to run: | ||
## snmptranslate -m all -Tz -On | sed -e 's/"//g' > /tmp/oids.txt | ||
## Or if you have an other MIB folder with custom MIBs | ||
## snmptranslate -M /mycustommibfolder -Tz -On -m all | sed -e 's/"//g' > oids.txt | ||
snmptranslate_file = "/tmp/oids.txt" | ||
[[inputs.snmp.host]] | ||
address = "127.0.0.1:161" | ||
# SNMP community | ||
community = "public" # default public | ||
# SNMP version (1, 2 or 3) | ||
# Version 3 not supported yet | ||
version = 2 # default 2 | ||
# Which table do you want to collect | ||
[[inputs.snmp.host.table]] | ||
name = "iftable4" | ||
include_instances = ["enp5s0", "eth1"] | ||
|
||
# table with both mapping and subtables | ||
[[inputs.snmp.table]] | ||
name = "iftable4" | ||
oid = ".1.3.6.1.2.1.31.1.1.1" | ||
# if empty get all instances | ||
mapping_table = ".1.3.6.1.2.1.31.1.1.1.1" | ||
# if empty get all subtables | ||
# sub_tables could be not "real subtables" | ||
sub_tables=[".1.3.6.1.2.1.2.2.1.13", "bytes_recv", "bytes_send"] | ||
|
||
# SNMP SUBTABLES | ||
[[plugins.snmp.subtable]] | ||
name = "bytes_recv" | ||
oid = ".1.3.6.1.2.1.31.1.1.1.6" | ||
unit = "octets" | ||
|
||
[[plugins.snmp.subtable]] | ||
name = "bytes_send" | ||
oid = ".1.3.6.1.2.1.31.1.1.1.10" | ||
unit = "octets" | ||
``` | ||
|
||
|
||
### Measurements & Fields: | ||
|
||
With the last example (Table with both mapping and subtable example): | ||
|
||
- ifHCOutOctets | ||
- ifHCOutOctets | ||
- ifInDiscards | ||
- ifInDiscards | ||
- ifHCInOctets | ||
- ifHCInOctets | ||
|
||
### Tags: | ||
|
||
With the last example (Table with both mapping and subtable example): | ||
|
||
- ifHCOutOctets | ||
- host | ||
- instance | ||
- unit | ||
- ifInDiscards | ||
- host | ||
- instance | ||
- ifHCInOctets | ||
- host | ||
- instance | ||
- unit | ||
|
||
### Example Output: | ||
|
||
With the last example (Table with both mapping and subtable example): | ||
|
||
``` | ||
ifHCOutOctets,host=127.0.0.1,instance=enp5s0,unit=octets ifHCOutOctets=10565628i 1456878706044462901 | ||
ifInDiscards,host=127.0.0.1,instance=enp5s0 ifInDiscards=0i 1456878706044510264 | ||
ifHCInOctets,host=127.0.0.1,instance=enp5s0,unit=octets ifHCInOctets=76351777i 1456878706044531312 | ||
``` |