From 71f468648dbbf27c4d376a5482d4ef6d53a17e92 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Sat, 27 Feb 2016 14:01:31 +0100 Subject: [PATCH] expand 'carbon-server' to also support multiple , separated servers for recursor. Open question: rename to carbon-servers? --- pdns/rec-carbon.cc | 57 ++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/pdns/rec-carbon.cc b/pdns/rec-carbon.cc index fbc776dbe4..7da9a788ee 100644 --- a/pdns/rec-carbon.cc +++ b/pdns/rec-carbon.cc @@ -13,30 +13,18 @@ void doCarbonDump(void*) try { - string hostname, carbonServer; + string hostname; + vector carbonServers; { Lock l(&g_carbon_config_lock); - carbonServer=arg()["carbon-server"]; + stringtok(carbonServers, arg()["carbon-server"], ", "); hostname=arg()["carbon-ourname"]; } - if(carbonServer.empty()) + if(carbonServers.empty()) return; - RecursorControlParser rcp; // inits if needed - ComboAddress remote(carbonServer, 2003); - Socket s(remote.sin4.sin_family, SOCK_STREAM); - - s.setNonBlocking(); - s.connect(remote); // we do the connect so the attempt happens while we gather stats - - typedef map all_t; - all_t all=getAllStatsMap(); - - ostringstream str; - time_t now=time(0); - if(hostname.empty()) { char tmp[80]; memset(tmp, 0, sizeof(tmp)); @@ -47,16 +35,35 @@ try hostname=tmp; boost::replace_all(hostname, ".", "_"); } - for(const all_t::value_type& val : all) { - str<<"pdns."< all_t; + all_t all=getAllStatsMap(); + + ostringstream str; + time_t now=time(0); + + for(const all_t::value_type& val : all) { + str<<"pdns."<