diff --git a/docs/checks/commands/check_process.md b/docs/checks/commands/check_process.md index 639e78f9..afe7b3d6 100644 --- a/docs/checks/commands/check_process.md +++ b/docs/checks/commands/check_process.md @@ -60,15 +60,15 @@ Naemon Config ## Argument Defaults -| Argument | Default Value | -| ------------- | ------------------------------------------------ | -| warning | count = 0 | -| critical | state = 'stopped' or count = 0 | -| empty-state | 2 (CRITICAL) | -| empty-syntax | %(status) - no processes found with this filter. | -| top-syntax | %(status) - \${problem_list} | -| ok-syntax | %(status) - all %{count} processes are ok. | -| detail-syntax | \${exe}=\${state} | +| Argument | Default Value | +| ------------- | --------------------------------------------------------- | +| warning | count = 0 | +| critical | state = 'stopped' or count = 0 | +| empty-state | 2 (CRITICAL) | +| empty-syntax | %(status) - no processes found with this filter. | +| top-syntax | %(status) - %{count} process(es) running \${problem_list} | +| ok-syntax | %(status) - all %{count} process(es) are ok. | +| detail-syntax | \${exe}=\${state} | ## Check Specific Arguments diff --git a/pkg/snclient/check_process.go b/pkg/snclient/check_process.go index 70fdc5a8..a7c35313 100644 --- a/pkg/snclient/check_process.go +++ b/pkg/snclient/check_process.go @@ -35,9 +35,9 @@ func (l *CheckProcess) Build() *CheckData { "timezone": {description: "Sets the timezone for time metrics (default is local time)"}, }, conditionAlias: l.buildConditionAlias(), - okSyntax: "%(status) - all %{count} processes are ok.", + okSyntax: "%(status) - all %{count} process(es) are ok.", detailSyntax: "${exe}=${state}", - topSyntax: "%(status) - ${problem_list}", + topSyntax: "%(status) - %{count} process(es) running ${problem_list}", emptyState: 2, emptySyntax: "%(status) - no processes found with this filter.", defaultWarning: "count = 0", diff --git a/pkg/snclient/check_process_test.go b/pkg/snclient/check_process_test.go index 70f1c42e..914f4f29 100644 --- a/pkg/snclient/check_process_test.go +++ b/pkg/snclient/check_process_test.go @@ -19,7 +19,7 @@ func TestCheckProcess(t *testing.T) { res := snc.RunCheck("check_process", []string{}) assert.Equalf(t, CheckExitOK, res.State, "state ok") - assert.Regexpf(t, `^OK - all \d+ processes are ok`, string(res.BuildPluginOutput()), "output matches") + assert.Regexpf(t, `^OK - all \d+ process\(es\) are ok`, string(res.BuildPluginOutput()), "output matches") assert.Regexpf(t, `'count'=\d+;0;0;0$`, string(res.BuildPluginOutput()), "perfdata ok") res = snc.RunCheck("check_process", []string{"process=noneexisting.exe"}) @@ -50,13 +50,13 @@ func TestCheckProcess(t *testing.T) { require.NoErrorf(t, err, "got own exe") res = snc.RunCheck("check_process", []string{"process=" + filepath.Base(myExe)}) assert.Equalf(t, CheckExitOK, res.State, "state ok") - assert.Regexpf(t, `OK - all \d+ processes are ok.`, string(res.BuildPluginOutput()), "output ok") + assert.Regexpf(t, `OK - all \d+ process\(es\) are ok.`, string(res.BuildPluginOutput()), "output ok") assert.Regexpf(t, `rss'=\d{1,15}B;;;0`, string(res.BuildPluginOutput()), "rss ok") // should work case insensitive res = snc.RunCheck("check_process", []string{"process=" + strings.ToUpper(filepath.Base(myExe))}) assert.Equalf(t, CheckExitOK, res.State, "state ok") - assert.Regexpf(t, `OK - all \d+ processes are ok.`, string(res.BuildPluginOutput()), "output ok") + assert.Regexpf(t, `OK - all \d+ process\(es\) are ok.`, string(res.BuildPluginOutput()), "output ok") assert.Regexpf(t, `rss'=\d{1,15}B;;;0`, string(res.BuildPluginOutput()), "rss ok") // check process it not running @@ -68,7 +68,7 @@ func TestCheckProcess(t *testing.T) { // appending filter to previously set filter res = snc.RunCheck("check_process", []string{"filter='pid > 0'", "filter+='pid < 10000'"}) assert.Equalf(t, CheckExitOK, res.State, "state ok") - assert.Regexpf(t, `OK - all \d+ processes are ok`, string(res.BuildPluginOutput()), "output ok") + assert.Regexpf(t, `OK - all \d+ process\(es\) are ok`, string(res.BuildPluginOutput()), "output ok") StopTestAgent(t, snc) }