-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
26 lines (22 loc) · 696 Bytes
/
main.go
File metadata and controls
26 lines (22 loc) · 696 Bytes
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
package main
import (
"flag"
"net/http"
log "github.com/Sirupsen/logrus"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
portptr := flag.String("port", "8080", "Provide the port to listen on")
flag.Parse()
port := ":" + *portptr
//Create a new instance of the foocollector and
//register it with the prometheus client.
col := newLxdCollector()
prometheus.MustRegister(col)
//This section will start the HTTP server and expose
//any metrics on the /metrics endpoint.
http.Handle("/metrics", promhttp.Handler())
log.Info("Beginning to serve on port ", port)
log.Fatal(http.ListenAndServe(port, nil))
}