diff options
-rw-r--r-- | CONTRIBUTING.md | 23 | ||||
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | collector/collector.go | 11 | ||||
-rw-r--r-- | collector/gmond.go | 1 | ||||
-rw-r--r-- | collector/megacli.go | 1 | ||||
-rw-r--r-- | collector/ntp.go | 1 |
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 | |||
23 | The Node Exporter is not a general monitoring agent. Its sole purpose is to | ||
24 | expose machine metrics, as oppose to service metrics, with the only exception | ||
25 | being the textfile collector. | ||
26 | |||
27 | The metrics should not get transformed in a way that is hardware specific and | ||
28 | would require maintaining any form of vendor based mappings or conditions. If | ||
29 | for example a proc file contains the magic number 42 as some identifier, the | ||
30 | Node Exporter should expose it as it is and not keep a mapping in code to make | ||
31 | this human readable. Instead, the textfile collector can be used to add a static | ||
32 | metric which can be joined with the metrics exposed by the exporter to get human | ||
33 | readable identifier. | ||
34 | |||
35 | A Collector may only read `/proc` or `/sys` files, use system calls or local | ||
36 | sockets to retrieve metrics. It may not require root privileges. Running | ||
37 | external commands is not allowed for performance and reliability reasons. Use a | ||
38 | dedicated exporter instead or gather the metrics via the textfile collector. | ||
39 | |||
40 | The Node Exporter tries to support the most common machine metrics. For more | ||
41 | exotic metrics, use the textfile collector or a dedicated Exporter. | ||
@@ -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 | ||
7 | Prometheus exporter for machine metrics, written in Go with pluggable metric | 7 | Prometheus exporter for hardware and OS metrics exposed by the kernel, written |
8 | collectors. | 8 | in Go with pluggable metric collectors. |
9 | 9 | ||
10 | ## Collectors | 10 | ## Collectors |
11 | 11 | ||
@@ -43,21 +43,28 @@ Name | Description | OS | |||
43 | bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux | 43 | bonding | Exposes the number of configured and active slaves of Linux bonding interfaces. | Linux |
44 | devstat | Exposes device statistics | Dragonfly, FreeBSD | 44 | devstat | Exposes device statistics | Dragonfly, FreeBSD |
45 | drbd | Exposes Distributed Replicated Block Device statistics | Linux | 45 | drbd | Exposes Distributed Replicated Block Device statistics | Linux |
46 | gmond | Exposes statistics from Ganglia. | _any_ | ||
47 | interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD | 46 | interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD |
48 | ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux | 47 | ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux |
49 | ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux | 48 | ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux |
50 | logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux | 49 | logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux |
51 | megacli | Exposes RAID statistics from MegaCLI. | Linux | 50 | meminfo\_numa | Exposes memory statistics from `/proc/meminfo_numa`. | Linux |
52 | meminfo_numa | Exposes memory statistics from `/proc/meminfo_numa`. | Linux | ||
53 | mountstats | Exposes filesystem statistics from `/proc/self/mountstats`. Exposes detailed NFS client statistics. | Linux | 51 | mountstats | Exposes filesystem statistics from `/proc/self/mountstats`. Exposes detailed NFS client statistics. | Linux |
54 | nfs | Exposes NFS client statistics from `/proc/net/rpc/nfs`. This is the same information as `nfsstat -c`. | Linux | 52 | nfs | Exposes NFS client statistics from `/proc/net/rpc/nfs`. This is the same information as `nfsstat -c`. | Linux |
55 | ntp | Exposes time drift from an NTP server. | _any_ | ||
56 | runit | Exposes service status from [runit](http://smarden.org/runit/). | _any_ | 53 | runit | Exposes service status from [runit](http://smarden.org/runit/). | _any_ |
57 | supervisord | Exposes service status from [supervisord](http://supervisord.org/). | _any_ | 54 | supervisord | Exposes service status from [supervisord](http://supervisord.org/). | _any_ |
58 | systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux | 55 | systemd | Exposes service and system status from [systemd](http://www.freedesktop.org/wiki/Software/systemd/). | Linux |
59 | tcpstat | 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 | 56 | tcpstat | 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 | |||
62 | Name | Description | OS | ||
63 | ---------|-------------|---- | ||
64 | gmond | Exposes statistics from Ganglia. | _any_ | ||
65 | megacli | Exposes RAID statistics from MegaCLI. | Linux | ||
66 | ntp | Exposes time drift from an NTP server. | _any_ | ||
67 | |||
61 | ### Textfile Collector | 68 | ### Textfile Collector |
62 | 69 | ||
63 | The textfile collector is similar to the [Pushgateway](https://github.com/prometheus/pushgateway), | 70 | The 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 | ||
17 | import ( | 17 | import ( |
18 | "github.com/prometheus/client_golang/prometheus" | 18 | "github.com/prometheus/client_golang/prometheus" |
19 | "github.com/prometheus/common/log" | ||
19 | ) | 20 | ) |
20 | 21 | ||
21 | const Namespace = "node" | 22 | const Namespace = "node" |
22 | 23 | ||
23 | var Factories = make(map[string]func() (Collector, error)) | 24 | var Factories = make(map[string]func() (Collector, error)) |
24 | 25 | ||
26 | func 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. |
26 | type Collector interface { | 31 | type 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. |
50 | func NewGmondCollector() (Collector, error) { | 50 | func 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. |
52 | func NewMegaCliCollector() (Collector, error) { | 52 | func 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. |
43 | func NewNtpCollector() (Collector, error) { | 43 | func 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 | } |