]> granicus.if.org Git - pdns/commitdiff
Export dnsdist Downstream servers stats via carbon.
authorRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 10 Nov 2015 14:34:06 +0000 (15:34 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Tue, 10 Nov 2015 15:21:42 +0000 (16:21 +0100)
pdns/dnsdist-carbon.cc

index 69ab9521a5903c5cd723512126da73b8bc4f343e..3a83d1f49736beef8a746221157651b25ef528f8 100644 (file)
@@ -56,6 +56,15 @@ try
          str<<(*boost::get<DNSDistStats::statfunction_t>(&e.second))(e.first);
        str<<' '<<now<<"\r\n";
       }
+      const auto states = g_dstates.getCopy();
+      for(const auto& s : states) {
+        string serverName = s->remote.toString();
+        boost::replace_all(serverName, ".", "_");
+        const string base = "dnsdist." + hostname + ".main.servers." + serverName + ".";
+        str<<base<<"queries" << ' ' << s->queries.load() << " " << now << "\r\n";
+        str<<base<<"drops" << ' ' << s->reuseds.load() << " " << now << "\r\n";
+        str<<base<<"latency" << ' ' << s->latencyUsec/1000.0 << " " << now << "\r\n";
+      }
       const string msg = str.str();
 
       int ret = waitForRWData(s.getHandle(), false, 1 , 0);