aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-11-18 07:23:15 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2002-11-18 07:23:15 +0000
commit52c1c4d859b8dc711b9353c5f6373426f3b05efc (patch)
tree98492e735a04aad66807757e0114b21e37a61c2f /plugins
parent57c32f34730554dcd7ccd8e0e1f9c9e40bfb325a (diff)
downloadmonitoring-plugins-52c1c4d859b8dc711b9353c5f6373426f3b05efc.tar.gz
failed to handle multple disks
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@208 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_disk.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index bde95631..26d9ac97 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -69,7 +69,7 @@ main (int argc, char **argv)
char file_system[MAX_INPUT_BUFFER] = "";
char mntp[MAX_INPUT_BUFFER] = "";
char outbuf[MAX_INPUT_BUFFER] = "";
- char *output = NULL;
+ char *output = "";
if (process_arguments (argc, argv) != OK)
usage ("Could not parse arguments\n");
@@ -100,48 +100,15 @@ main (int argc, char **argv)
&used_disk, &free_disk, &usp, &mntp) == 6
|| sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system,
&total_disk, &used_disk, &free_disk, &usp, &mntp) == 6) {
-
- /* cannot use max now that STATE_UNKNOWN is greater than STATE_CRITICAL
- result = max (result, check_disk (usp, free_disk)); */
- temp_result = check_disk (usp, free_disk) ;
-
-
- if ( temp_result == STATE_CRITICAL ) {
- result = STATE_CRITICAL;
- }
- else if (temp_result == STATE_WARNING) {
- if ( !( result == STATE_CRITICAL) ) {
- result = STATE_WARNING;
- }
- }
- else if (temp_result == STATE_OK) {
- if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING) ){
- result = STATE_OK;
- }
- }
- else if (temp_result == STATE_UNKNOWN) {
- if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING || result == STATE_OK) ){
- result = STATE_UNKNOWN;
- }
- }
- else {
- /* don't have a match with the return value from check_disk() */
- result = STATE_UNKNOWN;
- }
-
-
-
- len =
- snprintf (outbuf, MAX_INPUT_BUFFER - 1,
- " [%d kB (%d%%) free on %s]", free_disk, 100 - usp,
- display_mntp ? mntp : file_system);
- outbuf[len] = 0;
- output = strscat (output, outbuf);
+ asprintf (&output, "%s [%d kB (%d%%) free on %s]", output, free_disk,
+ 100 - usp, display_mntp ? mntp : file_system);
+ result = max_state (result, check_disk (usp, free_disk));
}
else {
printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer);
return result;
}
+
}
/* If we get anything on stderr, at least set warning */