Merge pull request #891 from pi-hole/bugfix/chronometer-domain-count
Bugfix/chronometer domain count
This commit is contained in:
commit
8c08e9e473
|
@ -17,15 +17,15 @@ gravity="/etc/pihole/gravity.list"
|
||||||
|
|
||||||
today=$(date "+%b %e")
|
today=$(date "+%b %e")
|
||||||
|
|
||||||
|
. /etc/pihole/setupVars.conf
|
||||||
|
|
||||||
CalcBlockedDomains() {
|
CalcBlockedDomains() {
|
||||||
CheckIPv6
|
|
||||||
if [ -e "${gravity}" ]; then
|
if [ -e "${gravity}" ]; then
|
||||||
#Are we IPV6 or IPV4?
|
# if BOTH IPV4 and IPV6 are in use, then we need to divide total domains by 2.
|
||||||
if [[ -n ${piholeIPv6} ]]; then
|
if [[ -n "${IPV4_ADDRESS}" && -n "${IPV6_ADDRESS}" ]]; then
|
||||||
#We are IPV6
|
|
||||||
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1/2}')
|
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1/2}')
|
||||||
else
|
else
|
||||||
#We are IPV4
|
# only one is set.
|
||||||
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1}')
|
blockedDomainsTotal=$(wc -l /etc/pihole/gravity.list | awk '{print $1}')
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -61,14 +61,6 @@ CalcPercentBlockedToday() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckIPv6() {
|
|
||||||
piholeIPv6file="/etc/pihole/.useIPv6"
|
|
||||||
if [[ -f ${piholeIPv6file} ]];then
|
|
||||||
# If the file exists, then the user previously chose to use IPv6 in the automated installer
|
|
||||||
piholeIPv6=$(ip -6 route get 2001:4860:4860::8888 | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "src") print $(i+1) }')
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
outputJSON() {
|
outputJSON() {
|
||||||
CalcQueriesToday
|
CalcQueriesToday
|
||||||
CalcblockedToday
|
CalcblockedToday
|
||||||
|
@ -111,8 +103,6 @@ normalChrono() {
|
||||||
CalcBlockedDomains
|
CalcBlockedDomains
|
||||||
|
|
||||||
echo "Blocking: ${blockedDomainsTotal}"
|
echo "Blocking: ${blockedDomainsTotal}"
|
||||||
#below commented line does not add up to todaysQueryCount
|
|
||||||
#echo "Queries: $todaysQueryCountV4 / $todaysQueryCountV6"
|
|
||||||
echo "Queries: ${queriesToday}" #same total calculation as dashboard
|
echo "Queries: ${queriesToday}" #same total calculation as dashboard
|
||||||
echo "Pi-holed: ${blockedToday} (${percentBlockedToday}%)"
|
echo "Pi-holed: ${blockedToday} (${percentBlockedToday}%)"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue