aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md23
-rw-r--r--README.md19
-rw-r--r--collector/collector.go11
-rw-r--r--collector/gmond.go1
-rw-r--r--collector/megacli.go1
-rw-r--r--collector/ntp.go1
6 files changed, 44 insertions, 12 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5705f0f..139a06c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -16,3 +16,26 @@ Prometheus uses GitHub to manage reviews of pull requests.
16 and the _Formatting and style_ section of Peter Bourgon's [Go: Best 16 and the _Formatting and style_ section of Peter Bourgon's [Go: Best
17 Practices for Production 17 Practices for Production
18 Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). 18 Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
19
20
21## Collector Implementation Guidelines
22
23The Node Exporter is not a general monitoring agent. Its sole purpose is to
24expose machine metrics, as oppose to service metrics, with the only exception
25being the textfile collector.
26
27The metrics should not get transformed in a way that is hardware specific and
28would require maintaining any form of vendor based mappings or conditions. If
29for example a proc file contains the magic number 42 as some identifier, the
30Node Exporter should expose it as it is and not keep a mapping in code to make
31this human readable. Instead, the textfile collector can be used to add a static
32metric which can be joined with the metrics exposed by the exporter to get human
33readable identifier.
34
35A Collector may only read `/proc` or `/sys` files, use system calls or local
36sockets to retrieve metrics. It may not require root privileges. Running
37external commands is not allowed for performance and reliability reasons. Use a
38dedicated exporter instead or gather the metrics via the textfile collector.
39
40The Node Exporter tries to support the most common machine metrics. For more
41exotic metrics, use the textfile collector or a dedicated Exporter.
diff --git a/README.md b/README.md
index ee806e1..25225be 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,8 @@
4[![Docker Repository on Quay](https://quay.io/repository/prometheus/node-exporter/status)][quay] 4[![Docker Repository on Quay](https://quay.io/repository/prometheus/node-exporter/status)][quay]
5[![Docker Pulls](https://img.shields.io/docker/pulls/prom/node-exporter.svg?maxAge=604800)][hub] 5[![Docker Pulls](https://img.shields.io/docker/pulls/prom/node-exporter.svg?maxAge=604800)][hub]
6 6
7Prometheus exporter for machine metrics, written in Go with pluggable metric 7Prometheus exporter for hardware and OS metrics exposed by the kernel, written
8collectors. 8in Go with pluggable metric collectors.
9 9
10## Collectors 10## Collectors
11 11
@@ -43,21 +43,28 @@ Name | Description | OS
43bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux 43bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux
44devstat | Exposes device statistics | Dragonfly, FreeBSD 44devstat | Exposes device statistics | Dragonfly, FreeBSD
45drbd | Exposes Distributed Replicated Block Device statistics | Linux 45drbd | Exposes Distributed Replicated Block Device statistics | Linux
46gmond | Exposes statistics from Ganglia. | _any_
47interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD 46interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD
48ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux 47ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux
49ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux 48ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux
50logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux 49logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux
51megacli | Exposes RAID statistics from MegaCLI. | Linux 50meminfo\_numa | Exposes memory statistics from `/proc/meminfo_numa`. | Linux
52meminfo_numa | Exposes memory statistics from `/proc/meminfo_numa`. | Linux
53mountstats | Exposes filesystem statistics from `/proc/self/mountstats`. Exposes detailed NFS client statistics. | Linux 51mountstats | Exposes filesystem statistics from `/proc/self/mountstats`. Exposes detailed NFS client statistics. | Linux
54nfs | Exposes NFS client statistics from `/proc/net/rpc/nfs`. This is the same information as `nfsstat -c`. | Linux 52nfs | Exposes NFS client statistics from `/proc/net/rpc/nfs`. This is the same information as `nfsstat -c`. | Linux
55ntp | Exposes time drift from an NTP server. | _any_
56runit | Exposes service status from [runit](http://smarden.org/runit/). | _any_ 53runit | Exposes service status from [runit](http://smarden.org/runit/). | _any_
57supervisord | Exposes service status from [supervisord](http://supervisord.org/). | _any_ 54supervisord | Exposes service status from [supervisord](http://supervisord.org/). | _any_
58systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux 55systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux
59tcpstat | Exposes TCP connection status information from `/proc/net/tcp` and `/proc/net/tcp6`. (Warning: the current version has potential performance issues in high load situations.) | Linux 56tcpstat | Exposes TCP connection status information from `/proc/net/tcp` and `/proc/net/tcp6`. (Warning: the current version has potential performance issues in high load situations.) | Linux
60 57
58### Deprecated
59
60*These collectors will be (re)moved in the future.*
61
62Name | Description | OS
63---------|-------------|----
64gmond | Exposes statistics from Ganglia. | _any_
65megacli | Exposes RAID statistics from MegaCLI. | Linux
66ntp | Exposes time drift from an NTP server. | _any_
67
61### Textfile Collector 68### Textfile Collector
62 69
63The textfile collector is similar to the [Pushgateway](https://github.com/prometheus/pushgateway), 70The textfile collector is similar to the [Pushgateway](https://github.com/prometheus/pushgateway),
diff --git a/collector/collector.go b/collector/collector.go
index da109c9..8757f15 100644
--- a/collector/collector.go
+++ b/collector/collector.go
@@ -16,20 +16,19 @@ package collector
16 16
17import ( 17import (
18 "github.com/prometheus/client_golang/prometheus" 18 "github.com/prometheus/client_golang/prometheus"
19 "github.com/prometheus/common/log"
19) 20)
20 21
21const Namespace = "node" 22const Namespace = "node"
22 23
23var Factories = make(map[string]func() (Collector, error)) 24var Factories = make(map[string]func() (Collector, error))
24 25
26func warnDeprecated(collector string) {
27 log.Warnf("The %s collector is deprecated and will be removed in the future!", collector)
28}
29
25// Interface a collector has to implement. 30// Interface a collector has to implement.
26type Collector interface { 31type Collector interface {
27 // Get new metrics and expose them via prometheus registry. 32 // Get new metrics and expose them via prometheus registry.
28 Update(ch chan<- prometheus.Metric) (err error) 33 Update(ch chan<- prometheus.Metric) (err error)
29} 34}
30
31// TODO: Instead of periodically call Update, a Collector could be implemented
32// as a real prometheus.Collector that only gathers metrics when
33// scraped. (However, for metric gathering that takes very long, it might
34// actually be better to do them proactively before scraping to minimize scrape
35// time.)
diff --git a/collector/gmond.go b/collector/gmond.go
index 573785d..09840cd 100644
--- a/collector/gmond.go
+++ b/collector/gmond.go
@@ -48,6 +48,7 @@ var illegalCharsRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)
48 48
49// Takes a prometheus registry and returns a new Collector scraping ganglia. 49// Takes a prometheus registry and returns a new Collector scraping ganglia.
50func NewGmondCollector() (Collector, error) { 50func NewGmondCollector() (Collector, error) {
51 warnDeprecated("gmond")
51 c := gmondCollector{ 52 c := gmondCollector{
52 metrics: map[string]*prometheus.GaugeVec{}, 53 metrics: map[string]*prometheus.GaugeVec{},
53 } 54 }
diff --git a/collector/megacli.go b/collector/megacli.go
index 6ceb78a..9184e53 100644
--- a/collector/megacli.go
+++ b/collector/megacli.go
@@ -50,6 +50,7 @@ func init() {
50// Takes a prometheus registry and returns a new Collector exposing 50// Takes a prometheus registry and returns a new Collector exposing
51// RAID status through megacli. 51// RAID status through megacli.
52func NewMegaCliCollector() (Collector, error) { 52func NewMegaCliCollector() (Collector, error) {
53 warnDeprecated("megacli")
53 return &megaCliCollector{ 54 return &megaCliCollector{
54 cli: *megacliCommand, 55 cli: *megacliCommand,
55 driveTemperature: prometheus.NewGaugeVec(prometheus.GaugeOpts{ 56 driveTemperature: prometheus.NewGaugeVec(prometheus.GaugeOpts{
diff --git a/collector/ntp.go b/collector/ntp.go
index 60c9b76..ee4c9db 100644
--- a/collector/ntp.go
+++ b/collector/ntp.go
@@ -41,6 +41,7 @@ func init() {
41// Takes a prometheus registry and returns a new Collector exposing 41// Takes a prometheus registry and returns a new Collector exposing
42// the offset between ntp and the current system time. 42// the offset between ntp and the current system time.
43func NewNtpCollector() (Collector, error) { 43func NewNtpCollector() (Collector, error) {
44 warnDeprecated("ntp")
44 if *ntpServer == "" { 45 if *ntpServer == "" {
45 return nil, fmt.Errorf("no NTP server specified, see -collector.ntp.server") 46 return nil, fmt.Errorf("no NTP server specified, see -collector.ntp.server")
46 } 47 }