support metric files with uppercase extension

This commit is contained in:
Hector 2021-10-12 21:28:19 +01:00
parent 8afaf2e92d
commit e8296a644d
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ $ fail2ban-prometheus-exporter -h
path to the fail2ban server socket
-version
show version info and exit
-collector.textfile
-collector.textfile
enable the textfile collector
-collector.textfile.directory string
directory to read text files with metrics from
@ -256,7 +256,7 @@ To enable textfile metrics:
Metrics collected from these files will be exposed directly alongside the other metrics without any additional processing.
This means that it is the responsibility of the file creator to ensure the format is correct.
By exporting textfile metrics, an extra metric is also exported with an error count for each file:
By exporting textfile metrics an extra metric is also exported with an error count for each file:
```
# HELP textfile_error Checks for errors while reading text files
@ -264,4 +264,4 @@ By exporting textfile metrics, an extra metric is also exported with an error co
textfile_error{path="file.prom"} 0
```
**NOTE:** Only files ending with `.prom` will be considered.
**NOTE:** Any file not ending with `.prom` will be ignored.

View File

@ -27,7 +27,7 @@ func (c *Collector) collectFileContents() {
for _, file := range files {
fileName := file.Name()
if !strings.HasSuffix(fileName, ".prom") {
if !strings.HasSuffix(strings.ToLower(fileName), ".prom") {
continue
}
c.fileMap[fileName] = &fileData{