edekeijzer / OctoPrint-PSUControl-Shelly

GNU Affero General Public License v3.0
10 stars 6 forks source link

(too) many requests registered by pihole #9

Closed fila612 closed 2 years ago

fila612 commented 2 years ago

Hi,

I'm not really sure who can fix this issue, but in my environment I got many many dns traffic when iÄm using this plugin. my setup is running octoprint and this plugin on a raspberry pi. I connected this plugin to my shelly plug s, which is connected to my prusa mk3s. that works pretty cool and perfect, but there is also a pihole adblocker in my network, which shown me, that the plugin every 5s sends out dns queries.

my question: is that necessary for functionality? here are some lines in the pihole log:

Dec 28 05:39:53 dnsmasq[5078]: query[AAAA] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:39:53 dnsmasq[5078]: forwarded shelly-prusa.fritz.box to 10.10.10.1 Dec 28 05:39:53 dnsmasq[5078]: query[A] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:39:53 dnsmasq[5078]: forwarded shelly-prusa.fritz.box to 10.10.10.1 Dec 28 05:39:53 dnsmasq[5078]: reply shelly-prusa.fritz.box is NODATA-IPv6 Dec 28 05:39:53 dnsmasq[5078]: reply shelly-prusa.fritz.box is 10.10.10.76 Dec 28 05:39:58 dnsmasq[5078]: query[A] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:39:58 dnsmasq[5078]: cached shelly-prusa.fritz.box is 10.10.10.76 Dec 28 05:39:58 dnsmasq[5078]: query[AAAA] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:39:58 dnsmasq[5078]: cached shelly-prusa.fritz.box is NODATA-IPv6 Dec 28 05:40:03 dnsmasq[5078]: query[AAAA] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:40:03 dnsmasq[5078]: forwarded shelly-prusa.fritz.box to 10.10.10.1 Dec 28 05:40:03 dnsmasq[5078]: query[A] shelly-prusa.fritz.box from 10.10.10.33 Dec 28 05:40:03 dnsmasq[5078]: forwarded shelly-prusa.fritz.box to 10.10.10.1 Dec 28 05:40:03 dnsmasq[5078]: reply shelly-prusa.fritz.box is NODATA-IPv6 Dec 28 05:40:03 dnsmasq[5078]: reply shelly-prusa.fritz.box is 10.10.10.76

10.10.10.33 = RaspberryPi with octoprint 10.10.10.76 = Shelly PlugS (and named in Fritz!Box as "shelly-prusa" 10.10.10.1 = Fritz!Box

in the plugin-settings i use the local dns name.

edekeijzer commented 2 years ago

PSUControl will poll every 5 seconds to get the state of the printer. I would have expected Python or the OS to respect the DNS TTL, but it appears that it's resolving the DNS name for each request. There isn't really much to do about it, this seems to be the behavior from the requests lib. As a workaround you could either connect by IP address or increase the polling interval but personally I'd just ignore the amount of DNS requests.

fila612 commented 2 years ago

Thanks for your reply, i changed the config to IP and this works for me better than the dns.