Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-CloudShell | Fix and simplify obtaining Pi-hole stats #4100

Merged
merged 4 commits into from
Feb 10, 2021
Merged

Conversation

MichaIng
Copy link
Owner

@MichaIng MichaIng commented Feb 10, 2021

Status: Ready

Commit list/description:

  • DietPi-CloudShell | Fix and simplify obtaining Pi-hole stats, by asking FTL via it's TCP port API directly, instead of querying any logs or database files manually. This matches the method how Pi-hole's Chronometer and PADD are doing it: https://github.com/pi-hole/pi-hole/blob/development/advanced/Scripts/chronometer.sh, https://docs.pi-hole.net/ftldns/telnet-api/
  • DietPi-CloudShell | Massively simplify uptime estimation: Instead of looping through each minute, then each hour, then each day, calculate hours and days in a single step
  • DietPi-CloudShell | When obtaining drive data hangs, do not killall df executions but be more specific by storing the PID and killing the exact process only
  • DietPi-CloudShell | Do not initialise variables with "0" when they are not aimed to be integers

+ DietPi-CloudShell | Fix and simplify obtaining Pi-hole stats, by asking FTL via it's TCP port API directly, instead of querying any logs or database files manually. This matches the method how Pi-hole's Chronometer and PADD are doing it: https://github.com/pi-hole/pi-hole/blob/development/advanced/Scripts/chronometer.sh, https://docs.pi-hole.net/ftldns/telnet-api/
+ DietPi-CloudShell | Massively simplify uptime estimation: Instead of looping through each minute, then each hour, then each day, calculate hours and days in a single step
+ DietPi-CloudShell | When obtaining drive data hangs, do not killall df executions but be more specific by storing the PID and killing the exact process only
+ DietPi-CloudShell | Do not initialise variables with "0" when they are not aimed to be integers
@MichaIng MichaIng added this to the v6.35 milestone Feb 10, 2021
@MichaIng MichaIng linked an issue Feb 10, 2021 that may be closed by this pull request
+ DietPi-CloudShell | Pi-hole scene: /dev/tcp/127.0.0.1/$port does not exist in the file system, but as possible file descriptor only, hence remove the existence check
+ DietPi-CloudShell | Pi-hole scene: The FTL API allows only one output command per time, hence get last blocked domain first, without closing the connection, then get the other stats and close the connection.
+ DietPi-CloudShell | Pi-hole scene: Fix syntax to parse one line per loop via read
+ DietPi-CloudShell | Pi-hole scene: Prevent division with zero, when no queries have been processed yet
+ DietPi-CloudShell | Pi-hole scene: FTL cannot handle a second command when the first commands output has not fully been read. Follow Chronometer/PADD in closing the connection after the first command and re-establishing it before sending the second command.
+ DietPi-CloudShell | Pi-hole scene: Show function exit code when FTL connection failed, for debugging purpose
+ DietPi-CloudShell | Pi-hole scene: Fix detection of Pi-hole install by checking for pihole-FTL command
+ DietPi-CloudShell | Show more precise error message when Pi-hole FTL connection fails
@MichaIng MichaIng merged commit 8e766d3 into dev Feb 10, 2021
@MichaIng MichaIng deleted the cloudshell branch February 10, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloudshell not show Pihole Stats
1 participant