Get Telegraf to send to multiple InfluxDB hosts

telegraf

#1

I totally get that I can use Enterprise Influx to solve this issue and understand if that is the only way to get what I want out of the box.

I have two servers that I want to use as influxdb host and I want my servers which are running telegraf daemons to post to both servers. I know that if I setup urls = [“server1”,“server2”] in [[outputs.influxdb]] I get round robin sending not duplicate sending.

Is there anyway short of placing a multiplexer in the path of telegraf to get a single telegraf daemon to send to multiple influx servers.


#2

Yes, you can define multiple outputs:

[[outputs.influxdb]]
  urls = ["http://server1:8086"]
  # ... other options ...

[[outputs.influxdb]]
  urls = ["http://server2:8086"]
  # ... other options ...

#3

This works great - Thanks very much for the response!


#4

Hello Mr.Daniel
I try as you said.
But I can’t start Telegraf.

I try:

[[outputs.influxdb]]
  urls = ["http://server1:8086", "http://server2:8086"]

But Telegraf send metrics to server1 during period. Then Telegraf send metrics to server2 during period. And repeat again.

Please help me to fix it.
Thanks.


#5

Just update your config to use the pattern shown in my comment above, with two independent influxdb outputs.


#6

you need 2 separate output.influxdb definitions that each specify a different host. Not one output.influxdb that specifies 2 hosts.


#7

@daniel
@aspitzer
I try as you said.
But I can’t start Telegraf.


#8

Hi , why can’t you start Telegraf ? Does it give an error ?


#9

Hi
I can’t start telegraf. This is log debug.

systemd[1]: telegraf.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: telegraf.service: Unit entered failed state.
systemd[1]: telegraf.service: Failed with result 'exit-code'.
systemd[1]: telegraf.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.
systemd[1]: telegraf.service: Start request repeated too quickly.
systemd[1]: Failed to start The plugin-driven server agent for reporting metrics into InfluxDB.

Then, I comment and use only 1 output.influxdb. I started it success.


#10

Thanks , can you give the
[[ outputs.influxdb]]
Sections of your configfile?
Is there any logging in the Telegraf logfile ?
Example : /var/log/telegraf/telegraf.log

Can you try to start Telegraf without using systemctl ?
Best regards


#11

Thank you very much ^^
I try do it and success ^^