Merge pull request #1750 from pi-hole/fix/chrono-ftl-dbb

Silence non-numeric domains_being_blocked output
This commit is contained in:
DL6ER 2017-10-25 18:19:53 +02:00 committed by GitHub
commit 2c33c64fae

View file

@ -302,7 +302,8 @@ get_sys_stats() {
# Determine whether to display CPU clock speed as MHz or GHz # Determine whether to display CPU clock speed as MHz or GHz
if [[ -n "$cpu_mhz" ]]; then if [[ -n "$cpu_mhz" ]]; then
[[ "$cpu_mhz" -le "999" ]] && cpu_freq="$cpu_mhz MHz" || cpu_freq="$(calcFunc "$cpu_mhz"/1000) GHz" [[ "$cpu_mhz" -le "999" ]] && cpu_freq="$cpu_mhz MHz" || cpu_freq="$(printf "%.1f" $(calcFunc "$cpu_mhz"/1000)) GHz"
[[ "${cpu_freq}" == *".0"* ]] && cpu_freq="${cpu_freq/.0/}"
fi fi
# Determine colour for temperature # Determine colour for temperature
@ -380,7 +381,7 @@ get_ftl_stats() {
local top_domain_raw local top_domain_raw
local top_client_raw local top_client_raw
domains_being_blocked=$(printf "%.0f\\n" "${domains_being_blocked_raw}") domains_being_blocked=$(printf "%.0f\\n" "${domains_being_blocked_raw}" 2> /dev/null)
dns_queries_today=$(printf "%.0f\\n" "${dns_queries_today_raw}") dns_queries_today=$(printf "%.0f\\n" "${dns_queries_today_raw}")
ads_blocked_today=$(printf "%.0f\\n" "${ads_blocked_today_raw}") ads_blocked_today=$(printf "%.0f\\n" "${ads_blocked_today_raw}")
ads_percentage_today=$(printf "%'.0f\\n" "${ads_percentage_today_raw}") ads_percentage_today=$(printf "%'.0f\\n" "${ads_percentage_today_raw}")
@ -403,9 +404,9 @@ get_ftl_stats() {
get_strings() { get_strings() {
# Expand or contract strings depending on screen size # Expand or contract strings depending on screen size
if [[ "$chrono_width" == "large" ]]; then if [[ "$chrono_width" == "large" ]]; then
phc_str=" ${COL_DARK_GRAY}Pi-hole" phc_str=" ${COL_DARK_GRAY}Core"
lte_str=" ${COL_DARK_GRAY}Admin" lte_str=" ${COL_DARK_GRAY}Web"
ftl_str=" ${COL_DARK_GRAY}FTL" ftl_str=" ${COL_DARK_GRAY}FTL"
api_str="${COL_LIGHT_RED}API Offline" api_str="${COL_LIGHT_RED}API Offline"
host_info="$sys_type" host_info="$sys_type"
@ -419,7 +420,7 @@ get_strings() {
ph_info="Blocking: $domains_being_blocked sites" ph_info="Blocking: $domains_being_blocked sites"
total_str="Total: " total_str="Total: "
else else
phc_str=" ${COL_DARK_GRAY}PH" phc_str=" ${COL_DARK_GRAY}Core"
lte_str=" ${COL_DARK_GRAY}Web" lte_str=" ${COL_DARK_GRAY}Web"
ftl_str=" ${COL_DARK_GRAY}FTL" ftl_str=" ${COL_DARK_GRAY}FTL"
api_str="${COL_LIGHT_RED}API Down" api_str="${COL_LIGHT_RED}API Down"