aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_load.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_load.c')
-rw-r--r--plugins/check_load.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c
index 780ffffe..296a8233 100644
--- a/plugins/check_load.c
+++ b/plugins/check_load.c
@@ -153,7 +153,16 @@ main (int argc, char **argv)
printf (_("Could not open stderr for %s\n"), PATH_TO_UPTIME);
}
fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
- sscanf (input_buffer, "%*[^l]load average: %lf, %lf, %lf", &la1, &la5, &la15);
+ if(strstr(input_buffer, "load average:")) {
+ sscanf (input_buffer, "%*[^l]load average: %lf, %lf, %lf", &la1, &la5, &la15);
+ }
+ else if(strstr(input_buffer, "load averages:")) {
+ sscanf (input_buffer, "%*[^l]load averages: %lf, %lf, %lf", &la1, &la5, &la15);
+ }
+ else {
+ printf (_("could not parse load from uptime: %s\n"), result, PATH_TO_UPTIME);
+ return STATE_UNKNOWN;
+ }
result = spclose (child_process);
if (result) {