Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snmp plugin documentation/example #704

Closed
etlweather opened this issue Feb 16, 2016 · 16 comments
Closed

snmp plugin documentation/example #704

etlweather opened this issue Feb 16, 2016 · 16 comments

Comments

@etlweather
Copy link

I am having a little bit of difficulties working out how I would configure Telegraf to collect interface usage of multiple Cisco switches.

What I would like is to collect in/out bits counters of all ports of multiple switches (about 70) and have that sent to InfluxDB. I am thinking that the switch name and port would be a tag.

@tux-00
Copy link

tux-00 commented Feb 16, 2016

telegraf.conf :

[[inputs.snmp]]

  interval = "10s"
  snmptranslate_file = "/etc/telegraf/oids"

    # Firewall
  [[inputs.snmp.host]]
    address = "192.168.138.1:161"
    community = "public"
    version = 2
    timeout = 2.0
    retries = 0
    collect = ["if_out_octets", "if_in_octets"]

    # Interface output (octets)
  [[inputs.snmp.bulk]]
    name = "if_out_octets"
    max_repetition = 127
    oid = ".1.3.6.1.2.1.31.1.1.1.10"

    # Interface input (octets)
  [[inputs.snmp.bulk]]
    name = "if_in_octets"
    max_repetition = 127
    oid = ".1.3.6.1.2.1.31.1.1.1.6"

Grafana request example (look at your influxdb tables to understand values) :

SELECT DERIVATIVE(MEAN("ifHCInOctets")) FROM "ifHCInOctets" WHERE "host" = '192.168.138.1' AND "instance" = '10' AND $timeFilter GROUP BY time($interval) fill(null)

Instance match in this case the interface of your device. If I understand, 'instance' will appears each times you put an 'inputs.snmp.bulk'.

I agree that is not simple to understand when starting to play with telegraf.

@etlweather
Copy link
Author

Cool, that gives me a starting point. Any way to add tags based on SNMP values? I would also like to tag with the VLAN ID the port has.

@tux-00
Copy link

tux-00 commented Feb 16, 2016

Test and check you InfluxDB database, but I think the "name" parameter in telegraf.conf is present.

@sparrc
Copy link
Contributor

sparrc commented Feb 19, 2016

@tux-00 @etlweather is there still an issue here? If there is something unclear in the documentation I would appreciate it a lot if you could submit a PR to clarify :)

@sparrc sparrc closed this as completed Feb 19, 2016
@etlweather
Copy link
Author

@sparrc - yes, I will use the data I got here and work out the config. Once I have it working, I'll submit a PR with more detailed documentation for the snmp plugin.

@etlweather
Copy link
Author

@sparrc - Definitely interested in submitting a PR once I understand it better.

@tux-00 - Somehow this configuration does not give me an instance tag, all I get for a if_out_octects reading is "host".

@claytondukes
Copy link

How can I map ifName so that the instance shows as the interface name instead?
I tried adding

[[inputs.snmp.bulk]]
    name = "ifname"
    max_repetition = 127
    oid = ".1.3.6.1.2.1.31.1.1.1.1.4"

@titilambert
Copy link
Contributor

Hello !
@claytondukes this case is covered in the current master. We just have to wait the next release (v0.10.5).
See the current documentation: https://github.com/influxdata/telegraf/blob/master/plugins/inputs/snmp/README.md

@etlweather please submit a PR to get a better documentation... this SNMP plugin is NOT really simple :/

@etlweather
Copy link
Author

@titilambert - I just read the README.md you linked - that is great! Looks like v0.10.5 will do just what I need. My only comment is on the README is that what I was looking for was at the end :)

@claytondukes
Copy link

Thanks @titilambert,
I have read that and still having difficulty getting it to run when I add the examples.
Here's the error:

2016/03/08 15:01:17 line 27: field corresponding to `table' is not defined in '*snmp.Host'

Here's my config:


[[inputs.snmp]]
  interval = "10s"
  snmptranslate_file = "/etc/telegraf/oids.txt"
  [[inputs.snmp.host]]
    address = "10.0.0.1:161"
    community = "public"
    version = 2
    timeout = 2.0
    retries = 0
   collect = ["if_out_octets", "if_in_octets", "bytes_recv", "bytes_send"]
  [[inputs.snmp.bulk]]
    name = "if_out_octets"
    max_repetition = 127
    oid = ".1.3.6.1.2.1.31.1.1.1.10"
  [[inputs.snmp.bulk]]
    name = "if_in_octets"
    max_repetition = 127
    oid = ".1.3.6.1.2.1.31.1.1.1.6"
  [[inputs.snmp.bulk]]
    name = "bytes_recv"
    oid = ".1.3.6.1.2.1.31.1.1.1.6"
    unit = "octets"
  [[inputs.snmp.bulk]]
    name = "bytes_send"
    oid = ".1.3.6.1.2.1.31.1.1.1.10"
    unit = "octets"
   [[inputs.snmp.host.table]]
      name = "iftable"
      include_instances = ["Gi0/0", "Gi0/1"]
  # table with mapping but without subtables
  [[inputs.snmp.table]]
    name = "iftable"
    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

@titilambert
Copy link
Contributor

@claytondukes you have to use the last version of Telegraf on master (v0.10.5). It seems you use Telegraf version v0.10.4, isn't it ?

@claytondukes
Copy link

Ah man! I have been pulling my hair out. I just installed this yesterday. Odd.

@claytondukes
Copy link

Ah, because the install guide still has 10.4 ;)
https://github.com/influxdata/telegraf

@claytondukes
Copy link

Do you have a link for the .deb for that version?

@sparrc
Copy link
Contributor

sparrc commented Mar 9, 2016

@claytondukes 0.10.5 has not been released yet, we might cut a release on Thursday but I will need to check with my manager

@claytondukes
Copy link

@sparrc, thanks. Looking forward to it. Happy to be an early tester if you want. I am just investigating this for a client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants