forked from SUSE/saptune_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
saptune_exporter.go
52 lines (43 loc) · 1.21 KB
/
saptune_exporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"net/http"
"github.com/SUSE/saptune_exporter/internal"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
)
const (
saptunePath = "/usr/sbin/saptune"
saptuneSycConf = "/etc/sysconfig/saptune"
)
func main() {
// register various collectors
solutionCollector, err := NewSolutionCollector(saptunePath)
if err != nil {
log.Warn(err)
} else {
prometheus.MustRegister(solutionCollector)
log.Info("Saptune Solution collector registered")
}
metaCollector, err := NewMetaCollector(saptuneSycConf)
if err != nil {
log.Warn(err)
} else {
prometheus.MustRegister(metaCollector)
log.Info("Saptune Meta collector registered")
}
noteCollector, err := NewNoteCollector(saptunePath)
if err != nil {
log.Warn(err)
} else {
prometheus.MustRegister(noteCollector)
log.Info("Saptune Note collector registered")
}
// disable golang specific metrics
prometheus.Unregister(prometheus.NewGoCollector())
// serve metrics
http.HandleFunc("/", internal.Landing)
http.Handle("/metrics", promhttp.Handler())
log.Infof("Serving metrics on port 9758")
log.Fatal(http.ListenAndServe(":9758", nil))
}