# InfluxDB v2 input plugin?

**URL:** <https://community.influxdata.com/t/influxdb-v2-input-plugin/23656>\
**Category:** Telegraf\
**Created:** [February 2, 2022, 4:39pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656 "2022-02-02T16:39:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dg-eparizzi](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/dg-eparizzi/32/8066_2.png) [@dg-eparizzi](https://community.influxdata.com/u/dg-eparizzi)\
**Post date:** [February 2, 2022, 4:39pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656/1 "2022-02-02T16:39:56Z")

</div>

I’m confused about whether this exists or not. I’m talking about an input plugin that will read metrics from a bucket, not the generic InfluxDB process metrics.

My use case is the following.  
I have an instance of InfluxDB OSS (2.0.9). A couple of services are writing data using official SDKs. These clients are mostly writing every second.  
I need to read from this instance and write to InfluxDB Cloud at a slower interval, say 10s. I don’t need to downsample or do any aggregations. I just need to take a snapshot of the last value written for each series every 10s.

Is this possible to achieve with Telegraf?

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [February 2, 2022, 6:34pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656/2 "2022-02-02T18:34:34Z")

</div>

In your case, I would probably write a script to grab the latest value, and then use the `exec` input plugin and ensure the interval is set to 10 seconds.

We do not currently have an influxdb\_v2 input plugin.

What I have seen used to relay to InfluxDB is the [influxdb\_v2 listener](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb_v2_listener) input. In this case users would push to the listener and it would relay to InfluxDB. However, that doesn’t sound like a fit in your case.

---

<div class="post-metadata">

**Author:** ![dg-eparizzi](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/dg-eparizzi/32/8066_2.png) [@dg-eparizzi](https://community.influxdata.com/u/dg-eparizzi)\
**Post date:** [February 3, 2022, 2:50pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656/3 "2022-02-03T14:50:24Z")

</div>

By using influxdb\_v2 listener input plugin could I then have 2 different influxdb\_v2 output plugins? One pointed at the OSS instance and writing every second and another one pointed at the cloud instance writing every 10s?. Looking at the documentation of the influxdb\_v2 output plugin I guess this is not possible as the interval is set in the main telegraf config and can’t be specified for each output plugin.

So… what if the services writes both to the OSS InfluxDB and to the Telegraf (with influxdb\_v2 listener input and influxdb\_v2 output plugin pointed to the InfluxDB Cloud).  
This way all data would be written to the OSS InfluxDB and Telegraf would take care to only write to the InfluxDB Cloud every 10s, right?  
We could even throw in the aggregators.basicstats Telegraf plugin to get the mean value of each series in 10s intervals and write that to InfluxDB Cloud…

I’m going to try this.

---

<div class="post-metadata">

**Author:** ![dg-eparizzi](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/dg-eparizzi/32/8066_2.png) [@dg-eparizzi](https://community.influxdata.com/u/dg-eparizzi)\
**Post date:** [February 3, 2022, 3:04pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656/4 "2022-02-03T15:04:24Z")

</div>

I guess my question is…

Can I write to this influxdb\_v2 listener with standard InfluxDB 2 SDKs? Simply pointing to the telegraf input plugin (i.e. [http://localhost:8087](http://localhost:8087))? What about authentication? How do I create tokens and such?

---

<div class="post-metadata">

**Author:** ![jpowers](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jpowers/32/8569_2.png) [@jpowers](https://community.influxdata.com/u/jpowers)\
**Post date:** [February 3, 2022, 3:32pm UTC](https://community.influxdata.com/t/influxdb-v2-input-plugin/23656/5 "2022-02-03T15:32:26Z")

</div>

> Looking at the documentation of the influxdb\_v2 output plugin I guess this is not possible as the interval is set in the main telegraf config and can’t be specified for each output plugin.

Correct, Telegraf outputs all get written at the same time from the buffer. There is no logic to tell what metrics were written to one output versus another.

> So… what if the services writes both to the OSS InfluxDB and to the Telegraf (with influxdb\_v2 listener input and influxdb\_v2 output plugin pointed to the InfluxDB Cloud).  
> This way all data would be written to the OSS InfluxDB and Telegraf would take care to only write to the InfluxDB Cloud every 10s, right?

Yeah, this is how I would approach this.

> Can I write to this influxdb\_v2 listener with standard InfluxDB 2 SDKs? Simply pointing to the telegraf input plugin (i.e. [http://localhost:8087](http://localhost:8087))? What about authentication? How do I create tokens and such?

SDKs should work.

The [influxdb\_v2 README](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/influxdb_v2_listener) has config options for either a token that you make up or using cert based authentication.

Good luck!
