Skip to content

Instantly share code, notes, and snippets.

@ksator
Last active April 21, 2021 08:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ksator/e36a1be086da6c2239c2c2c0eb9fe300 to your computer and use it in GitHub Desktop.
How to use telegraf timestamps with the telegraf gnmi input plugin instead of using the devices timestamps

With the telegraf gnmi input plugin, in order to use the telegraf timestamps instead of using the devices timestamps:

Here's the fork https://github.com/rski/telegraf that was used for:
influxdata/telegraf#8411
influxdata/telegraf#8420

Until this option will become natively part of Telegraf (influxdata/telegraf#8689), you can build a docker image from this fork:

git clone https://github.com/rski/telegraf
cd telegraf
make docker-image

Or you can build a docker image from this Dockerfile

FROM golang:1.15.6-buster
WORKDIR /go/src
RUN git clone https://github.com/rski/telegraf.git
RUN cd /go/src/telegraf && make
RUN cp /go/src/telegraf/telegraf ../../bin/.

Then, add use_local_timestamp = true in the [[inputs.gnmi]] configuration.

@ksator
Copy link
Author

ksator commented Apr 21, 2021

There is new update from Telegraf regarding the issue influxdata/telegraf#8411
The solution for this will be to utilize the Starlark processor
There is this example script that can be added to use the current/local timestamp over the field device's timestamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment