diff options
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-18 07:23:15 +0000 |
---|---|---|
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | 2002-11-18 07:23:15 +0000 |
commit | 52c1c4d859b8dc711b9353c5f6373426f3b05efc (patch) | |
tree | 98492e735a04aad66807757e0114b21e37a61c2f /plugins/check_disk.c | |
parent | 57c32f34730554dcd7ccd8e0e1f9c9e40bfb325a (diff) | |
download | monitoring-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/check_disk.c')
-rw-r--r-- | plugins/check_disk.c | 43 |
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) | |||
69 | char file_system[MAX_INPUT_BUFFER] = ""; | 69 | char file_system[MAX_INPUT_BUFFER] = ""; |
70 | char mntp[MAX_INPUT_BUFFER] = ""; | 70 | char mntp[MAX_INPUT_BUFFER] = ""; |
71 | char outbuf[MAX_INPUT_BUFFER] = ""; | 71 | char outbuf[MAX_INPUT_BUFFER] = ""; |
72 | char *output = NULL; | 72 | char *output = ""; |
73 | 73 | ||
74 | if (process_arguments (argc, argv) != OK) | 74 | if (process_arguments (argc, argv) != OK) |
75 | usage ("Could not parse arguments\n"); | 75 | usage ("Could not parse arguments\n"); |
@@ -100,48 +100,15 @@ main (int argc, char **argv) | |||
100 | &used_disk, &free_disk, &usp, &mntp) == 6 | 100 | &used_disk, &free_disk, &usp, &mntp) == 6 |
101 | || sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system, | 101 | || sscanf (input_buffer, "%s %*s %d %d %d %d%% %s", file_system, |
102 | &total_disk, &used_disk, &free_disk, &usp, &mntp) == 6) { | 102 | &total_disk, &used_disk, &free_disk, &usp, &mntp) == 6) { |
103 | 103 | asprintf (&output, "%s [%d kB (%d%%) free on %s]", output, free_disk, | |
104 | /* cannot use max now that STATE_UNKNOWN is greater than STATE_CRITICAL | 104 | 100 - usp, display_mntp ? mntp : file_system); |
105 | result = max (result, check_disk (usp, free_disk)); */ | 105 | result = max_state (result, check_disk (usp, free_disk)); |
106 | temp_result = check_disk (usp, free_disk) ; | ||
107 | |||
108 | |||
109 | if ( temp_result == STATE_CRITICAL ) { | ||
110 | result = STATE_CRITICAL; | ||
111 | } | ||
112 | else if (temp_result == STATE_WARNING) { | ||
113 | if ( !( result == STATE_CRITICAL) ) { | ||
114 | result = STATE_WARNING; | ||
115 | } | ||
116 | } | ||
117 | else if (temp_result == STATE_OK) { | ||
118 | if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING) ){ | ||
119 | result = STATE_OK; | ||
120 | } | ||
121 | } | ||
122 | else if (temp_result == STATE_UNKNOWN) { | ||
123 | if ( ! ( result == STATE_CRITICAL || result == STATE_WARNING || result == STATE_OK) ){ | ||
124 | result = STATE_UNKNOWN; | ||
125 | } | ||
126 | } | ||
127 | else { | ||
128 | /* don't have a match with the return value from check_disk() */ | ||
129 | result = STATE_UNKNOWN; | ||
130 | } | ||
131 | |||
132 | |||
133 | |||
134 | len = | ||
135 | snprintf (outbuf, MAX_INPUT_BUFFER - 1, | ||
136 | " [%d kB (%d%%) free on %s]", free_disk, 100 - usp, | ||
137 | display_mntp ? mntp : file_system); | ||
138 | outbuf[len] = 0; | ||
139 | output = strscat (output, outbuf); | ||
140 | } | 106 | } |
141 | else { | 107 | else { |
142 | printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); | 108 | printf ("Unable to read output:\n%s\n%s\n", command_line, input_buffer); |
143 | return result; | 109 | return result; |
144 | } | 110 | } |
111 | |||
145 | } | 112 | } |
146 | 113 | ||
147 | /* If we get anything on stderr, at least set warning */ | 114 | /* If we get anything on stderr, at least set warning */ |