Writing a processor plugin to enrich collected SNMP data


I’m collecting some SNMP data from a Table which is awkwardly structured and which needs enrichment (with tags dependent on the exact table index) from an external non-SNMP source. It seems to me that a processor plugin is the easiest way to proceed.

So, using the CONTRIBUTING documentation and Jack’s useful video tutorial on writing a plugin I figured a good way to proceed was to replicate the processors.printer plugin which a new name, and then build on that base.

However, I can’t get much traction because I can’t even get the printer plugin to function. With a functioning SNMP collection configuration, I added the [[processors.printer]] block in various locations in the config file, all to no avail.

A gist of the overall config file looks like this:


  urls = ["http://localhost:8086"]
  database = "test_db"

  agents = [ "device.example.com:161" ]
  name = "devicetest"

    name = "hostname"
    oid = "RFC1213-MIB::sysName.0"
    is_tag = true

    name = "devicetest"
    inherit_tags = [ "hostname" ]
    index_as_tag = true
    oid = "DEVICE-MIB::MeasurementsTable"

      namepass = "devicetest"

Telegraf is accepting my configuration (eg. if I put in a parameter unexpected by processors.printer, it issues an error message), but it would seem it is not sending any data for processing. I’ve also tried removing the namepass part of the configuration.

Is there anything I’ve missed?

I’ve tried this with both versions v1.4.4 and v1.6.0~5928219.


Are you sure that a devicetest measurement is being emitted? Try removing the namepass filter and see what happens.

Hi daniel,

The SNMP query is certainly working (300-odd table entries in my case), but your message prompted me to actually configure telegraf to run as a service, rather than in test mode, just to confirm it was writing data into influxdb. It was.

But I then noticed that telegraf was logging the “printed” data into /var/log/syslog. Replacing the processors.printer with my own processor, which adds an extra tag, demonstrated the additional tag was now being both logged and stored in influxdb.

My fundamental problem was I misunderstood the difference between the --test and --debug flags - the first only prints the outcome of the Gather phase, whereas the latter will fully run telegraf and additionally render to stderr the output from processors.printer, and now, my own processor.

Thanks for your help,