aboutsummaryrefslogtreecommitdiffstats
path: root/config/unbound
diff options
context:
space:
mode:
Diffstat (limited to 'config/unbound')
-rw-r--r--config/unbound/unbound.inc24
-rw-r--r--config/unbound/unbound.xml39
2 files changed, 58 insertions, 5 deletions
diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc
index 387212dc..873b012d 100644
--- a/config/unbound/unbound.inc
+++ b/config/unbound/unbound.inc
@@ -49,11 +49,11 @@ function unbound_initial_setup() {
// Touch needed files
@touch("/usr/local/etc/unbound/root.hints");
@touch("/usr/local/etc/unbound/root-trust-anchor");
+ @touch("{$g['varlog_path']}/unbound.log");
// Ensure files and folders belong to unbound
@chown("/usr/local/etc/unbound/root-trust-anchor", "unbound");
@chgrp("/usr/local/etc/unbound/root-trust-anchor", "wheel");
@chmod("/usr/local/etc/unbound/root-trust-anchor", 0600);
- @chown("{$g['varlog_path']}/unbound.log", "unbound");
// We do not need the sample conf or the default rc.d startup file
@unlink_if_exists("/usr/local/etc/unbound/unbound.conf.sample");
@unlink_if_exists("/usr/local/etc/rc.d/unbound");
@@ -281,6 +281,20 @@ function unbound_resync_config() {
// Domain Overrides
$domain_overrides = unbound_add_domain_overrides();
+ // Unbound Statistics
+ if($unbound_config['stats'] == "on") {
+ $stats_interval = $unbound_config['stats_interval'];
+ $cumulative_stats = $unbound_config['cumulative_stats'];
+ if ($unbound_config['extended_stats'] == "on")
+ $extended_stats = "yes";
+ else
+ $extended_stats = "no";
+ } else {
+ $stats_interval = "0";
+ $cumulative_stats = "no";
+ $extended_stats = "no";
+ }
+
$unbound_conf = <<<EOD
#########################
# Unbound configuration #
@@ -297,9 +311,9 @@ do-ip6: no
do-udp: yes
do-tcp: yes
do-daemonize: yes
-statistics-interval: 3600
-extended-statistics: yes
-statistics-cumulative: no
+statistics-interval: {$stats_interval}
+extended-statistics: {$extended_stats}
+statistics-cumulative: {$cumulative_stats}
# Interface IP(s) to bind to
{$unbound_bind_interfaces}
chroot: ""
@@ -470,4 +484,4 @@ function unbound_add_domain_overrides() {
}
}
-?>
+?> \ No newline at end of file
diff --git a/config/unbound/unbound.xml b/config/unbound/unbound.xml
index 66bf8bd3..77b7bcd8 100644
--- a/config/unbound/unbound.xml
+++ b/config/unbound/unbound.xml
@@ -118,6 +118,45 @@
<type>checkbox</type>
<default_value>on</default_value>
</field>
+ <field>
+ <fieldname>stats</fieldname>
+ <fielddescr>Enable Statistics</fielddescr>
+ <description>Unbound will log the number of queries that the resolver handles.</description>
+ <type>checkbox</type>
+ <enablefields>stats_interval,cumulative_stats,extended_stats</enablefields>
+ </field>
+ <field>
+ <fieldname>stats_interval</fieldname>
+ <fielddescr>Statistics Interval</fielddescr>
+ <description>Select the time as to when statistics will be written to the Unbound log file.</description>
+ <type>select</type>
+ <default_value>3600</default_value>
+ <options>
+ <option><name>5 minutes</name><value>300</value></option>
+ <option><name>10 minutes</name><value>600</value></option>
+ <option><name>20 minutes</name><value>1200</value></option>
+ <option><name>30 minutes</name><value>2400</value></option>
+ <option><name>1 hour</name><value>3600</value></option>
+ <option><name>2 hours</name><value>7200</value></option>
+ </options>
+ </field>
+ <field>
+ <fieldname>cumulative_stats</fieldname>
+ <fielddescr>Enable Cumulative Statistics</fielddescr>
+ <description>Once unbound is started, the statistics collected are cumulative and are not cleared after each report has been logged.</description>
+ <type>select</type>
+ <default_value>no</default_value>
+ <options>
+ <option><name>No</name><value>no</value></option>
+ <option><name>Yes</name><value>yes</value></option>
+ </options>
+ </field>
+ <field>
+ <fieldname>extended_stats</fieldname>
+ <fielddescr>Enable Extended Statistics</fielddescr>
+ <description>In addition to collecting the total number of queries also collect what type of queries are handled by the resolver.</description>
+ <type>checkbox</type>
+ </field>
</fields>
<custom_add_php_command>
</custom_add_php_command>