avojak / pihole-influxdb-monitor

Export Pi-hole statistics to InfluxDB 2.x
MIT License
24 stars 6 forks source link

Data not exported to InfluxDB #3

Closed esolitos closed 1 year ago

esolitos commented 1 year ago

Hi and thanks for this small piece of software, really appreciated.

I have given it a quick test however I don't see the data exported to InfluxDB. I am not really sure which part is not working, but I don't see any errors in the logs at the least:

image

I have double checked the configuration and it seem correct from what I can see. 🤔 I am running the container using ansible with this setup:

- docker_container:
    image: avojak/pihole-influxdb
    name: pihole-influxdb
    env:
      PIHOLE_ALIAS: "pihole"
      PIHOLE_ADDRESS: "http://{{ pihole_net_ip }}"
      PIHOLE_TOKEN: "MySuperS3creTtØK3n"
      INFLUXDB_ADDRESS: "http://{{ influxdb_net_ip }}:8086"
      INFLUXDB_ORG: "h...."
      INFLUXDB_TOKEN: "4nøth3rT0kenH3re=="
      INFLUXDB_BUCKET: "pihole"
avojak commented 1 year ago

Hey, thank you for your interest in the project! Could you try running the container with the DEBUG environment variable? Should be able to just add DEBUG: true to your Ansible task.

esolitos commented 1 year ago

Nice, I was looking for some extra logging, but wasn't mentioned in the docs, I should have looked up the code. :D

That said, from what I can see in the logs, it is only fetching the data from pihole and never sending it to InfluxDB?

Here is a small extract, but it looks all like this. image

avojak commented 1 year ago

Oh wow, yea I completely blew it on error handling for the write to InfluxDB... it'll just silently fail 🤦🏼‍♂️

Let me add some more logging and get an update pushed out. Will try to get to it later tonight.

avojak commented 1 year ago

I've published version 1.0.2 that adds better error handling and logging for when writes to InfluxDB fail. If you could pull the latest image and let me know what it logs out that'd be very helpful!

esolitos commented 1 year ago

HeHe, that actually helped figuring out the problem: [ERROR] Error writing data to InfluxDB: (<urllib3.connection.HTTPConnection object at 0x7f99a3b266d0>, 'Connection to 1.*.*.243 timed out. (connect timeout=10.0)')

Now it is on me to figure out the problem. Thanks! :)

esolitos commented 1 year ago

Just FYI, it works: [pihole] Wrote to InfluxDB successfully in 79ms :) Thanks again.

avojak commented 1 year ago

Woohoo! Glad it's all working now! 😄