diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-24 16:23:01 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-24 16:23:01 (GMT) |
commit | 446039608cb713726ca3551ff880a7dcd24d3bda (patch) | |
tree | 1fc6291763d72264b835eb9e7809055da53d3e2c /plugins | |
parent | cea7506e69e5708e0df6d029e07d1626e6539379 (diff) | |
download | monitoring-plugins-446039608cb713726ca3551ff880a7dcd24d3bda.tar.gz |
Use max_state
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@458 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-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); |