From: phonedph1 Date: Mon, 24 Apr 2017 17:33:04 +0000 (+0000) Subject: Adjustable statistics interval X-Git-Tag: rec-4.1.0-alpha1~125^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5271%2Fhead;p=thirdparty%2Fpdns.git Adjustable statistics interval --- diff --git a/docs/markdown/recursor/settings.md b/docs/markdown/recursor/settings.md index c251625998..159a307ca7 100644 --- a/docs/markdown/recursor/settings.md +++ b/docs/markdown/recursor/settings.md @@ -93,6 +93,14 @@ have to tick an 'RFC 2181 compliant' box. Zones read from these files (in BIND format) are served authoritatively. DNSSEC is not supported. Example: `auth-zones=example.org=/var/zones/example.org, powerdns.com=/var/zones/powerdns.com`. +## `statistics-interval` +* Integer +* Default: 1800 +* Available since: 4.1.0 + +Interval between logging statistical summary on recursor performance. +Use 0 to disable. + ## `carbon-interval` * Integer * Default: 30 diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 8db2797292..376be53581 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -155,6 +155,7 @@ static bool g_weDistributeQueries; // if true, only 1 thread listens on the inco static bool g_reusePort{false}; static bool g_useOneSocketPerThread; static bool g_gettagNeedsEDNSOptions{false}; +static time_t g_statisticsInterval; std::unordered_set g_delegationOnly; RecursorControlChannel s_rcc; // only active in thread 0 @@ -2084,7 +2085,7 @@ static void houseKeeping(void *) } if(!t_id) { - if(now.tv_sec - last_stat >= 1800) { + if(g_statisticsInterval > 0 && now.tv_sec - last_stat >= g_statisticsInterval) { doStats(); last_stat=time(0); } @@ -2832,6 +2833,8 @@ static int serviceMain(int argc, char*argv[]) g_gettagNeedsEDNSOptions = ::arg().mustDo("gettag-needs-edns-options"); + g_statisticsInterval = ::arg().asNum("statistics-interval"); + #ifdef SO_REUSEPORT g_reusePort = ::arg().mustDo("reuseport"); #endif @@ -3157,6 +3160,7 @@ int main(int argc, char **argv) ::arg().set("carbon-ourname", "If set, overrides our reported hostname for carbon stats")=""; ::arg().set("carbon-server", "If set, send metrics in carbon (graphite) format to this server IP address")=""; ::arg().set("carbon-interval", "Number of seconds between carbon (graphite) updates")="30"; + ::arg().set("statistics-interval", "Number of seconds between printing of recursor statistics, 0 to disable")="1800"; ::arg().set("quiet","Suppress logging of questions and answers")=""; ::arg().set("logging-facility","Facility to log messages as. 0 corresponds to local0")=""; ::arg().set("config-dir","Location of configuration directory (recursor.conf)")=SYSCONFDIR;