diff options
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index 275d0ad..ba942c5 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -55,8 +55,8 @@ char *status_line; | |||
55 | int | 55 | int |
56 | main (int argc, char **argv) | 56 | main (int argc, char **argv) |
57 | { | 57 | { |
58 | #if HAVE_GETLOADAVG==1 | ||
59 | int result; | 58 | int result; |
59 | #if HAVE_GETLOADAVG==1 | ||
60 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ | 60 | double la[3] = { 0.0, 0.0, 0.0 }; /* NetBSD complains about unitialized arrays */ |
61 | #else | 61 | #else |
62 | # if HAVE_PROC_LOADAVG==1 | 62 | # if HAVE_PROC_LOADAVG==1 |
@@ -64,7 +64,6 @@ main (int argc, char **argv) | |||
64 | char input_buffer[MAX_INPUT_BUFFER]; | 64 | char input_buffer[MAX_INPUT_BUFFER]; |
65 | char *tmp_ptr; | 65 | char *tmp_ptr; |
66 | # else | 66 | # else |
67 | int result; | ||
68 | char input_buffer[MAX_INPUT_BUFFER]; | 67 | char input_buffer[MAX_INPUT_BUFFER]; |
69 | # endif | 68 | # endif |
70 | #endif | 69 | #endif |
@@ -126,6 +125,7 @@ main (int argc, char **argv) | |||
126 | # endif | 125 | # endif |
127 | #endif | 126 | #endif |
128 | 127 | ||
128 | |||
129 | if ((la1 < 0.0) || (la5 < 0.0) || (la15 < 0.0)) { | 129 | if ((la1 < 0.0) || (la5 < 0.0) || (la15 < 0.0)) { |
130 | #if HAVE_GETLOADAVG==1 | 130 | #if HAVE_GETLOADAVG==1 |
131 | printf (_("Error in getloadavg()\n")); | 131 | printf (_("Error in getloadavg()\n")); |
@@ -138,16 +138,23 @@ main (int argc, char **argv) | |||
138 | #endif | 138 | #endif |
139 | return STATE_UNKNOWN; | 139 | return STATE_UNKNOWN; |
140 | } | 140 | } |
141 | |||
141 | asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15); | 142 | asprintf(&status_line, _("load average: %.2f, %.2f, %.2f"), la1, la5, la15); |
142 | if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) { | 143 | |
143 | printf(_("CRITICAL - %s\n"), status_line); | 144 | if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) |
144 | return STATE_CRITICAL; | 145 | result = STATE_CRITICAL; |
145 | } | 146 | else if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) |
146 | if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) { | 147 | result = STATE_WARNING; |
147 | printf (_("WARNING - %s\n"), status_line); | 148 | else |
148 | return STATE_WARNING; | 149 | result = STATE_OK; |
149 | } | 150 | |
150 | printf (_("OK - %s\n"), status_line); | 151 | die (result, |
152 | "%s - %s|%s %s %s\n", | ||
153 | state_text (result), | ||
154 | status_line, | ||
155 | perfdata ("load1", la1, "", wload1, wload1, cload1, cload1, TRUE, 0, FALSE, 0), | ||
156 | perfdata ("load5", la5, "", wload5, wload5, cload5, cload5, TRUE, 0, FALSE, 0), | ||
157 | perfdata ("load15", la15, "", wload15, wload15, cload15, cload15, TRUE, 0, FALSE, 0)); | ||
151 | return STATE_OK; | 158 | return STATE_OK; |
152 | } | 159 | } |
153 | 160 | ||