Permalink
Browse files

replace dots in hostname by underscores for carbon reporting, and doc…

…ument this.
  • Loading branch information...
1 parent 73d97f7 commit 46541751ed1c3bc051d78217543d5fc76733e212 @ahupowerdns ahupowerdns committed Dec 25, 2014
Showing with 19 additions and 2 deletions.
  1. +1 −0 pdns/auth-carbon.cc
  2. +12 −1 pdns/docs/markdown/common/logging.md
  3. +5 −1 pdns/docs/markdown/recursor/settings.md
  4. +1 −0 pdns/rec-carbon.cc
View
@@ -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";
@@ -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.
+
@@ -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.
View
@@ -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";

0 comments on commit 4654175

Please sign in to comment.