Skip to content

Commit

Permalink
SE-67: Add ignore-load option
Browse files Browse the repository at this point in the history
https://jira.percona.com/browse/SE-67

Add `ignore-load` option, which disables any checks of threshold values
  • Loading branch information
pooknull committed Feb 2, 2022
1 parent 79532bf commit 301a403
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Here are main commands/flags:
| any | dump-qan | Process QAN metrics | - |
| export | start-ts | Start date-time to limit timeframe (in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format) | `2006-01-02T15:04:05Z` (please note that you can't use offset for UTC time)<br>`2006-01-02T15:04:05-07:00` |
| export | end-ts | End date-time to limit timeframe (in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format) | `2006-01-02T15:04:05Z` (please note that you can't use offset for UTC time)<br>`2006-01-02T15:04:05-07:00` |
| export | ignore-load | Disable checking for load values | - |
| export | max-load | Max value of a metric to postpone export | `CPU=50,RAM=50` |
| export | critical-load | Max value of a metric to stop export | `CPU=70,RAM=70` |
| export | stdout | Redirect output to STDOUT | - |
Expand Down
14 changes: 9 additions & 5 deletions cmd/transferer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ func main() {
"5 minutes by default, example '45s', '5m', '1h'").Default("5m").Duration()
chunkRows = exportCmd.Flag("chunk-rows", "Amount of rows to fit into a single chunk (qan metrics)").Default("1000").Int()

maxLoad = exportCmd.Flag("max-load", "Max load threshold values").
Default(fmt.Sprintf("%v=50,%v=50", transferer.ThresholdCPU, transferer.ThresholdRAM)).String()
ignoreLoad = exportCmd.Flag("ignore-load", "Disable checking for load threshold values").Bool()
maxLoad = exportCmd.Flag("max-load", "Max load threshold values").
Default(fmt.Sprintf("%v=50,%v=50", transferer.ThresholdCPU, transferer.ThresholdRAM)).String()
criticalLoad = exportCmd.Flag("critical-load", "Critical load threshold values").
Default(fmt.Sprintf("%v=70,%v=70", transferer.ThresholdCPU, transferer.ThresholdRAM)).String()

Expand Down Expand Up @@ -213,9 +214,12 @@ func main() {
log.Fatal().Msgf("Failed to generate chunk pool: %v", err)
}

thresholds, err := transferer.ParseThresholdList(*maxLoad, *criticalLoad)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse max/critical load args")
var thresholds []transferer.Threshold
if !*ignoreLoad {
thresholds, err = transferer.ParseThresholdList(*maxLoad, *criticalLoad)
if err != nil {
log.Fatal().Err(err).Msgf("Failed to parse max/critical load args")
}
}

lc := transferer.NewLoadChecker(ctx, httpC, pmmConfig.VictoriaMetricsURL, thresholds)
Expand Down

0 comments on commit 301a403

Please sign in to comment.