Remove hostname label

A host/port label is provided by prometheus
pull/2/merge
Johannes 'fish' Ziemke 12 years ago
parent cbd350a381
commit ade7272a29

@ -87,8 +87,7 @@ func (c *gmondCollector) Update() (updates int, err error) {
name := strings.Replace(strings.ToLower(metric.Name), ".", "_", -1)
var labels = map[string]string{
"hostname": host.Name,
"cluster": cluster.Name,
"cluster": cluster.Name,
}
c.setMetric(name, labels, metric)
updates++

@ -6,7 +6,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"io"
"io/ioutil"
"os"
"os/exec"
"strconv"
"strings"
@ -28,11 +27,6 @@ type nativeCollector struct {
// Takes a config struct and prometheus registry and returns a new Collector exposing
// load, seconds since last login and a list of tags as specified by config.
func NewNativeCollector(config config, registry prometheus.Registry) (collector nativeCollector, err error) {
hostname, err := os.Hostname()
if err != nil {
return nativeCollector{}, fmt.Errorf("Couldn't get hostname: %s", err)
}
collector = nativeCollector{
name: "native_collector",
config: config,
@ -44,21 +38,21 @@ func NewNativeCollector(config config, registry prometheus.Registry) (collector
registry.Register(
"node_load",
"node_exporter: system load.",
map[string]string{"hostname": hostname},
prometheus.NilLabels,
collector.loadAvg,
)
registry.Register(
"node_last_login_seconds",
"node_exporter: seconds since last login.",
map[string]string{"hostname": hostname},
prometheus.NilLabels,
collector.lastSeen,
)
registry.Register(
"node_attributes",
"node_exporter: system attributes.",
map[string]string{"hostname": hostname},
prometheus.NilLabels,
collector.attributes,
)

Loading…
Cancel
Save