From a22036788a544b02074ef9072142a1efe474a369 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Thu, 10 Apr 2014 12:32:38 +0200 Subject: [PATCH] Prefix Ganglia metrics with "ganglia_". The gmond (Ganglia) exporter module exports many metrics not under our control. They should all be prefixed in a common way to make it obvious where they came from. Fixes https://github.com/prometheus/node_exporter/issues/8 --- collector/gmond_collector.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/collector/gmond_collector.go b/collector/gmond_collector.go index d9c299dc..874f0813 100644 --- a/collector/gmond_collector.go +++ b/collector/gmond_collector.go @@ -16,9 +16,10 @@ import ( ) const ( - gangliaAddress = "127.0.0.1:8649" - gangliaProto = "tcp" - gangliaTimeout = 30 * time.Second + gangliaAddress = "127.0.0.1:8649" + gangliaProto = "tcp" + gangliaTimeout = 30 * time.Second + gangliaMetricsPrefix = "ganglia_" ) type gmondCollector struct { @@ -93,7 +94,7 @@ func (c *gmondCollector) Update() (updates int, err error) { for _, host := range cluster.Hosts { for _, metric := range host.Metrics { - name := illegalCharsRE.ReplaceAllString(metric.Name, "_") + name := gangliaMetricsPrefix + illegalCharsRE.ReplaceAllString(metric.Name, "_") var labels = map[string]string{ "cluster": cluster.Name,