-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Major overhaul of chronometer script #193
Conversation
…ing. If run with no option, then chronometer runs as normal. Fixed calculations to match those on the web dashboard.
What, me? Reference the wrong file?
echo "-------------------------------" | ||
# Uncomment to continually read the log file and display the current domain being blocked | ||
#tail -f /var/log/pihole.log | awk '/\/etc\/pihole\/gravity.list/ {if ($7 != "address" && $7 != "name" && $7 != "/etc/pihole/gravity.list") print $7; else;}' | ||
# (at your opercentBlockedTodayion) any later version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opercentBlockedTodayion? You coined a new word without even noticing! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Note to self, Find&Replace>Replace All is a bad idea.
In your comment about changing api.php, I don't think you need |
Currently api.php a JSON string like this: and this script change outputs this: Edit: Note, Numbers are different in the script output because the log file is being parsed for todays date. The current dashboard does not. |
What's the difference? |
Oh, wait, I see you're referencing my php psuedocode! |
It should be |
But other than that, valid PHP script? |
I believe so. There's a feature that I think is standard, where you don't need the <?php
echo exec("/usr/local/bin/chronometer.sh -j"); |
I was brave and tried the PHP changes myself! |
Do they work? |
Of course they work, I would not commit untested code (anymore!!) |
weirdness
Major overhaul of chronometer script
Added -j option to output stats as JSON formatted string. If run with no option, then chronometer runs as normal.
Fixed calculations to match those on the web dashboard.
Total number of domains now takes whether or not IPv6 is used into consideration.
As this will output a JSON string, this can also be consumed by
index.php
ANDapi.php
on the web dashboard.i.e Change
api.php
to simply read:(corrected)
Though I don't know anything about PHP, so someone may wish to correct that.
Similarly
index.php
can read the output of this script and parse the JSON to populate the dashboard.Plus, think of all the other crazy things you could do with the data.