Add support for arbitrary RR caching

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-04-01 20:04:20 +02:00
parent 2f6a50c6f6
commit 757907a2c4
3 changed files with 15 additions and 45 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ function generateRow(topic, key, value) {
'<div class="box-header no-user-select">' +
'<h3 class="box-title">' +
key +
(value.modified ? '&nbsp;&nbsp;<i class="far fa-edit text-light-blue" title="Modified"></i>' : "") +
(value.modified
? '&nbsp;&nbsp;<i class="far fa-edit text-light-blue" title="Modified"></i>'
: "") +
(value.flags.advanced
? '&nbsp;&nbsp;<i class="fas fa-cogs text-yellow" title="Expert-level setting"></i>'
: "") +
+11 -1
View File
@@ -46,7 +46,16 @@ function updateHostInfo() {
// to the corresponding element (add percentage for DNS replies)
function setMetrics(data, prefix) {
for (const [key, val] of Object.entries(data)) {
if (typeof val === "object") {
if (prefix === "sysinfo-dns-cache-content-") {
// Append row to DNS cache table
$("#dns-cache-table").append(
"<tr><th>Valid " +
(val.name !== null ? val.name : "TYPE " + val.type) +
" records in cache:</th><td>" +
val.count +
"</td></tr>"
);
} else if (typeof val === "object") {
setMetrics(val, prefix + key + "-");
} else if (prefix === "sysinfo-dns-replies-") {
// Compute and display percentage of DNS replies in addition to the absolute value
@@ -65,6 +74,7 @@ function updateMetrics() {
})
.done(function (data) {
var metrics = data.metrics;
$("#dns-cache-table").empty();
setMetrics(metrics, "sysinfo-");
$("div[id^='sysinfo-metrics-overlay']").hide();
+1 -43
View File
@@ -202,49 +202,7 @@ require 'scripts/pi-hole/php/header_authenticated.php';
</tbody>
</table>
<table class="table table-striped table-bordered nowrap settings-level-2">
<tbody>
<tr>
<th scope="row">
Valid A records in cache:
</th>
<td id="sysinfo-dns-cache-content-a">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Valid AAAA records in cache:
</th>
<td id="sysinfo-dns-cache-content-aaaa">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Valid CNAME records in cache:
</th>
<td id="sysinfo-dns-cache-content-cname">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Valid SRV records in cache:
</th>
<td id="sysinfo-dns-cache-content-srv">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Valid DS records in cache:
</th>
<td id="sysinfo-dns-cache-content-ds">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Valid DNSKEY records in cache:
</th>
<td id="sysinfo-dns-cache-content-dnskey">&nbsp;</td>
</tr>
<tr>
<th scope="row">
Other valid records in cache:
</th>
<td id="sysinfo-dns-cache-content-other">&nbsp;</td>
</tr>
<tbody id="dns-cache-table">
</tbody>
</table>
See also our <a href="https://docs.pi-hole.net/ftldns/dns-cache/" rel="noopener" target="_blank">DNS cache documentation</a>.