From: Pieter Lexis Date: Wed, 18 May 2016 11:54:25 +0000 (+0200) Subject: Auth: add support for multiple carbon servers X-Git-Tag: auth-4.0.0-beta1~8^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=486ce51859099ab96473a439019b7dc3a3dd76a4;p=pdns Auth: add support for multiple carbon servers Closes #3782 Closes #2093 --- diff --git a/pdns/auth-carbon.cc b/pdns/auth-carbon.cc index c270dbc97..c721cc015 100644 --- a/pdns/auth-carbon.cc +++ b/pdns/auth-carbon.cc @@ -15,52 +15,49 @@ try { extern StatBag S; - for(int numloops=0;;++numloops) { - if(arg()["carbon-server"].empty()) { + string hostname=arg()["carbon-ourname"]; + if(hostname.empty()) { + char tmp[80]; + memset(tmp, 0, sizeof(tmp)); + gethostname(tmp, sizeof(tmp)); + char *p = strchr(tmp, '.'); + if(p) *p=0; + hostname=tmp; + boost::replace_all(hostname, ".", "_"); + } + + vector carbonServers; + stringtok(carbonServers, arg()["carbon-server"], ", "); + + for(;;) { + if(carbonServers.empty()) { sleep(1); continue; } - if(numloops) - sleep(arg().asNum("carbon-interval")); - try { - ComboAddress remote(arg()["carbon-server"], 2003); + string msg; + vector entries = S.getEntries(); + ostringstream str; + time_t now=time(0); + for(const string& entry : entries) { + str<<"pdns."< entries = S.getEntries(); - - ostringstream str; - time_t now=time(0); - string hostname=arg()["carbon-ourname"]; - if(hostname.empty()) { - char tmp[80]; - memset(tmp, 0, sizeof(tmp)); - gethostname(tmp, sizeof(tmp)); - char *p = strchr(tmp, '.'); - if(p) *p=0; - hostname=tmp; - boost::replace_all(hostname, ".", "_"); - } - for(const string& entry : entries) { - str<<"pdns."<