diff options
-rw-r--r-- | plugins/check_load.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index 896e356..7d60d23 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -54,6 +54,8 @@ void print_help (void); | |||
54 | float wload1 = -1, wload5 = -1, wload15 = -1; | 54 | float wload1 = -1, wload5 = -1, wload15 = -1; |
55 | float cload1 = -1, cload5 = -1, cload15 = -1; | 55 | float cload1 = -1, cload5 = -1, cload15 = -1; |
56 | 56 | ||
57 | char *status_line = ""; | ||
58 | |||
57 | int | 59 | int |
58 | main (int argc, char **argv) | 60 | main (int argc, char **argv) |
59 | { | 61 | { |
@@ -130,16 +132,16 @@ main (int argc, char **argv) | |||
130 | #endif | 132 | #endif |
131 | return STATE_UNKNOWN; | 133 | return STATE_UNKNOWN; |
132 | } | 134 | } |
133 | printf ("load average: %.2f, %.2f, %.2f", la1, la5, la15); | 135 | asprintf(&status_line, "load average: %.2f, %.2f, %.2f", la1, la5, la15); |
134 | if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) { | 136 | if ((la1 >= cload1) || (la5 >= cload5) || (la15 >= cload15)) { |
135 | printf (" CRITICAL\n"); | 137 | printf("CRITICAL - %s\n", status_line); |
136 | return STATE_CRITICAL; | 138 | return STATE_CRITICAL; |
137 | } | 139 | } |
138 | if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) { | 140 | if ((la1 >= wload1) || (la5 >= wload5) || (la15 >= wload15)) { |
139 | printf (" WARNING\n"); | 141 | printf ("WARNING - %s\n", status_line); |
140 | return STATE_WARNING; | 142 | return STATE_WARNING; |
141 | } | 143 | } |
142 | printf ("\n"); | 144 | printf ("OK - %s\n", status_line); |
143 | return STATE_OK; | 145 | return STATE_OK; |
144 | } | 146 | } |
145 | 147 | ||