From c8bdc58fb46a6d4f8470242d725a04cfef36181a Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 11 Feb 2023 10:50:41 +0100 Subject: [PATCH] Add DNS reply statistics to settings page Signed-off-by: DL6ER --- scripts/pi-hole/js/settings-system.js | 21 ++- settings.php | 214 ++++++++++++++++---------- 2 files changed, 156 insertions(+), 79 deletions(-) diff --git a/scripts/pi-hole/js/settings-system.js b/scripts/pi-hole/js/settings-system.js index cfe20fb9..ebc4f45e 100644 --- a/scripts/pi-hole/js/settings-system.js +++ b/scripts/pi-hole/js/settings-system.js @@ -63,7 +63,26 @@ function updateCacheInfo() { $("#sysinfo-cache-valid-ds").text(cache.valid.ds); $("#sysinfo-cache-valid-dnskey").text(cache.valid.dnskey); $("#sysinfo-cache-valid-other").text(cache.valid.other); - $("#sysinfo-cache-overlay").hide(); + + var total = + cache.optimized + cache.local + cache.auth + cache.extra.unanswered + cache.extra.forwarded; + $("#sysinfo-replies-optimized").text( + cache.optimized + " (" + ((100 * cache.optimized) / total).toFixed(1) + "%)" + ); + $("#sysinfo-replies-local").text( + cache.local + " (" + ((100 * cache.local) / total).toFixed(1) + "%)" + ); + $("#sysinfo-replies-auth").text( + cache.auth + " (" + ((100 * cache.auth) / total).toFixed(1) + "%)" + ); + $("#sysinfo-replies-extra-unanswered").text( + cache.extra.unanswered + " (" + ((100 * cache.extra.unanswered) / total).toFixed(1) + "%)" + ); + $("#sysinfo-replies-extra-forwarded").text( + cache.extra.forwarded + " (" + ((100 * cache.extra.forwarded) / total).toFixed(1) + "%)" + ); + + $("#sysinfo-dns-overlay").hide(); // Update every 10 seconds clearTimeout(cacheinfoTimer); cacheinfoTimer = setTimeout(updateCacheInfo, 10000); diff --git a/settings.php b/settings.php index d8d25032..dec66e34 100644 --- a/settings.php +++ b/settings.php @@ -134,87 +134,145 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array('sysadmin', 'dns', 'dhcp
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- DNS cache size: -  
- DNS cache insertions: -  
- DNS cache evictions: -  
- Valid A records in cache: -  
- Valid AAAA records in cache: -  
- Valid CNAME records in cache: -  
- Valid SRV records in cache: -  
- Valid DS records in cache: -  
- Valid DNSKEY records in cache: -  
- Other valid records in cache: -  
- DNS cache expiries: -  
- Immortal DNS cache entries: -  
- See also our DNS cache documentation. +
+
+

DNS cache

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ DNS cache size: +  
+ DNS cache insertions: +  
+ DNS cache evictions: +  
+ DNS cache expiries: +  
+ Immortal DNS cache entries: +  
+ Valid A records in cache: +  
+ Valid AAAA records in cache: +  
+ Valid CNAME records in cache: +  
+ Valid SRV records in cache: +  
+ Valid DS records in cache: +  
+ Valid DNSKEY records in cache: +  
+ Other valid records in cache: +  
+ See also our DNS cache documentation. +
+
+
+
+
+
+
+
+

DNS replies

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ Local replies: +  
+ Forwarded queries: +  
+ Unanswered queries: +  
+ Cache optimizer replies: +  
+ Authoritative replies: +  
+
+
+
+
-
+