remove: references to db collector
Remove final references to the deprecated database metric collector. Remove counter for db connection errors. BREAKING CHANGE: Remove `-db` CLI flag.
This commit is contained in:
parent
157e065369
commit
497e2ff692
@ -9,7 +9,7 @@ Go tool to collect and export metrics on Fail2Ban
|
|||||||
4. Metrics
|
4. Metrics
|
||||||
|
|
||||||
## 1. Introduction
|
## 1. Introduction
|
||||||
The exporter can collect metrics from 2 locations: the fail2ban server socket and the fail2ban server database.
|
This exporter collects metrics from a running fail2ban instance.
|
||||||
|
|
||||||
Once the exporter is running, metrics are available at `localhost:9191/metrics`.
|
Once the exporter is running, metrics are available at `localhost:9191/metrics`.
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ In this configuration, there will be two jails - one for IPs banned from the SSH
|
|||||||
This tool exports several metrics *per jail*, meaning that it is possible to track how many IPs are being banned in each jail as well as the overall total.
|
This tool exports several metrics *per jail*, meaning that it is possible to track how many IPs are being banned in each jail as well as the overall total.
|
||||||
This can be useful to track what services are seeing more failed logins.
|
This can be useful to track what services are seeing more failed logins.
|
||||||
|
|
||||||
### 4.1. Socket-based Metrics
|
### 4.1. Fail2Ban Metrics
|
||||||
|
|
||||||
These are the metrics exported by reading data from the fail2ban server socket.
|
These are the metrics exported by reading data from the fail2ban server socket.
|
||||||
All metrics are prefixed with `f2b_`.
|
All metrics are prefixed with `f2b_`.
|
||||||
@ -141,7 +141,6 @@ All metrics are prefixed with `f2b_`.
|
|||||||
Exposed metrics:
|
Exposed metrics:
|
||||||
* `up` - Returns 1 if the fail2ban server is up and connection succeeds
|
* `up` - Returns 1 if the fail2ban server is up and connection succeeds
|
||||||
* `errors` - Number of errors since startup
|
* `errors` - Number of errors since startup
|
||||||
* `db` - Errors connecting to the database
|
|
||||||
* `socket_conn` - Errors connecting to the fail2ban socket (e.g. connection refused)
|
* `socket_conn` - Errors connecting to the fail2ban socket (e.g. connection refused)
|
||||||
* `socket_req` - Errors sending requests to the fail2ban server (e.g. invalid responses)
|
* `socket_req` - Errors sending requests to the fail2ban server (e.g. invalid responses)
|
||||||
* `jail_count` - Number of jails configured in fail2ban
|
* `jail_count` - Number of jails configured in fail2ban
|
||||||
@ -159,7 +158,6 @@ Exposed metrics:
|
|||||||
```
|
```
|
||||||
# HELP f2b_errors Number of errors found since startup
|
# HELP f2b_errors Number of errors found since startup
|
||||||
# TYPE f2b_errors counter
|
# TYPE f2b_errors counter
|
||||||
f2b_errors{type="db"} 0
|
|
||||||
f2b_errors{type="socket_conn"} 0
|
f2b_errors{type="socket_conn"} 0
|
||||||
f2b_errors{type="socket_req"} 0
|
f2b_errors{type="socket_req"} 0
|
||||||
# HELP f2b_jail_banned_current Number of IPs currently banned in this jail
|
# HELP f2b_jail_banned_current Number of IPs currently banned in this jail
|
||||||
|
@ -29,9 +29,6 @@ func Parse() *AppSettings {
|
|||||||
flag.BoolVar(&appSettings.FileCollectorEnabled, "collector.textfile", false, "enable the textfile collector")
|
flag.BoolVar(&appSettings.FileCollectorEnabled, "collector.textfile", false, "enable the textfile collector")
|
||||||
flag.StringVar(&appSettings.FileCollectorPath, "collector.textfile.directory", "", "directory to read text files with metrics from")
|
flag.StringVar(&appSettings.FileCollectorPath, "collector.textfile.directory", "", "directory to read text files with metrics from")
|
||||||
|
|
||||||
// deprecated: to be removed in next version
|
|
||||||
_ = flag.String("db", "", "path to the fail2ban sqlite database (removed)")
|
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
appSettings.validateFlags()
|
appSettings.validateFlags()
|
||||||
return appSettings
|
return appSettings
|
||||||
|
@ -11,7 +11,6 @@ type Collector struct {
|
|||||||
socketPath string
|
socketPath string
|
||||||
exporterVersion string
|
exporterVersion string
|
||||||
lastError error
|
lastError error
|
||||||
dbErrorCount int
|
|
||||||
socketConnectionErrorCount int
|
socketConnectionErrorCount int
|
||||||
socketRequestErrorCount int
|
socketRequestErrorCount int
|
||||||
}
|
}
|
||||||
@ -21,7 +20,6 @@ func NewExporter(appSettings *cfg.AppSettings, exporterVersion string) *Collecto
|
|||||||
socketPath: appSettings.Fail2BanSocketPath,
|
socketPath: appSettings.Fail2BanSocketPath,
|
||||||
exporterVersion: exporterVersion,
|
exporterVersion: exporterVersion,
|
||||||
lastError: nil,
|
lastError: nil,
|
||||||
dbErrorCount: 0,
|
|
||||||
socketConnectionErrorCount: 0,
|
socketConnectionErrorCount: 0,
|
||||||
socketRequestErrorCount: 0,
|
socketRequestErrorCount: 0,
|
||||||
}
|
}
|
||||||
|
@ -69,9 +69,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (c *Collector) collectErrorCountMetric(ch chan<- prometheus.Metric) {
|
func (c *Collector) collectErrorCountMetric(ch chan<- prometheus.Metric) {
|
||||||
ch <- prometheus.MustNewConstMetric(
|
|
||||||
metricErrorCount, prometheus.CounterValue, float64(c.dbErrorCount), "db",
|
|
||||||
)
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
metricErrorCount, prometheus.CounterValue, float64(c.socketConnectionErrorCount), "socket_conn",
|
metricErrorCount, prometheus.CounterValue, float64(c.socketConnectionErrorCount), "socket_conn",
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user