Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type error #65

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ 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
--vault.addr="https://vault.com"
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.
Expand Down Expand Up @@ -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 |
Expand Down
24 changes: 20 additions & 4 deletions cmd/fishymetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"os"
"os/signal"
"regexp"
"strconv"
"strings"
"sync"
"syscall"
Expand Down Expand Up @@ -195,7 +196,7 @@

_, 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
Expand All @@ -215,15 +216,30 @@
}
}

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)

Check failure on line 224 in cmd/fishymetrics/main.go

View workflow job for this annotation

GitHub Actions / build

cannot use *logFileMaxSize (variable of type string) as int value in struct literal
if err != nil {

Check failure on line 225 in cmd/fishymetrics/main.go

View workflow job for this annotation

GitHub Actions / build

cannot use *logFileMaxBackups (variable of type string) as int value in struct literal
panic(fmt.Errorf("error converting arg --log.file-max-backups to int - %s", err.Error()))

Check failure on line 226 in cmd/fishymetrics/main.go

View workflow job for this annotation

GitHub Actions / build

cannot use *logFileMaxAge (variable of type string) as int value in struct literal
}

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,
}
Expand Down
Loading