From 301a4034bb5898b325ba6406350be9e39c8f571a Mon Sep 17 00:00:00 2001 From: Andrii Dema Date: Wed, 2 Feb 2022 12:43:01 +0200 Subject: [PATCH] SE-67: Add `ignore-load` option https://jira.percona.com/browse/SE-67 Add `ignore-load` option, which disables any checks of threshold values --- README.md | 1 + cmd/transferer/main.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9062a3e1..e5bcb11a 100644 --- a/README.md +++ b/README.md @@ -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)
`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)
`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 | - | diff --git a/cmd/transferer/main.go b/cmd/transferer/main.go index c70687f7..f2b5dc82 100644 --- a/cmd/transferer/main.go +++ b/cmd/transferer/main.go @@ -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() @@ -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)