diff options
author | Tobias Schmidt <tobidt@gmail.com> | 2017-03-13 23:55:19 -0300 |
---|---|---|
committer | Tobias Schmidt <tobidt@gmail.com> | 2017-03-14 00:38:02 -0300 |
commit | dace41e3d4c3dfc3a52fa73fcba322082dcce22a (patch) | |
tree | 8ed0e1883e34a17f72df94e2e8cd05581cf009aa /node_exporter.go | |
parent | a0a0dbaad0a53ce6d98eeb34cc8519299aba5155 (diff) | |
download | prometheus_node_collector-dace41e3d4c3dfc3a52fa73fcba322082dcce22a.tar.bz2 prometheus_node_collector-dace41e3d4c3dfc3a52fa73fcba322082dcce22a.tar.xz prometheus_node_collector-dace41e3d4c3dfc3a52fa73fcba322082dcce22a.zip |
Continue scrape with duplicated metrics
Problems of a single collector, like duplicated metrics read via the
textfile collector, should not fail the collection and export of other
metrics.
Diffstat (limited to 'node_exporter.go')
-rw-r--r-- | node_exporter.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/node_exporter.go b/node_exporter.go index 1a505cf..1028ed8 100644 --- a/node_exporter.go +++ b/node_exporter.go | |||
@@ -158,10 +158,16 @@ func main() { | |||
158 | log.Infof(" - %s", n) | 158 | log.Infof(" - %s", n) |
159 | } | 159 | } |
160 | 160 | ||
161 | prometheus.MustRegister(NodeCollector{collectors: collectors}) | 161 | if err := prometheus.Register(NodeCollector{collectors: collectors}); err != nil { |
162 | log.Fatalf("Couldn't register collector: %s", err) | ||
163 | } | ||
162 | handler := promhttp.HandlerFor(prometheus.DefaultGatherer, | 164 | handler := promhttp.HandlerFor(prometheus.DefaultGatherer, |
163 | promhttp.HandlerOpts{ErrorLog: log.NewErrorLogger()}) | 165 | promhttp.HandlerOpts{ |
166 | ErrorLog: log.NewErrorLogger(), | ||
167 | ErrorHandling: promhttp.ContinueOnError, | ||
168 | }) | ||
164 | 169 | ||
170 | // TODO(ts): Remove deprecated and problematic InstrumentHandler usage. | ||
165 | http.Handle(*metricsPath, prometheus.InstrumentHandler("prometheus", handler)) | 171 | http.Handle(*metricsPath, prometheus.InstrumentHandler("prometheus", handler)) |
166 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | 172 | http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { |
167 | w.Write([]byte(`<html> | 173 | w.Write([]byte(`<html> |