diff --git a/src/exporter.go b/src/exporter.go index 6cc8793..b06ca2c 100644 --- a/src/exporter.go +++ b/src/exporter.go @@ -28,6 +28,21 @@ func printAppVersion() { fmt.Printf(" build date: %s\r\n commit hash: %s\r\n built by: %s\r\n", date, commit, builtBy) } +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 main() { appSettings := cfg.Parse() if appSettings.VersionMode { @@ -40,6 +55,7 @@ func main() { exporter := export.NewExporter(appSettings, version) prometheus.MustRegister(exporter) + http.HandleFunc("/", rootHtmlHandler) http.Handle(metricsPath, promhttp.Handler()) log.Printf("metrics available at '%s'", metricsPath)