package server import ( "log" "net/http" "github.com/prometheus/client_golang/prometheus/promhttp" "gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/collector/textfile" ) const ( metricsPath = "/metrics" ) func rootHtmlHandler(w http.ResponseWriter, r *http.Request) { _, err := w.Write([]byte( ` Fail2Ban Exporter

Fail2Ban Exporter

Metrics

`)) if err != nil { log.Printf("error handling root url: %v", err) w.WriteHeader(http.StatusInternalServerError) } } func metricHandler(w http.ResponseWriter, r *http.Request, collector *textfile.Collector) { promhttp.Handler().ServeHTTP(w, r) collector.WriteTextFileMetrics(w, r) }