flag all fields related to db-based metrics as deprecated

This commit is contained in:
Hector 2021-08-30 16:50:07 +01:00
parent 737a86b6fd
commit 76c9dd93f4
2 changed files with 7 additions and 6 deletions

View File

@ -22,7 +22,7 @@ func Parse() *AppSettings {
appSettings := &AppSettings{}
flag.BoolVar(&appSettings.VersionMode, "version", false, "show version info and exit")
flag.IntVar(&appSettings.MetricsPort, "port", 9191, "port to use for the metrics server")
flag.StringVar(&appSettings.Fail2BanDbPath, "db", "", "path to the fail2ban sqlite database")
flag.StringVar(&appSettings.Fail2BanDbPath, "db", "", "path to the fail2ban sqlite database (deprecated)")
flag.StringVar(&appSettings.Fail2BanSocketPath, "socket", "", "path to the fail2ban server socket")
flag.Parse()

View File

@ -26,27 +26,27 @@ var (
metricUp = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "up"),
"Was the last fail2ban query successful.",
"(Deprecated) Was the last fail2ban query successful.",
nil, nil,
)
metricBannedIpsPerJail = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "banned_ips"),
"Number of banned IPs stored in the database (per jail).",
"(Deprecated) Number of banned IPs stored in the database (per jail).",
[]string{"jail"}, nil,
)
metricBadIpsPerJail = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "bad_ips"),
"Number of bad IPs stored in the database (per jail).",
"(Deprecated) Number of bad IPs stored in the database (per jail).",
[]string{"jail"}, nil,
)
metricEnabledJails = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "enabled_jails"),
"Enabled jails.",
"(Deprecated) Enabled jails.",
[]string{"jail"}, nil,
)
metricErrorCount = prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "errors"),
"Number of errors found since startup.",
"(Deprecated) Number of errors found since startup.",
[]string{"type"}, nil,
)
@ -287,6 +287,7 @@ func main() {
exporter := &Exporter{}
if appSettings.Fail2BanDbPath != "" {
log.Print("database-based metrics have been deprecated and will be removed in a future release")
exporter.db = fail2banDb.MustConnectToDb(appSettings.Fail2BanDbPath)
}
if appSettings.Fail2BanSocketPath != "" {