Merge pull request #3001 from usev6/write_graphite_reverse_host
authorPavel Rochnyak <pavel2000@ngs.ru>
Tue, 30 Apr 2019 07:54:53 +0000 (14:54 +0700)
committerGitHub <noreply@github.com>
Tue, 30 Apr 2019 07:54:53 +0000 (14:54 +0700)
write_graphite plugin: Add option to reverse host

1  2 
src/collectd.conf.pod

diff --combined src/collectd.conf.pod
@@@ -1656,24 -1656,15 +1656,24 @@@ Defaults to B<true>
  
  =head2 Plugin C<cpufreq>
  
 -This plugin doesn't have any options. It reads
 +This plugin is available on Linux and FreeBSD only.  It doesn't have any
 +options.  On Linux it reads
  F</sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq> (for the first CPU
  installed) to get the current CPU frequency. If this file does not exist make
  sure B<cpufreqd> (L<http://cpufreqd.sourceforge.net/>) or a similar tool is
  installed and an "cpu governor" (that's a kernel module) is loaded.
  
 -If the system has the I<cpufreq-stats> kernel module loaded, this plugin reports
 -the rate of p-state (cpu frequency) transitions and the percentage of time spent
 -in each p-state.
 +On Linux, if the system has the I<cpufreq-stats> kernel module loaded, this
 +plugin reports the rate of p-state (cpu frequency) transitions and the
 +percentage of time spent in each p-state.
 +
 +On FreeBSD it does a sysctl dev.cpu.0.freq and submits this as instance 0.
 +At this time FreeBSD only has one frequency setting for all cores.
 +See the BUGS section in the FreeBSD man page for cpufreq(4) for more details.
 +
 +On FreeBSD the plugin checks the success of sysctl dev.cpu.0.freq and
 +unregisters the plugin when this fails.  A message will be logged to indicate
 +this.
  
  =head2 Plugin C<cpusleep>
  
@@@ -9594,6 -9585,7 +9594,7 @@@ Synopsis
       LogSendErrors true
       Prefix "collectd"
       UseTags false
+      ReverseHost false
     </Node>
   </Plugin>
  
@@@ -9705,6 -9697,30 +9706,30 @@@ are not used
  
  Default value: B<false>.
  
+ =item B<ReverseHost> B<false>|B<true>
+ If set to B<true>, the (dot separated) parts of the B<host> field of the
+ I<value list> will be rewritten in reverse order. The rewrite happens I<before>
+ special characters are replaced with the B<EscapeCharacter>.
+ This option might be convenient if the metrics are presented with Graphite in a
+ DNS like tree structure (probably without replacing dots in hostnames).
+ Example:
+  Hostname "node3.cluster1.example.com"
+  LoadPlugin "cpu"
+  LoadPlugin "write_graphite"
+  <Plugin "write_graphite">
+   <Node "graphite.example.com">
+    EscapeCharacter "."
+    ReverseHost true
+   </Node>
+  </Plugin>
+  result on the wire: com.example.cluster1.node3.cpu-0.cpu-idle 99.900993 1543010932
+ Default value: B<false>.
  =back
  
  =head2 Plugin C<write_log>