From: Robin Geuze Date: Fri, 12 Aug 2016 08:19:29 +0000 (+0200) Subject: Add showTCPStats function X-Git-Tag: rec-4.0.2~34^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e65ae26065a918aed723671bb836fba4e54d7686;p=thirdparty%2Fpdns.git Add showTCPStats function --- diff --git a/pdns/dnsdist-console.cc b/pdns/dnsdist-console.cc index 4a7f05412a..d3611ff572 100644 --- a/pdns/dnsdist-console.cc +++ b/pdns/dnsdist-console.cc @@ -316,6 +316,7 @@ const std::vector g_consoleKeywords{ { "showRules", true, "", "show all defined rules" }, { "showServerPolicy", true, "", "show name of currently operational server selection policy" }, { "showServers", true, "", "output all servers" }, + { "showTCPStats", true, "", "show some statistics regarding TCP" }, { "showVersion", true, "", "show the current version" }, { "shutdown", true, "", "shut down `dnsdist`" }, { "SpoofAction", true, "{ip, ...} ", "forge a response with the specified IPv4 (for an A query) or IPv6 (for an AAAA). If you specify multiple addresses, all that match the query type (A, AAAA or ANY) will get spoofed in" }, diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index f7018c7e5c..08466221fa 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1429,6 +1429,13 @@ vector> setupLua(bool client, const std::string& confi } }); + g_lua.writeFunction("showTCPStats", [] { + setLuaNoSideEffect(); + boost::format fmt("%-10d %-10d %-10d %-10d\n"); + g_outputBuffer += (fmt % "Clients" % "MaxClients" % "Queued" % "MaxQueued").str(); + g_outputBuffer += (fmt % g_tcpclientthreads->d_numthreads % g_maxTCPClientThreads % g_tcpclientthreads->d_queued % g_maxTCPQueuedConnections).str(); + }); + g_lua.writeFunction("setCacheCleaningDelay", [](uint32_t delay) { g_cacheCleaningDelay = delay; }); g_lua.writeFunction("setECSSourcePrefixV4", [](uint16_t prefix) { g_ECSSourcePrefixV4=prefix; });