::arg().set("experimental-webserver-port", "Port of webserver to listen on") = "8082";
::arg().set("experimental-webserver-password", "Password required for accessing the webserver") = "";
::arg().set("experimental-api-config-dir", "Directory where REST API stores config and zones") = "";
+ ::arg().set("carbon-ourname", "If set, overrides our reported hostname for carbon stats")="";
::arg().set("carbon-server", "If set, send metrics in carbon (graphite) format to this server")="";
::arg().set("carbon-interval", "Number of seconds between carbon (graphite) updates")="30";
::arg().set("quiet","Suppress logging of questions and answers")="";
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));
+ hostname=tmp;
+ }
BOOST_FOREACH(const all_t::value_type& val, all) {
- str<<"pdns.recursor.localhost."<<val.first<<' '<<val.second<<' '<<now<<"\r\n";
+ str<<"pdns.recursor."<<hostname<<"."<<val.first<<' '<<val.second<<' '<<now<<"\r\n";
}
const string msg = str.str();