diff --git a/README.md b/README.md index 83aac47..2a83b98 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ Flags: alternative method for logging in addition to stdout --log.file-path="/var/log/fishymetrics" directory path where log files are written if log-method is file - --log.file-max-size=256 max file size in megabytes if log-method is file - --log.file-max-backups=1 max file backups before they are rotated if log-method is file - --log.file-max-age=1 max file age in days before they are rotated if log-method is file + --log.file-max-size="256" max file size in megabytes if log-method is file + --log.file-max-backups="1" max file backups before they are rotated if log-method is file + --log.file-max-age="1" max file age in days before they are rotated if log-method is file --vector.endpoint="http://0.0.0.0:4444" vector endpoint to send structured json logs to --port="9533" exporter port @@ -37,7 +37,7 @@ Flags: Vault instance address to get chassis credentials from --vault.role-id="" Vault Role ID for AppRole --vault.secret-id="" Vault Secret ID for AppRole - --collector.drives.module-exclude="" + --collector.drives.modules-exclude="" regex of drive module(s) to exclude from the scrape --credentials.profiles=CREDENTIALS.PROFILES profile(s) with all necessary parameters to obtain BMC credential from secrets backend, i.e. @@ -82,7 +82,7 @@ Since some hosts can contain many dozens of drives, this can cause a scrape to t Example: ```bash ---collector.drives.module-exclude="(?i)(FlexUtil|(SBMezz|IOEMezz)[0-9]+)" +--collector.drives.modules-exclude="(?i)(FlexUtil|(SBMezz|IOEMezz)[0-9]+)" ``` | Collector | Scope | Include Flag | Exclude Flag | diff --git a/cmd/fishymetrics/main.go b/cmd/fishymetrics/main.go index 636e37d..8db9bf0 100644 --- a/cmd/fishymetrics/main.go +++ b/cmd/fishymetrics/main.go @@ -27,6 +27,7 @@ import ( "os" "os/signal" "regexp" + "strconv" "strings" "sync" "syscall" @@ -195,7 +196,7 @@ func main() { _, err = a.Parse(os.Args[1:]) if err != nil { - panic(fmt.Errorf("Error parsing argument flags - %s", err.Error())) + panic(fmt.Errorf("error parsing argument flags - %s", err.Error())) } // populate excludes map @@ -215,15 +216,30 @@ func main() { } } + logfileMaxSize, err := strconv.Atoi(*logFileMaxSize) + if err != nil { + panic(fmt.Errorf("error converting arg --log.file-max-size to int - %s", err.Error())) + } + + logfileMaxBackups, err := strconv.Atoi(*logFileMaxBackups) + if err != nil { + panic(fmt.Errorf("error converting arg --log.file-max-backups to int - %s", err.Error())) + } + + logfileMaxAge, err := strconv.Atoi(*logFileMaxAge) + if err != nil { + panic(fmt.Errorf("error converting arg --log.file-max-age to int - %s", err.Error())) + } + // init logger config logConfig := logger.LoggerConfig{ LogLevel: *logLevel, LogMethod: *logMethod, LogFile: logger.LogFile{ Path: *logFilePath, - MaxSize: *logFileMaxSize, - MaxBackups: *logFileMaxBackups, - MaxAge: *logFileMaxAge, + MaxSize: logfileMaxSize, + MaxBackups: logfileMaxBackups, + MaxAge: logfileMaxAge, }, VectorEndpoint: *vectorEndpoint, }