-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
37 lines (26 loc) · 932 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
package main
import (
"fmt"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/jedipunkz/linux-tiny-exporter/internal/collector"
)
func main() {
registry := prometheus.NewRegistry()
netCollector := collector.NewNetCollector()
registry.MustRegister(netCollector)
cpuCollector := collector.NewCPUCollector()
registry.MustRegister(cpuCollector)
diskCollector := collector.NewDiskCollector()
registry.MustRegister(diskCollector)
memCollector := collector.NewMemCollector()
registry.MustRegister(memCollector)
tempCollector := collector.NewTempCollector()
registry.MustRegister(tempCollector)
http.Handle("/metrics", promhttp.HandlerFor(registry, promhttp.HandlerOpts{}))
fmt.Println("Starting exporter on :9101")
if err := http.ListenAndServe(":9101", nil); err != nil {
fmt.Printf("Error starting exporter: %v\n", err)
}
}