diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-13 23:51:51 +0100 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-13 23:51:51 +0100 |
| commit | fedff97c96ec7f7866fa15bd38b9a349cf260cad (patch) | |
| tree | be7844e3225a1c2f614faea07ccff3f6f67743d6 | |
| parent | 205b97b3e2133b14fbaab98f81b5f5991cfca1e9 (diff) | |
| download | monitoring-plugins-fedff97c96ec7f7866fa15bd38b9a349cf260cad.tar.gz | |
improved includes and some comments
| -rw-r--r-- | plugins/check_load.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/check_load.c b/plugins/check_load.c index 57be8c69..5d3e6237 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
| @@ -28,28 +28,24 @@ | |||
| 28 | * | 28 | * |
| 29 | *****************************************************************************/ | 29 | *****************************************************************************/ |
| 30 | 30 | ||
| 31 | #include "output.h" | ||
| 32 | #include "perfdata.h" | ||
| 33 | #include "thresholds.h" | ||
| 34 | const char *progname = "check_load"; | 31 | const char *progname = "check_load"; |
| 35 | const char *copyright = "1999-2022"; | 32 | const char *copyright = "1999-2022"; |
| 36 | const char *email = "devel@monitoring-plugins.org"; | 33 | const char *email = "devel@monitoring-plugins.org"; |
| 37 | 34 | ||
| 38 | #include "./common.h" | 35 | #include "./common.h" |
| 36 | #include <string.h> | ||
| 39 | #include "./runcmd.h" | 37 | #include "./runcmd.h" |
| 40 | #include "./utils.h" | 38 | #include "./utils.h" |
| 41 | #include "./popen.h" | 39 | #include "./popen.h" |
| 42 | #include "states.h" | 40 | #include "../lib/states.h" |
| 41 | #include "../lib/output.h" | ||
| 42 | #include "../lib/perfdata.h" | ||
| 43 | #include "../lib/thresholds.h" | ||
| 43 | #include "check_load.d/config.h" | 44 | #include "check_load.d/config.h" |
| 44 | 45 | ||
| 46 | // getloadavg comes from gnulib | ||
| 45 | #include "../gl/stdlib.h" | 47 | #include "../gl/stdlib.h" |
| 46 | 48 | ||
| 47 | #include <string.h> | ||
| 48 | |||
| 49 | #ifdef HAVE_SYS_LOADAVG_H | ||
| 50 | # include <sys/loadavg.h> | ||
| 51 | #endif | ||
| 52 | |||
| 53 | /* needed for compilation under NetBSD, as suggested by Andy Doran */ | 49 | /* needed for compilation under NetBSD, as suggested by Andy Doran */ |
| 54 | #ifndef LOADAVG_1MIN | 50 | #ifndef LOADAVG_1MIN |
| 55 | # define LOADAVG_1MIN 0 | 51 | # define LOADAVG_1MIN 0 |
| @@ -136,6 +132,7 @@ int main(int argc, char **argv) { | |||
| 136 | 132 | ||
| 137 | double load_values[3] = {0, 0, 0}; | 133 | double load_values[3] = {0, 0, 0}; |
| 138 | 134 | ||
| 135 | // this should be getloadavg from gnulib, should work everywhere™ | ||
| 139 | int error = getloadavg(load_values, 3); | 136 | int error = getloadavg(load_values, 3); |
| 140 | if (error != 3) { | 137 | if (error != 3) { |
| 141 | die(STATE_UNKNOWN, _("Failed to retrieve load values")); | 138 | die(STATE_UNKNOWN, _("Failed to retrieve load values")); |
