package main import ( "fail2ban-prometheus-exporter/cfg" "fail2ban-prometheus-exporter/export" "fmt" "log" "net/http" _ "github.com/mattn/go-sqlite3" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" ) var ( version = "dev" commit = "none" date = "unknown" builtBy = "unknown" ) func printAppVersion() { fmt.Println(version) fmt.Printf(" build date: %s\r\n commit hash: %s\r\n built by: %s\r\n", date, commit, builtBy) } func main() { appSettings := cfg.Parse() if appSettings.VersionMode { printAppVersion() } else { log.Print("starting fail2ban exporter") exporter := export.NewExporter(appSettings, version) prometheus.MustRegister(exporter) http.Handle("/metrics", promhttp.Handler()) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", appSettings.MetricsPort), nil)) } }