Configure influxdb cloud to connect to ttn

Newbie here, i am trying to connect my ttn to influxdb cloud but get the following response in my command window

Error getting HTTP config

here is my conf. file. I have used **** to redact user info.

Telegraf Configuration

Telegraf is entirely plugin driven. All metrics are gathered from the

declared inputs, and sent to the declared outputs.

Plugins must be declared in here to be active.

To deactivate a plugin, comment out the name and any variables.

Use ‘telegraf -config telegraf.conf -test’ to see what metrics a config

file would generate.

Environment variables can be used anywhere in this config file, simply surround

them with ${}. For strings the variable must be within quotes (ie, “${STR_VAR}”),

for numbers and booleans they should be plain (ie, ${INT_VAR}, ${BOOL_VAR})

Global tags can be specified here in key=“value” format.

[global_tags]

dc = “us-east-1” # will tag all metrics with dc=us-east-1

rack = “1a”

Environment variables can be used as tags, and throughout the config file

user = “$USER”

Configuration for telegraf agent

[agent]

Default data collection interval for all inputs

interval = “5s”

Rounds collection interval to ‘interval’

ie, if interval=“10s” then always collect on :00, :10, :20, etc.

round_interval = true

Telegraf will send metrics to outputs in batches of at most

metric_batch_size metrics.

This controls the size of writes that Telegraf sends to output plugins.

metric_batch_size = 1000

Maximum number of unwritten metrics per output. Increasing this value

allows for longer periods of output downtime without dropping metrics at the

cost of higher maximum memory usage.

metric_buffer_limit = 10000

Collection jitter is used to jitter the collection by a random amount.

Each plugin will sleep for a random time within jitter before collecting.

This can be used to avoid many plugins querying things like sysfs at the

same time, which can have a measurable effect on the system.

collection_jitter = “5s”

Default flushing interval for all outputs. Maximum flush_interval will be

flush_interval + flush_jitter

flush_interval = “10s”

Jitter the flush interval by a random amount. This is primarily to avoid

large write spikes for users running a large number of telegraf instances.

ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s

flush_jitter = “5s”

By default or when set to “0s”, precision will be set to the same

timestamp order as the collection interval, with the maximum being 1s.

ie, when interval = “10s”, precision will be “1s”

when interval = “250ms”, precision will be “1ms”

Precision will NOT be used for service inputs. It is up to each individual

service input to set the timestamp at the appropriate precision.

Valid time units are “ns”, “us” (or “µs”), “ms”, “s”.

precision = “”

Override default hostname, if empty use os.Hostname()

hostname = “”

If set to true, do no set the “host” tag in the telegraf agent.

omit_hostname = false

debug = true

quiet = false

###############################################################################

OUTPUT PLUGINS

###############################################################################

Configuration for sending metrics to InfluxDB 2.0

[[outputs.influxdb_v2]]
alias = “thing_network_stats_bucket”
namepass = [“thing_network”]

The URLs of the InfluxDB cluster nodes.

Multiple URLs can be specified for a single cluster, only ONE of the

urls will be written to each interval.

ex: urls = [“https://us-west-2-1.aws.cloud2.influxdata.com”]

urls = [“https://ap-southeast-2-1.aws.cloud2.influxdata.com”]

Token for authentication.

token = “wHchm45k5bnp_8EpOJPKCwWW****xN8cIg9vVnERnjP7YrNnZ7e0vsA==”

Organization is the name of the organization you wish to write to.

organization = “**@*.com”

Destination bucket to write into.

bucket = “${INFLUX_BUCKET}”

###############################################################################

INPUT PLUGINS

###############################################################################
#THING NETWORK META DATA#
[[inputs.mqtt_consumer]]
alias = “thing_network_consumer”
name_override = “thing_network”
servers = [“tcp://au1.cloud.thethings.network:1883”]
topics = ["#"]
max_undelivered_messages = 1

username = "****@ttn"
password = "NNSXS.TMZJHKDKM7H5YN44NIIW343****AVCM6CKHLJX62Q3PRX55FI2KPPE6RY2OQ" 
data_format = "json_v2"

[[inputs.mqtt_consumer.json_v2]]
[[inputs.mqtt_consumer.json_v2.tag]]
path = “@this.end_device_ids.device_id

[[inputs.mqtt_consumer.json_v2.object]]
path = “end_device_ids”
disable_prepend_keys = true

[[inputs.mqtt_consumer.json_v2.object]]
path = “uplink_message”
disable_prepend_keys = true
excluded_keys = [“time”, “timestamp”]

[[inputs.mqtt_consumer.json_v2.object]]
path = “uplink_message.rx_metadata”
disable_prepend_keys = true
excluded_keys = [“time”, “timestamp”]

Hello @uptones,
Can you please include more of the logs?
You might want to check out

By the amazing @Jay_Clifford–ps have you encountered this before?

Hi @uptones,
Welcome to the community and great to see you are using ttn. I am also a massive fan!

I agree with @Anaisdg, would be great to see some more logs to understand the issue you are facing. It sounds like an invalid token/bucket mismatch.

1 Like

Hi Anais and Jay, thanks for getting back to me.

Where do i find these logs you speak of? Sorry im very new to this!
I have multiple applications waiting however so i am very eager to understand how this all works.
Perhaps you could answer some of my other questions and they will help with my overall understanding.

What is the standard process for running a service with telegraf into influx using windows 10?
Do this, then do this, then do this… etc

Should i use CMD or Powershell?

Where is a list of commands used to run telegraf and what they do? For example I found this:
[> telegraf.exe --service start] but how do i stop? can i stop? will it keep running in the background if i close CMD/powershell?

Can i have multiple conf. files in my telegraf folder or do i need to only just have the one being used?

Why is there not more detailed information about what needs to be changed in the conf. files?

Thanks again, i appreciate any help you can offer. I will post the logs if you tell me where i can find them.

Hello @uptones,
The same place you got your first error
Error getting HTTP config
We’re just looking for all of the logs.

Hi @uptones,
So that looks to be an unauthorized access error. This looks like you don’t have permission to access the Telegraf config from your InfluxDB Cloud account. Please make sure you use the token generated by InfluxDB when using the wizard for creation (see screenshot). This token provides the necessary permissions to allow Telegraf to access your InfluxDB account. Make sure to add the token to a windows environment variable. export will not work within Windows.

You can find quite a bit of documentation here:

Your other option is to create the configs locally ( which I recommend). You can find some best practises here: Telegraf Best Practices: Config Recommendations and Performance Monitoring | InfluxData

I also recommend taking our Telegraf course on InfluxDB University to get you started.