diff options
-rw-r--r-- | plugins/check_procs.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index ceaff95..e95a072 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -164,28 +164,16 @@ main (int argc, char **argv) | |||
164 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { | 164 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) { |
165 | if (verbose) | 165 | if (verbose) |
166 | printf ("STDERR: %s", input_buffer); | 166 | printf ("STDERR: %s", input_buffer); |
167 | /*Cannot use max() any more as STATE_UNKNOWN is gt STATE_CRITICAL | 167 | result = max_state (result, STATE_WARNING); |
168 | result = max (result, STATE_WARNING); */ | 168 | printf ("System call sent warnings to stderr\n"); |
169 | if ( !(result == STATE_CRITICAL) ) { | ||
170 | result = STATE_WARNING; | ||
171 | } | ||
172 | printf ("System call sent warnings to stderr\n"); | ||
173 | } | 169 | } |
174 | 170 | ||
175 | /* if (result == STATE_UNKNOWN || result == STATE_WARNING) | ||
176 | printf ("System call sent warnings to stderr\n"); | ||
177 | */ | ||
178 | (void) fclose (child_stderr); | 171 | (void) fclose (child_stderr); |
179 | 172 | ||
180 | /* close the pipe */ | 173 | /* close the pipe */ |
181 | if (spclose (child_process)) { | 174 | if (spclose (child_process)) { |
182 | printf ("System call returned nonzero status\n"); | 175 | printf ("System call returned nonzero status\n"); |
183 | if ( !(result == STATE_CRITICAL) ) { | 176 | result = max_state (result, STATE_WARNING); |
184 | return STATE_WARNING; | ||
185 | } | ||
186 | else { | ||
187 | return result ; | ||
188 | } | ||
189 | } | 177 | } |
190 | 178 | ||
191 | if (options == ALL) | 179 | if (options == ALL) |
@@ -235,23 +223,11 @@ main (int argc, char **argv) | |||
235 | } | 223 | } |
236 | else if (wmax >= 0 && procs > wmax) { | 224 | else if (wmax >= 0 && procs > wmax) { |
237 | printf (fmt, "WARNING", procs); | 225 | printf (fmt, "WARNING", procs); |
238 | if ( !(result == STATE_CRITICAL) ) { | 226 | return max_state (result, STATE_WARNING); |
239 | return STATE_WARNING; | ||
240 | } | ||
241 | else { | ||
242 | return result ; | ||
243 | } | ||
244 | /*return max (result, STATE_WARNING); */ | ||
245 | } | 227 | } |
246 | else if (wmin >= 0 && procs < wmin) { | 228 | else if (wmin >= 0 && procs < wmin) { |
247 | printf (fmt, "WARNING", procs); | 229 | printf (fmt, "WARNING", procs); |
248 | if ( !(result == STATE_CRITICAL) ) { | 230 | return max_state (result, STATE_WARNING); |
249 | return STATE_WARNING; | ||
250 | } | ||
251 | else { | ||
252 | return result ; | ||
253 | } | ||
254 | /*return max (result, STATE_WARNING); */ | ||
255 | } | 231 | } |
256 | 232 | ||
257 | printf (fmt, "OK", procs); | 233 | printf (fmt, "OK", procs); |