-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
38 lines (30 loc) · 772 Bytes
/
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
package main
import (
"fmt"
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func init() {
prometheus.MustRegister(newSolarCollector())
}
type config struct {
listen string
port string
}
func newConfig() config {
c := config{}
c.port = "6969"
c.listen = "0.0.0.0"
return c
}
func main() {
var conf = newConfig()
log.Println("Starting epsolar_exporter")
log.Println("Listening on 0.0.0.0:6969")
log.Println(fmt.Sprintf("Listening on %s:%s", conf.listen, conf.port))
http.Handle("/metrics", promhttp.Handler())
//http.ListenAndServe(fmt.Sprintf("%s:%s", conf.listen, conf.port), nil)
log.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%s", conf.listen, conf.port), nil))
}