> showACL()
192.0.2.0/24
> delta()
-# Wed Dec 23 2015 15:15:35 CET
+-- Wed Dec 23 2015 15:15:35 CET
setACL("192.0.2.0/24")
> addACL("127.0.0.1/8")
> showACL()
192.0.2.0/24
127.0.0.1/8
> delta()
-# Wed Dec 23 2015 15:15:35 CET
+-- Wed Dec 23 2015 15:15:35 CET
setACL("192.0.2.0/24")
-# Wed Dec 23 2015 15:15:44 CET
+-- Wed Dec 23 2015 15:15:44 CET
addACL("127.0.0.1/8")
>
```
* `grepq(Netmask|DNS Name|100ms [, n])`: shows the last n queries and responses matching the specified client address or range (Netmask), or the specified DNS Name, or slower than 100ms
* `grepq({"::1", "powerdns.com", "100ms"} [, n])`: shows the last n queries and responses matching the specified client address AND range (Netmask) AND the specified DNS Name AND slower than 100ms
* `topBandwidth(top)`: show top-`top` clients that consume the most bandwidth over length of ringbuffer
+ * `topClients(n)`: show top-`n` clients sending the most queries over length of ringbuffer
* `topQueries(20)`: shows the top-20 queries
* `topQueries(20,2)`: shows the top-20 two-level domain queries (so `topQueries(20,1)` only shows TLDs)
* `topResponses(20, 2)`: top-20 servfail responses (use ,3 for NXDOMAIN)
if any, and is responsible for cleaning the cache
* A health check thread checks the backends availability
* A control thread handles console connections
- * A carbon thread exports statistics to a carbon server if needed
+ * A carbon thread exports statistics to carbon servers if needed
* One or more webserver threads handle queries to the internal webserver
The maximum number of threads in the TCP pool is controlled by the
* `topResponses(n, kind[, labels])`: show top 'n' responses with RCODE=kind (0=NO Error, 2=ServFail, 3=ServFail), as grouped when optionally cut down to 'labels' labels
* `topSlow([top][, limit][, labels])`: show `top` queries slower than `limit` milliseconds, grouped by last `labels` labels
* `topBandwidth(top)`: show top-`top` clients that consume the most bandwidth over length of ringbuffer
+ * `topClients(n)`: show top-`n` clients sending the most queries over length of ringbuffer
* `showResponseLatency()`: show a plot of the response time latency distribution
* Logging related
* `infolog(string)`: log at level info
});
g_lua.registerFunction<void(std::shared_ptr<ServerPool>::*)(std::shared_ptr<DNSDistPacketCache>)>("setCache", [](std::shared_ptr<ServerPool> pool, std::shared_ptr<DNSDistPacketCache> cache) {
- pool->packetCache = cache;
+ if (pool) {
+ pool->packetCache = cache;
+ }
});
g_lua.registerFunction("getCache", &ServerPool::getCache);
g_lua.registerFunction<void(std::shared_ptr<ServerPool>::*)()>("unsetCache", [](std::shared_ptr<ServerPool> pool) {
- pool->packetCache = nullptr;
+ if (pool) {
+ pool->packetCache = nullptr;
+ }
});
g_lua.writeFunction("newPacketCache", [client](size_t maxEntries, boost::optional<uint32_t> maxTTL, boost::optional<uint32_t> minTTL, boost::optional<uint32_t> servFailTTL, boost::optional<uint32_t> staleTTL) {
g_lua.registerFunction("purgeExpired", &DNSDistPacketCache::purgeExpired);
g_lua.registerFunction("expunge", &DNSDistPacketCache::expunge);
g_lua.registerFunction<void(std::shared_ptr<DNSDistPacketCache>::*)(const DNSName& dname, boost::optional<uint16_t> qtype)>("expungeByName", [](std::shared_ptr<DNSDistPacketCache> cache, const DNSName& dname, boost::optional<uint16_t> qtype) {
- cache->expungeByName(dname, qtype ? *qtype : QType::ANY);
+ if (cache) {
+ cache->expungeByName(dname, qtype ? *qtype : QType::ANY);
+ }
});
g_lua.registerFunction<void(std::shared_ptr<DNSDistPacketCache>::*)()>("printStats", [](const std::shared_ptr<DNSDistPacketCache> cache) {
- g_outputBuffer="Hits: " + std::to_string(cache->getHits()) + "\n";
- g_outputBuffer+="Misses: " + std::to_string(cache->getMisses()) + "\n";
- g_outputBuffer+="Deferred inserts: " + std::to_string(cache->getDeferredInserts()) + "\n";
- g_outputBuffer+="Deferred lookups: " + std::to_string(cache->getDeferredLookups()) + "\n";
- g_outputBuffer+="Lookup Collisions: " + std::to_string(cache->getLookupCollisions()) + "\n";
- g_outputBuffer+="Insert Collisions: " + std::to_string(cache->getInsertCollisions()) + "\n";
+ if (cache) {
+ g_outputBuffer="Hits: " + std::to_string(cache->getHits()) + "\n";
+ g_outputBuffer+="Misses: " + std::to_string(cache->getMisses()) + "\n";
+ g_outputBuffer+="Deferred inserts: " + std::to_string(cache->getDeferredInserts()) + "\n";
+ g_outputBuffer+="Deferred lookups: " + std::to_string(cache->getDeferredLookups()) + "\n";
+ g_outputBuffer+="Lookup Collisions: " + std::to_string(cache->getLookupCollisions()) + "\n";
+ g_outputBuffer+="Insert Collisions: " + std::to_string(cache->getInsertCollisions()) + "\n";
+ }
});
g_lua.writeFunction("getPool", [client](const string& poolName) {