diff options
| author | Sven Hartge <sven@svenhartge.de> | 2023-11-28 13:21:05 +0100 |
|---|---|---|
| committer | Sven Hartge <sven@svenhartge.de> | 2023-11-28 13:21:05 +0100 |
| commit | 897e4a840929285b0a29237e12f4aa9b702f41ce (patch) | |
| tree | ce6a5340b72bc884e5a8ac4bda9c49a23cd7cff6 | |
| parent | c2ddda30e043bb62b30ca5d25dba8379697b6340 (diff) | |
| download | monitoring-plugins-897e4a840929285b0a29237e12f4aa9b702f41ce.tar.gz | |
check_procs: ignore our own children
On systems with higher core counts check_procs will occasionally see
its own "ps" child process with a high CPU percentage and raise a
false alarm.
Ignoring the child processes of check_procs prevents this from happening.
| -rw-r--r-- | plugins/check_procs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 6e3feaec..3c98866f 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
| @@ -255,6 +255,13 @@ main (int argc, char **argv) | |||
| 255 | continue; | 255 | continue; |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /* Ignore our own children */ | ||
| 259 | if (procppid == mypid) { | ||
| 260 | if (verbose >= 3) | ||
| 261 | printf("not considering - is our child\n"); | ||
| 262 | continue; | ||
| 263 | } | ||
| 264 | |||
| 258 | /* Ignore excluded processes by name */ | 265 | /* Ignore excluded processes by name */ |
| 259 | if(options & EXCLUDE_PROGS) { | 266 | if(options & EXCLUDE_PROGS) { |
| 260 | int found = 0; | 267 | int found = 0; |
