From 167a17908f1b4ee38b50f91f711e84e90620e231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 29 Jun 2026 17:28:38 +0200 Subject: [PATCH 1/4] WIP: file content tests --- cmd/fileContent.go | 30 ++++++++++++++++++++++++++++++ internal/files/fileContent.go | 12 ++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 cmd/fileContent.go create mode 100644 internal/files/fileContent.go diff --git a/cmd/fileContent.go b/cmd/fileContent.go new file mode 100644 index 0000000..604831a --- /dev/null +++ b/cmd/fileContent.go @@ -0,0 +1,30 @@ +package cmd + +import ( + fileContent "github.com/NETWAYS/check_system_basics/internal/files" + "github.com/NETWAYS/go-check" + "github.com/spf13/cobra" +) + +var FileContentConfig fileContent.FileContentconfig + +var fileContentCmd = &cobra.Command{ + Use: "fileContent", + Short: "Submodule to test for different properties on file content ", + Example: ``, + Run: func(_ *cobra.Command, _ []string) { + }, +} + +func init() { + rootCmd.AddCommand(fileContentCmd) + fileContentCmd.DisableFlagsInUseLine = true + + fileContentFS := fileContentCmd.Flags() + fileContentFS.StringArrayVar(&FileContentConfig.Paths, "paths", []string{}, "File paths to evaluate") + fileContentFS.StringArrayVar(&FileContentConfig.OKPatterns, "ok-pattern", []string{}, "Regex pattern in file which are OK") + fileContentFS.StringArrayVar(&FileContentConfig.WarningPatterns, "warning-pattern", []string{}, "Regex pattern in file which cause a WARNING") + fileContentFS.StringArrayVar(&FileContentConfig.Paths, "critical-pattern", []string{}, "Regex pattern in file which cause a CRITICAL") + fileContentFS.IntVar(&FileContentConfig.NotFoundStatus, "paths", check.OK, "Exit status if none of the patterns apply (OK (0), warning (1), critical (2), Uknown (3)) (default: OK)") + fileContentFS.BoolVar(&FileContentConfig.Recursive, "recursive", true, "Recursively test all files in \"paths\"") +} diff --git a/internal/files/fileContent.go b/internal/files/fileContent.go new file mode 100644 index 0000000..c26d660 --- /dev/null +++ b/internal/files/fileContent.go @@ -0,0 +1,12 @@ +package fileContent + +import () + +type FileContentconfig struct { + Paths []string + OKPatterns []string + WarningPatterns []string + CriticalPatterns []string + NotFoundStatus int + Recursive bool +} From 356ded1e07fd2d9e875ca478376b6e264b1fb120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Tue, 11 Aug 2026 14:02:02 +0200 Subject: [PATCH 2/4] Implement some functionality --- cmd/fileContent.go | 200 ++++++++++++++++++++++++++++++- internal/common/regexp/regexp.go | 68 +++++++++++ internal/common/status/status.go | 48 ++++++++ internal/files/fileContent.go | 13 +- 4 files changed, 319 insertions(+), 10 deletions(-) create mode 100644 internal/common/regexp/regexp.go create mode 100644 internal/common/status/status.go diff --git a/cmd/fileContent.go b/cmd/fileContent.go index 604831a..1d5d894 100644 --- a/cmd/fileContent.go +++ b/cmd/fileContent.go @@ -1,30 +1,220 @@ package cmd import ( + "bufio" + "fmt" + "os" + "path" + "path/filepath" + "regexp" + + // "github.com/NETWAYS/check_system_basics/internal/common/status" + + sbRegex "github.com/NETWAYS/check_system_basics/internal/common/regexp" fileContent "github.com/NETWAYS/check_system_basics/internal/files" "github.com/NETWAYS/go-check" + "github.com/NETWAYS/go-check/result" "github.com/spf13/cobra" ) var FileContentConfig fileContent.FileContentconfig +type EvalConfig struct { + OKPatterns []regexp.Regexp + WarningPatterns []regexp.Regexp + CriticalPatterns []regexp.Regexp +} + var fileContentCmd = &cobra.Command{ Use: "fileContent", Short: "Submodule to test for different properties on file content ", Example: ``, Run: func(_ *cobra.Command, _ []string) { + if len(FileContentConfig.Paths) == 0 { + check.Exit(check.Unknown, "At least one path (--paths) must be selected") + } + + // Input sanity check + for _, inputPath := range FileContentConfig.Paths { + if !path.IsAbs(inputPath) { + check.Exit(check.Unknown, fmt.Sprintf("Path %s is not an absolute path, but must be one", inputPath)) + } + } + + overall := result.Overall{} + + // find files + for _, inputPath := range FileContentConfig.Paths { + sc, err := PathEvaluation(inputPath, FileContentConfig) + if err != nil { + check.ExitError(err) + } + + overall.AddSubcheck(sc) + } + + check.Exit(overall.GetStatus(), overall.GetOutput()) }, } +func PathEvaluation(path string, config fileContent.FileContentconfig) (*result.PartialResult, error) { + fileInfo, err := os.Stat(path) + if err != nil { + return nil, err + } + + if fileInfo.IsDir() { + // Input path is a directory + // apply conditions for all files inside + partialDir := result.NewPartialResult() + partialDir.SetDefaultState(check.OK) + partialDir.SetOutput(path) + + dirs, err := os.ReadDir(path) + if err != nil { + return nil, err + } + + for _, dirEntry := range dirs { + if dirEntry.IsDir() { + if config.Recursive { + // TODO head down + ssc, err := PathEvaluation(filepath.Join(path, dirEntry.Name()), config) + if err != nil { + return nil, err + } + + partialDir.AddSubcheck(ssc) + } + + // non recursive, ignore the dir + continue + } + + // it's a file! + fileSC, err := EvaluateFile(filepath.Join(path, dirEntry.Name()), config) + if err != nil { + return nil, err + } + + partialDir.AddSubcheck(fileSC) + } + + return partialDir, nil + } + + // Input path is a file + // apply conditions directly + return EvaluateFile(path, config) +} + +func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.PartialResult, error) { + evaluationResult := result.NewPartialResult() + evaluationResult.SetDefaultState(check.OK) + + baseName := filepath.Base(path) + evaluationResult.SetOutput(baseName) + + // Evaluation + // -- Pattern matching in file + if (len(config.OKPatterns) != 0) || (len(config.WarningPatterns) != 0) || (len(config.CriticalPatterns) != 0) { + scPattern := result.NewPartialResult() + scPattern.SetDefaultState(config.NotFoundStatus.Status) + + // Pattern matching priority: + // if Critical > Warning > OK + // start with critical and first match wins + foundPattern := false + foundWarningPattern := false + foundCriticalPattern := false + + var patternFound sbRegex.SBRegex + + fileDesc, err := os.Open(path) + if err != nil { + return nil, err + } + + scanner := bufio.NewScanner(fileDesc) + + for scanner.Scan() { + for _, critPattern := range config.CriticalPatterns { + if critPattern.Regex.MatchString(scanner.Text()) { + foundPattern = true + foundCriticalPattern = true + patternFound = critPattern + + break + } + } + + if foundCriticalPattern { + // abort here, if we already have CRITICAL + break + } + + for _, warnPattern := range config.WarningPatterns { + if warnPattern.Regex.MatchString(scanner.Text()) { + foundPattern = true + foundWarningPattern = true + patternFound = warnPattern + + break + } + } + + if foundWarningPattern { + // abort here, if we already have Warning + break + } + + for _, okPattern := range config.OKPatterns { + if okPattern.Regex.MatchString(scanner.Text()) { + foundPattern = true + patternFound = okPattern + + break + } + } + } + + // Scanner failure? + err = scanner.Err() + if err != nil { + return nil, err + } + + if !foundPattern { + scPattern.SetState(config.NotFoundStatus.Status) + scPattern.SetOutput("Regex pattern did not match in file") + } else { + // ok we found something + scPattern.SetOutput("Found pattern \"" + patternFound.String() + "\"") + + if foundCriticalPattern { + scPattern.SetState(check.Critical) + } else if foundWarningPattern { + scPattern.SetState(check.Warning) + } else { + scPattern.SetState(check.OK) + } + } + + evaluationResult.AddSubcheck(scPattern) + } + + return evaluationResult, nil +} + func init() { rootCmd.AddCommand(fileContentCmd) fileContentCmd.DisableFlagsInUseLine = true fileContentFS := fileContentCmd.Flags() fileContentFS.StringArrayVar(&FileContentConfig.Paths, "paths", []string{}, "File paths to evaluate") - fileContentFS.StringArrayVar(&FileContentConfig.OKPatterns, "ok-pattern", []string{}, "Regex pattern in file which are OK") - fileContentFS.StringArrayVar(&FileContentConfig.WarningPatterns, "warning-pattern", []string{}, "Regex pattern in file which cause a WARNING") - fileContentFS.StringArrayVar(&FileContentConfig.Paths, "critical-pattern", []string{}, "Regex pattern in file which cause a CRITICAL") - fileContentFS.IntVar(&FileContentConfig.NotFoundStatus, "paths", check.OK, "Exit status if none of the patterns apply (OK (0), warning (1), critical (2), Uknown (3)) (default: OK)") - fileContentFS.BoolVar(&FileContentConfig.Recursive, "recursive", true, "Recursively test all files in \"paths\"") + fileContentFS.Var(&FileContentConfig.OKPatterns, "ok-pattern", "Regex pattern in file which are OK") + fileContentFS.Var(&FileContentConfig.WarningPatterns, "warning-pattern", "Regex pattern in file which cause a WARNING") + fileContentFS.Var(&FileContentConfig.CriticalPatterns, "critical-pattern", "Regex pattern in file which cause a CRITICAL") + fileContentFS.Var(&FileContentConfig.NotFoundStatus, "not-found-status", "Exit status if none of the patterns apply (OK (0), warning (1), critical (2), Uknown (3)) (default: OK)") + fileContentFS.BoolVar(&FileContentConfig.Recursive, "recursive", false, "Recursively test all files in \"paths\"") } diff --git a/internal/common/regexp/regexp.go b/internal/common/regexp/regexp.go new file mode 100644 index 0000000..f835bf6 --- /dev/null +++ b/internal/common/regexp/regexp.go @@ -0,0 +1,68 @@ +package regexp + +import ( + "regexp" + "strings" +) + +type SBRegex struct { + Regex regexp.Regexp + IsSet bool +} + +type SBRegexList []SBRegex + +func (s *SBRegex) String() string { + return s.Regex.String() +} + +func (s *SBRegex) Type() string { + return "Golang re regular Expression" +} + +func (s *SBRegex) Set(input string) error { + re, err := regexp.Compile(input) + if err != nil { + return err + } + + s.Regex = *re + s.IsSet = true + + return nil +} + +func (s *SBRegexList) String() string { + builder := strings.Builder{} + + length := len(*s) + for index, entry := range *s { + if index == length-1 { + builder.WriteString(entry.String()) + } else { + builder.WriteString(entry.String() + ", ") + } + } + + return builder.String() +} + +func (s *SBRegexList) Type() string { + return "Golang re regular Expression list" +} + +func (s *SBRegexList) Set(input string) error { + re, err := regexp.Compile(input) + if err != nil { + return err + } + + newFoo := SBRegex{ + Regex: *re, + IsSet: true, + } + + *s = append(*s, newFoo) + + return nil +} diff --git a/internal/common/status/status.go b/internal/common/status/status.go new file mode 100644 index 0000000..a6e40c9 --- /dev/null +++ b/internal/common/status/status.go @@ -0,0 +1,48 @@ +package status + +import ( + "fmt" + "strconv" + // "strings" + + "github.com/NETWAYS/go-check" + // "github.com/spf13/pflag" +) + +type Status struct { + Status check.Status + IsSet bool +} + +func (s *Status) String() string { + return s.Status.String() +} + +func (s *Status) Type() string { + return "Monitoring Plugin Status" +} + +func (s *Status) Set(input string) error { + tmp, err := check.NewStatusFromString(input) + if err == nil { + s.Status = tmp + s.IsSet = true + + return nil + } + + intStatus, err := strconv.Atoi(input) + if err != nil { + return fmt.Errorf("failed to convert input \"%s\" to status", input) + } + + tmp, err = check.NewStatus(intStatus) + if err != nil { + return fmt.Errorf("failed to convert input \"%s\" to status", input) + } + + s.IsSet = true + s.Status = tmp + + return nil +} diff --git a/internal/files/fileContent.go b/internal/files/fileContent.go index c26d660..ec8e117 100644 --- a/internal/files/fileContent.go +++ b/internal/files/fileContent.go @@ -1,12 +1,15 @@ package fileContent -import () +import ( + "github.com/NETWAYS/check_system_basics/internal/common/regexp" + "github.com/NETWAYS/check_system_basics/internal/common/status" +) type FileContentconfig struct { Paths []string - OKPatterns []string - WarningPatterns []string - CriticalPatterns []string - NotFoundStatus int + OKPatterns regexp.SBRegexList + WarningPatterns regexp.SBRegexList + CriticalPatterns regexp.SBRegexList + NotFoundStatus status.Status Recursive bool } From 148b7ecfa06a59e21673eaaa84d45ddc8d7ab14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Tue, 11 Aug 2026 16:11:22 +0200 Subject: [PATCH 3/4] Implement metric functionality --- cmd/fileContent.go | 138 ++++++++++++++++++++++++---------- internal/files/fileContent.go | 17 +++-- 2 files changed, 109 insertions(+), 46 deletions(-) diff --git a/cmd/fileContent.go b/cmd/fileContent.go index 1d5d894..cc753b4 100644 --- a/cmd/fileContent.go +++ b/cmd/fileContent.go @@ -6,9 +6,7 @@ import ( "os" "path" "path/filepath" - "regexp" - - // "github.com/NETWAYS/check_system_basics/internal/common/status" + "strconv" sbRegex "github.com/NETWAYS/check_system_basics/internal/common/regexp" fileContent "github.com/NETWAYS/check_system_basics/internal/files" @@ -19,12 +17,6 @@ import ( var FileContentConfig fileContent.FileContentconfig -type EvalConfig struct { - OKPatterns []regexp.Regexp - WarningPatterns []regexp.Regexp - CriticalPatterns []regexp.Regexp -} - var fileContentCmd = &cobra.Command{ Use: "fileContent", Short: "Submodule to test for different properties on file content ", @@ -117,16 +109,16 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa // Evaluation // -- Pattern matching in file - if (len(config.OKPatterns) != 0) || (len(config.WarningPatterns) != 0) || (len(config.CriticalPatterns) != 0) { - scPattern := result.NewPartialResult() - scPattern.SetDefaultState(config.NotFoundStatus.Status) - + if (len(config.OKPatterns) != 0) || (len(config.WarningPatterns) != 0) || (len(config.CriticalPatterns) != 0) || config.MetricPattern.IsSet { // Pattern matching priority: // if Critical > Warning > OK // start with critical and first match wins - foundPattern := false + foundOKPattern := false foundWarningPattern := false foundCriticalPattern := false + foundMetric := false + + var metric float64 var patternFound sbRegex.SBRegex @@ -138,44 +130,62 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa scanner := bufio.NewScanner(fileDesc) for scanner.Scan() { - for _, critPattern := range config.CriticalPatterns { - if critPattern.Regex.MatchString(scanner.Text()) { - foundPattern = true - foundCriticalPattern = true - patternFound = critPattern + if !foundCriticalPattern { + for _, critPattern := range config.CriticalPatterns { + if critPattern.Regex.MatchString(scanner.Text()) { + foundCriticalPattern = true + patternFound = critPattern - break + break + } } } - if foundCriticalPattern { - // abort here, if we already have CRITICAL - break + if !foundWarningPattern { + for _, warnPattern := range config.WarningPatterns { + if warnPattern.Regex.MatchString(scanner.Text()) { + foundWarningPattern = true + patternFound = warnPattern + + break + } + } } - for _, warnPattern := range config.WarningPatterns { - if warnPattern.Regex.MatchString(scanner.Text()) { - foundPattern = true - foundWarningPattern = true - patternFound = warnPattern + if !foundOKPattern { + for _, okPattern := range config.OKPatterns { + if okPattern.Regex.MatchString(scanner.Text()) { + foundOKPattern = true + patternFound = okPattern - break + break + } } } - if foundWarningPattern { - // abort here, if we already have Warning - break - } + if config.MetricPattern.IsSet { + if config.MetricPattern.Regex.MatchString(scanner.Text()) { + foundMetric = true + matchSlice := config.MetricPattern.Regex.FindStringSubmatch(scanner.Text()) - for _, okPattern := range config.OKPatterns { - if okPattern.Regex.MatchString(scanner.Text()) { - foundPattern = true - patternFound = okPattern + if matchSlice == nil { + check.ExitError(fmt.Errorf("Metrix Regex submatch failed somehow")) + } - break + metric, err = strconv.ParseFloat(matchSlice[1], 64) + if err != nil { + check.ExitError(err) + } } } + + if (config.MetricPattern.IsSet || foundMetric) && + (len(config.CriticalPatterns) == 0 || foundCriticalPattern) && + (len(config.WarningPatterns) == 0 || foundWarningPattern) && + (len(config.OKPatterns) == 0 || foundOKPattern) { + // Abort if we are done + break + } } // Scanner failure? @@ -184,7 +194,10 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa return nil, err } - if !foundPattern { + scPattern := result.NewPartialResult() + scPattern.SetDefaultState(config.NotFoundStatus.Status) + + if !foundCriticalPattern && !foundWarningPattern && !foundOKPattern { scPattern.SetState(config.NotFoundStatus.Status) scPattern.SetOutput("Regex pattern did not match in file") } else { @@ -201,6 +214,44 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa } evaluationResult.AddSubcheck(scPattern) + + if config.MetricPattern.IsSet { + // Expected a metric match + scMetric := result.NewPartialResult() + + if !foundMetric { + scMetric.SetState(config.MetricNotFoundStatus.Status) + scMetric.SetOutput("Metric not found") + } else { + scMetric.SetState(check.OK) + scMetric.SetOutput(fmt.Sprintf("%s: %g", config.MetricLabel, metric)) + + pdMetrcis := check.Perfdata{ + Value: metric, + Label: config.MetricLabel, + } + + if config.MetricThresholds.Warn.IsSet { + pdMetrcis.Warn = &config.MetricThresholds.Warn.Th + } + + if config.MetricThresholds.Warn.Th.DoesViolate(metric) { + scMetric.SetState(check.Warning) + } + + if config.MetricThresholds.Crit.IsSet { + pdMetrcis.Crit = &config.MetricThresholds.Crit.Th + } + + if config.MetricThresholds.Crit.Th.DoesViolate(metric) { + scMetric.SetState(check.Critical) + } + + scMetric.AddPerfdata(&pdMetrcis) + } + + evaluationResult.AddSubcheck(scMetric) + } } return evaluationResult, nil @@ -212,9 +263,16 @@ func init() { fileContentFS := fileContentCmd.Flags() fileContentFS.StringArrayVar(&FileContentConfig.Paths, "paths", []string{}, "File paths to evaluate") + fileContentFS.BoolVar(&FileContentConfig.Recursive, "recursive", false, "Recursively test all files in \"paths\"") + fileContentFS.Var(&FileContentConfig.OKPatterns, "ok-pattern", "Regex pattern in file which are OK") fileContentFS.Var(&FileContentConfig.WarningPatterns, "warning-pattern", "Regex pattern in file which cause a WARNING") fileContentFS.Var(&FileContentConfig.CriticalPatterns, "critical-pattern", "Regex pattern in file which cause a CRITICAL") fileContentFS.Var(&FileContentConfig.NotFoundStatus, "not-found-status", "Exit status if none of the patterns apply (OK (0), warning (1), critical (2), Uknown (3)) (default: OK)") - fileContentFS.BoolVar(&FileContentConfig.Recursive, "recursive", false, "Recursively test all files in \"paths\"") + + fileContentFS.Var(&FileContentConfig.MetricPattern, "metric-pattern", "Regex pattern to find numerical values in the file") + fileContentFS.StringVar(&FileContentConfig.MetricLabel, "metric-label", "metric", "(Perfdata) label for matched metrics") + fileContentFS.Var(&FileContentConfig.MetricThresholds.Warn, "metric-warning", "Warning threshold for the matched metric") + fileContentFS.Var(&FileContentConfig.MetricThresholds.Crit, "metric-critical", "Critical threshold for the matched metric") + fileContentFS.Var(&FileContentConfig.MetricNotFoundStatus, "metric-not-found-status", "Exit status if the metric patterns were not found. (OK (0), warning (1), critical (2), Uknown (3)) (default: OK)") } diff --git a/internal/files/fileContent.go b/internal/files/fileContent.go index ec8e117..277d28a 100644 --- a/internal/files/fileContent.go +++ b/internal/files/fileContent.go @@ -3,13 +3,18 @@ package fileContent import ( "github.com/NETWAYS/check_system_basics/internal/common/regexp" "github.com/NETWAYS/check_system_basics/internal/common/status" + "github.com/NETWAYS/check_system_basics/internal/common/thresholds" ) type FileContentconfig struct { - Paths []string - OKPatterns regexp.SBRegexList - WarningPatterns regexp.SBRegexList - CriticalPatterns regexp.SBRegexList - NotFoundStatus status.Status - Recursive bool + Paths []string + OKPatterns regexp.SBRegexList + WarningPatterns regexp.SBRegexList + CriticalPatterns regexp.SBRegexList + NotFoundStatus status.Status + Recursive bool + MetricPattern regexp.SBRegex + MetricLabel string + MetricThresholds thresholds.Thresholds + MetricNotFoundStatus status.Status } From 71d9c6c6f4f507a49cd750ef69830532022a8cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Mon, 31 Aug 2026 10:52:10 +0200 Subject: [PATCH 4/4] make golangci-lint happy --- cmd/fileContent.go | 11 +++++++++-- internal/common/status/status.go | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/fileContent.go b/cmd/fileContent.go index cc753b4..a9fc994 100644 --- a/cmd/fileContent.go +++ b/cmd/fileContent.go @@ -2,6 +2,7 @@ package cmd import ( "bufio" + "errors" "fmt" "os" "path" @@ -55,6 +56,7 @@ func PathEvaluation(path string, config fileContent.FileContentconfig) (*result. return nil, err } + // nolint: nestif if fileInfo.IsDir() { // Input path is a directory // apply conditions for all files inside @@ -100,7 +102,10 @@ func PathEvaluation(path string, config fileContent.FileContentconfig) (*result. return EvaluateFile(path, config) } -func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.PartialResult, error) { +// EvaluateFile receives a path and some evaluation parameters +// and applies the conditions to the file content +// nolint: gocognit,gocyclo +func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.PartialResult, error) { // nolint: gocognit evaluationResult := result.NewPartialResult() evaluationResult.SetDefaultState(check.OK) @@ -109,6 +114,7 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa // Evaluation // -- Pattern matching in file + // nolint: nestif if (len(config.OKPatterns) != 0) || (len(config.WarningPatterns) != 0) || (len(config.CriticalPatterns) != 0) || config.MetricPattern.IsSet { // Pattern matching priority: // if Critical > Warning > OK @@ -169,7 +175,7 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa matchSlice := config.MetricPattern.Regex.FindStringSubmatch(scanner.Text()) if matchSlice == nil { - check.ExitError(fmt.Errorf("Metrix Regex submatch failed somehow")) + check.ExitError(errors.New("metrix regex submatch failed somehow")) } metric, err = strconv.ParseFloat(matchSlice[1], 64) @@ -204,6 +210,7 @@ func EvaluateFile(path string, config fileContent.FileContentconfig) (*result.Pa // ok we found something scPattern.SetOutput("Found pattern \"" + patternFound.String() + "\"") + // nolint: gocritic if foundCriticalPattern { scPattern.SetState(check.Critical) } else if foundWarningPattern { diff --git a/internal/common/status/status.go b/internal/common/status/status.go index a6e40c9..9c2e2da 100644 --- a/internal/common/status/status.go +++ b/internal/common/status/status.go @@ -3,6 +3,7 @@ package status import ( "fmt" "strconv" + // "strings" "github.com/NETWAYS/go-check"