Skip to content
Open
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
18 changes: 9 additions & 9 deletions docs/checks/commands/check_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions pkg/snclient/check_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions pkg/snclient/check_process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
Loading