pi-hole / PADD

PADD (formerly Chronometer2) is a more expansive version of the original chronometer.sh that is included with Pi-Hole. PADD provides in-depth information about your Pi-hole.
1.36k stars 122 forks source link

PADD Docker? #148

Closed AndyVRD closed 3 years ago

AndyVRD commented 3 years ago

Hi,

Is there any solution using PADD if Pihole is running in a container? I keep getting a error...

cat: /var/run/pihole-FTL.port: No such file or directory

DL6ER commented 3 years ago

You can create the file and put 4711 into it as the port is fix.

@dschaper Now that PADD is under the Pi-hole namespace, maybe we can just include it in the official container?

AndyVRD commented 3 years ago

You can create the file and put 4711 into it as the port is fix.

@dschaper Now that PADD is under the Pi-hole namespace, maybe we can just include it in the official container?

Thanks for the reply. Changed but now get another error...

./padd.sh: line 118: ftl_port: Servname not supported for ai_socktype ./padd.sh: line 118: /dev/tcp/localhost/ftl_port: Invalid argument

GetFTLData() {

Get FTL port number

ftl_port=4711

Did we find a port for FTL?

if [[ -n "ftl_port" ]]; then

Open connection to FTL

exec 3<>"/dev/tcp/localhost/ftl_port"
DL6ER commented 3 years ago

Try maybe something like

exec 3<>"/dev/tcp/localhost/4711"

you accidentally removed a $ in front of the variable name

PromoFaux commented 3 years ago

Also if I'm not mistaken you'll need to expose port 4711 on the docker container. What does your compose file / docker run look like?

AndyVRD commented 3 years ago

Sorry i'm not that good with this so any change to explain where i can find this compose file? Changed the code like DL6ER say and now i got indeed a connection refused error.

./padd.sh: connect: Connection refused ./padd.sh: line 118: /dev/tcp/localhost/4711: Connection refused

PromoFaux commented 3 years ago

What I mean is, how did you start the docker container? I'm guessing, from context, that you ran a command like docker run...?

AndyVRD commented 3 years ago

What I mean is, how did you start the docker container? I'm guessing, from context, that you ran a command like docker run...?

I used this guide and so used portainer to install it. :)

dschaper commented 3 years ago

It won't run in a separate docker container. You have to have access to the socket in the pihole container and exposing that is not a good idea since there is no verification/validation for access.

dschaper commented 3 years ago

Now that PADD is under the Pi-hole namespace, maybe we can just include it in the official container?

Sure, we could. I don't know how useful it would be since it needs a terminal and most of the time docker is not started with an interactive terminal. I guess you could docker exec -it and then run PADD but that's a lot of tinkering.

itdojo commented 1 month ago

Example using a Pi with an attached display (pimoroni hyperpixel4 in my case). OS is Raspberry Pi OS Lite, 64-bit.

if [ "$(tty)" = "/dev/tty1" ] && [ -z "$SSH_CONNECTION" ]; then
    docker exec -it pihole /usr/local/bin/padd
fi