mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Add Prometheus
This commit is contained in:
parent
5aa6720dff
commit
e0717a9fdd
2 changed files with 16 additions and 0 deletions
3
main.go
3
main.go
|
|
@ -8,6 +8,7 @@ import (
|
|||
"git.icinga.com/icingadb/icingadb-main/config"
|
||||
"git.icinga.com/icingadb/icingadb-main/configobject/host"
|
||||
"git.icinga.com/icingadb/icingadb-main/configobject/sync"
|
||||
"git.icinga.com/icingadb/icingadb-main/prometheus"
|
||||
"git.icinga.com/icingadb/icingadb-main/supervisor"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
|
@ -60,6 +61,8 @@ func main() {
|
|||
})
|
||||
}()
|
||||
|
||||
go prometheus.HandleHttp("localhost:8080", super.ChErr)
|
||||
|
||||
for {
|
||||
select {
|
||||
case err := <-super.ChErr:
|
||||
|
|
|
|||
13
prometheus/prometheus.go
Normal file
13
prometheus/prometheus.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func HandleHttp(addr string, chErr chan error) {
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
log.Infof("Serving metrics at http://%s/metrics", addr)
|
||||
chErr <- http.ListenAndServe(addr, nil)
|
||||
}
|
||||
Loading…
Reference in a new issue