benningm / docker-telegraf-netatmo

script and docker image to retrieve data from netatmo API
10 stars 8 forks source link

Editing telegraf.conf results in a crashing docker #3

Closed AlfaJackal closed 4 years ago

AlfaJackal commented 4 years ago

Managed to start the docker via:

docker run \
  --name telegraf-netatmo \
  -e 'NETATMO_CLIENT_ID=xxx' \
  -e 'NETATMO_CLIENT_SECRET=xxx' \
  -e 'NETATMO_USERNAME=mail@domain.com' \
  -e 'NETATMO_PASSWORD=1234' \
  -e 'NETATMO_DEVICE_ID=xx:xx:xx:xx:xx:xx' \
  --link influxdb \
  benningm/telegraf-netatmo:latest

Adding the volume mount results in a crash after booting the container -v /etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro \

I ssh'd into the docker file and edited /etc/telegraf/telegraf.conf with the correct ip and port - I left everything else commented out like it is:

[[outputs.influxdb]]
  urls = ["http://10.10.0.6:32784"]
  database = "telegraf"

Unfortunately it is still http://localhost:8086: 2020-01-13T21:45:40Z E! [outputs.influxdb]: when writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: getsockopt: connection refused

Also, using a telegraf.conf with only this content doesn't work - the container crashes:

[[outputs.influxdb]]
  urls = ["http://10.10.0.6:32784"]
  database = "telegraf"
  username = "telegraf"
  password = "telegraf"

[[inputs.exec]]
  commands = ["/usr/local/bin/netatmo"]
  interval = "10m"
  timeout = "15s"
  data_format = "json"
  name_suffix = "_netatmo"

What am I doing wrong? Any help is much appreciated!

benningm commented 4 years ago

Looks more than a problem between your telegraf and influxdb than an error in the netatmo script.

What do you mean by crashing?

connection refused means there is no application listening on that ip/port.

AlfaJackal commented 4 years ago

Thanks for your reply! Sure it is a problem between telegraf and influxdb, because IP and Port are different. So I changed it in my telegraf.conf as mentioned above to 'http://10.10.0.6:32784'. But as you can see in the logs, it still is 'http://localhost:8086'. It seems that my changes in '/etc/telegraf.conf' hasn’t been used.

benningm commented 4 years ago

See the telegrad documentation on how to use a custom configuration:

https://hub.docker.com/_/telegraf

The provided Dockerfile just adds the script on top of that image.