]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
replace dots in hostname by underscores for carbon reporting, and document this.
authorbert hubert <bert.hubert@netherlabs.nl>
Thu, 25 Dec 2014 19:47:01 +0000 (20:47 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Thu, 25 Dec 2014 19:47:01 +0000 (20:47 +0100)
pdns/auth-carbon.cc
pdns/docs/markdown/common/logging.md
pdns/docs/markdown/recursor/settings.md
pdns/rec-carbon.cc

index a1811fbaaa66f2abd3e6898e89025acc35a8928f..5b87f04d0a99862f098f5dfe2cd9ec885247e284 100644 (file)
@@ -39,6 +39,7 @@ try
        char *p = strchr(tmp, '.');
        if(p) *p=0;
        hostname=tmp;
+       boost::replace_all(hostname, ".", "_");
       }
       BOOST_FOREACH(const string& entry, entries) {
        str<<"pdns."<<hostname<<".auth."<<entry<<' '<<S.read(entry)<<' '<<now<<"\r\n";
index 4a12897aeb0ba531466a2ddaf1ac138805270335..a627bfb2f55a92d98c3b1208c87b0bba07c879c8 100644 (file)
@@ -129,8 +129,19 @@ LegendI[recursing]: recursing-answers
 ## Sending to Carbon/Graphite/Metronome
 For carbon/graphite/metronome, we use the following namespace. Everything starts with 'pdns.', which is then followed by the local hostname. Thirdly, we add either 'auth' or 'recursor' to siginify the daemon generating the metrics. This is then rounded off with the actual name of the metric. As an example: 'pdns.ns1.recursor.questions'.
 
+**Warning**: If your hostname includes dots, beyond 3.6.2 they will be
+replaced by underscores so as not to confuse the namespace. In 3.6.2 and earlier,
+any dots will remain unchanged. See below for how to override the hostname.
+
 Care has been taken to make the sending of statistics as unobtrusive as possible, the daemons will not be hindered by an unreachable carbon server, timeouts or connection refused situations.
 
 To benefit from our carbon/graphite support, either install Graphite, or use our own lightweight statistics daemon, Metronome, currently available on [GitHub](https://github.com/ahupowerdns/metronome/).
 
-Secondly, set [`carbon-server`](../authoritative/settings.md#carbon-server), possibly [`carbon-interval`](../authoritative/settings.md#carbon-interval) and possibly [`carbon-ourname`](../authoritative/settings.md#carbon-ourname) in the configuration.
+Secondly, set [`carbon-server`](../authoritative/settings.md#carbon-server),
+possibly [`carbon-interval`](../authoritative/settings.md#carbon-interval)
+and possibly [`carbon-ourname`](../authoritative/settings.md#carbon-ourname)
+in the configuration.
+
+**Warning**: If you include dots in `carbon-ourname`, they will not be replaced by underscores, 
+since PowerDNS assumes you know what you are doing if you override your hostname.
+
index ab5ba78b907b512dbe969a5626c151e811afd4b8..6cd97707dbe6205224094cb2ff74eb6b5133a428 100644 (file)
@@ -20,7 +20,11 @@ Authoritative zones can transmit a TTL value that is lower than that specified i
 Comma separated list of 'zonename=filename' pairs. Zones read from these files (in BIND format) are served authoritatively. Example: `auth-zones=example.org=/var/zones/example.org, powerdns.com=/var/zones/powerdns.com`. Available since version 3.1.
 
 ## `carbon-ourname`
-If sending carbon updates, if set, this will override our hostname. See ["PowerDNS Metrics"](../common/logging.md#sending-to-carbongraphitemetronome). Available beyond 3.5.3.
+If sending carbon updates, if set, this will override our hostname. Be
+careful not to include any dots in this setting, unless you know what you
+are doing.  See ["PowerDNS Metrics"](../common/logging.md#sending-to-carbongraphitemetronome). 
+Available beyond 3.5.3.
+
 
 ## `carbon-server=...`
 If set to an IP or IPv6 address, will send all available metrics to this server via the carbon protocol, which is used by graphite and metronome. See ["PowerDNS Metrics"](../common/logging.md#sending-to-carbongraphitemetronome). Available beyond 3.5.3.
index 1029e20113c75f614f3df4c2a8b01d2521b90c4f..6b17540ba3999525c89924ff1303c220412bef79 100644 (file)
@@ -42,6 +42,7 @@ try
     if(p) *p=0;
 
     hostname=tmp;
+    boost::replace_all(hostname, ".", "_");    
   }
   BOOST_FOREACH(const all_t::value_type& val, all) {
     str<<"pdns."<<hostname<<".recursor."<<val.first<<' '<<val.second<<' '<<now<<"\r\n";