forked from Kunstmaan/jitsi-colibri-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (37 loc) · 1.06 KB
/
main.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 (
"crypto/tls"
"flag"
"github.com/kunstmaan/jitsi-colibri-exporter/collector"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
)
var (
LogLevel = flag.String("loglevel", "info", "Log level")
MetricsAddr = flag.String("metrics.addr", ":9210", "Metrics address")
MetricsPath = flag.String("metrics.path", "/metrics", "Metrics path")
ColibriUrl = flag.String("colibri.url", "http://127.0.0.1:8080/colibri/stats", "Colibiri URL")
httpClient *http.Client
)
func init() {
httpClient = &http.Client{
Transport: &http.Transport{
MaxIdleConns: 100,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
},
}
}
func main() {
flag.Parse()
lvl, _ := log.ParseLevel(*LogLevel)
log.SetLevel(lvl)
log.Info("Starting Jitsi Colibri Exporter")
coll := collector.New(httpClient, *ColibriUrl)
prometheus.MustRegister(coll)
http.Handle(*MetricsPath, promhttp.Handler())
log.Fatal(http.ListenAndServe(*MetricsAddr, nil))
}