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"
|
|
|
|
|
2024-12-01 17:12:19 +00:00
|
|
|
_ "git.faercol.me/monitoring/sys-exporter/collector/loadavg"
|
|
|
|
_ "git.faercol.me/monitoring/sys-exporter/collector/meminfo"
|
2024-12-01 16:00:52 +00:00
|
|
|
_ "git.faercol.me/monitoring/sys-exporter/collector/pacman"
|
2024-12-01 17:12:19 +00:00
|
|
|
_ "git.faercol.me/monitoring/sys-exporter/collector/systemd"
|
2024-12-01 16:00:52 +00:00
|
|
|
_ "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
|
|
|
}
|