mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-28 23:19:46 -08:00
25ea90369c
Last login is disabled by default as it's broken on ubuntu 12.04 Interrupts is disabled by default as it's very granular and we'll have total interrupts from /proc/stat Allow ignoring devices from diskstats, ignore ram and loop devices by default. Use glog for logging.
44 lines
934 B
Go
44 lines
934 B
Go
// +build !noattributes
|
|
|
|
package collector
|
|
|
|
import (
|
|
"github.com/golang/glog"
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
)
|
|
|
|
var (
|
|
attributes = prometheus.NewGauge()
|
|
)
|
|
|
|
type attributesCollector struct {
|
|
registry prometheus.Registry
|
|
config Config
|
|
}
|
|
|
|
func init() {
|
|
Factories["attributes"] = NewAttributesCollector
|
|
}
|
|
|
|
// Takes a config struct and prometheus registry and returns a new Collector exposing
|
|
// labels from the config.
|
|
func NewAttributesCollector(config Config, registry prometheus.Registry) (Collector, error) {
|
|
c := attributesCollector{
|
|
config: config,
|
|
registry: registry,
|
|
}
|
|
registry.Register(
|
|
"node_attributes",
|
|
"node_exporter attributes",
|
|
prometheus.NilLabels,
|
|
attributes,
|
|
)
|
|
return &c, nil
|
|
}
|
|
|
|
func (c *attributesCollector) Update() (updates int, err error) {
|
|
glog.V(1).Info("Set node_attributes{%v}: 1", c.config.Attributes)
|
|
attributes.Set(c.config.Attributes, 1)
|
|
return updates, err
|
|
}
|