summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 57c32f3)
raw | patch | inline | side by side (parent: 57c32f3)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Mon, 18 Nov 2002 07:23:15 +0000 (07:23 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Mon, 18 Nov 2002 07:23:15 +0000 (07:23 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@208 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_disk.c | patch | blob | history |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index bde9563197bed419041a8f126a4dfe0c03450e9f..26d9ac97b74021d51794c70e57bab29f158f1014 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
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");
&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 */