sys-exporter/cmd/server/main.go

31 lines
654 B
Go
Raw Normal View History

2024-11-25 17:46:11 +00:00
package main
2024-12-01 16:00:52 +00:00
import (
"context"
"fmt"
"net/http"
"git.faercol.me/monitoring/sys-exporter/registry"
"github.com/prometheus/client_golang/prometheus/promhttp"
_ "git.faercol.me/monitoring/sys-exporter/collector/pacman"
_ "git.faercol.me/monitoring/sys-exporter/collector/uptime"
)
// type gatherer struct {
// reg *prometheus.Registry
// }
// func (g *gatherer) Gather() (pcm.MetricFamily, error) {
// return g.reg.
// }
2024-11-25 17:46:11 +00:00
func main() {
fmt.Println("starting server")
2024-12-01 16:00:52 +00:00
registry.R.Run(context.Background())
http.Handle("/metrics", promhttp.HandlerFor(registry.R.PromRegistry(), promhttp.HandlerOpts{}))
http.ListenAndServe(":2112", nil)
2024-11-25 17:46:11 +00:00
}