diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/check_by_ssh.c | 3 | ||||
| -rw-r--r-- | plugins/check_curl.d/check_curl_helpers.c | 2 | ||||
| -rw-r--r-- | plugins/check_curl.d/config.h | 1 | ||||
| -rw-r--r-- | plugins/check_ide_smart.c | 78 | ||||
| -rw-r--r-- | plugins/check_nagios.c | 33 | ||||
| -rw-r--r-- | plugins/common.h | 4 | ||||
| -rw-r--r-- | plugins/netutils.h | 7 | ||||
| -rw-r--r-- | plugins/sslutils.c | 3 | ||||
| -rw-r--r-- | plugins/utils.c | 1 |
9 files changed, 79 insertions, 53 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 4d0c8e7d..178908cf 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
| @@ -100,8 +100,7 @@ int main(int argc, char **argv) { | |||
| 100 | if (child_result.cmd_error_code == 255 && config.unknown_timeout) { | 100 | if (child_result.cmd_error_code == 255 && config.unknown_timeout) { |
| 101 | mp_subcheck sc_ssh_execution = mp_subcheck_init(); | 101 | mp_subcheck sc_ssh_execution = mp_subcheck_init(); |
| 102 | xasprintf(&sc_ssh_execution.output, "SSH connection failed: %s", | 102 | xasprintf(&sc_ssh_execution.output, "SSH connection failed: %s", |
| 103 | child_result.err.lines > 0 ? child_result.err.line[0] | 103 | child_result.err.lines > 0 ? child_result.err.line[0] : "(no error output)"); |
| 104 | : "(no error output)"); | ||
| 105 | 104 | ||
| 106 | sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN); | 105 | sc_ssh_execution = mp_set_subcheck_state(sc_ssh_execution, STATE_UNKNOWN); |
| 107 | mp_add_subcheck_to_check(&overall, sc_ssh_execution); | 106 | mp_add_subcheck_to_check(&overall, sc_ssh_execution); |
diff --git a/plugins/check_curl.d/check_curl_helpers.c b/plugins/check_curl.d/check_curl_helpers.c index 5b13a138..4edd0bbf 100644 --- a/plugins/check_curl.d/check_curl_helpers.c +++ b/plugins/check_curl.d/check_curl_helpers.c | |||
| @@ -222,7 +222,7 @@ check_curl_configure_curl(const check_curl_static_curl_config config, | |||
| 222 | 222 | ||
| 223 | bool have_local_resolution = hostname_gets_resolved_locally(working_state); | 223 | bool have_local_resolution = hostname_gets_resolved_locally(working_state); |
| 224 | if (verbose >= 1) { | 224 | if (verbose >= 1) { |
| 225 | printf("* have local name resolution: %s\n", (have_local_resolution ? "true": "false")); | 225 | printf("* have local name resolution: %s\n", (have_local_resolution ? "true" : "false")); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | /* enable haproxy protocol */ | 228 | /* enable haproxy protocol */ |
diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h index 0a7fa01d..2ff486c9 100644 --- a/plugins/check_curl.d/config.h +++ b/plugins/check_curl.d/config.h | |||
| @@ -118,7 +118,6 @@ typedef struct { | |||
| 118 | bool show_extended_perfdata; | 118 | bool show_extended_perfdata; |
| 119 | bool show_body; | 119 | bool show_body; |
| 120 | 120 | ||
| 121 | |||
| 122 | bool output_format_is_set; | 121 | bool output_format_is_set; |
| 123 | mp_output_format output_format; | 122 | mp_output_format output_format; |
| 124 | } check_curl_config; | 123 | } check_curl_config; |
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 43731039..e6b29f1c 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c | |||
| @@ -118,7 +118,8 @@ typedef struct { | |||
| 118 | static struct { | 118 | static struct { |
| 119 | uint8_t value; | 119 | uint8_t value; |
| 120 | char *text; | 120 | char *text; |
| 121 | } offline_status_text[] = {{0x00, "NeverStarted"}, {0x02, "Completed"}, {0x04, "Suspended"}, {0x05, "Aborted"}, {0x06, "Failed"}, {0, 0}}; | 121 | } offline_status_text[] = {{0x00, "NeverStarted"}, {0x02, "Completed"}, {0x04, "Suspended"}, |
| 122 | {0x05, "Aborted"}, {0x06, "Failed"}, {0, 0}}; | ||
| 122 | 123 | ||
| 123 | static struct { | 124 | static struct { |
| 124 | uint8_t value; | 125 | uint8_t value; |
| @@ -141,7 +142,8 @@ static int smart_read_values(int /*fd*/, smart_values * /*values*/); | |||
| 141 | static mp_state_enum compare_values_and_thresholds(smart_values * /*p*/, smart_thresholds * /*t*/); | 142 | static mp_state_enum compare_values_and_thresholds(smart_values * /*p*/, smart_thresholds * /*t*/); |
| 142 | static void print_value(smart_value * /*p*/, smart_threshold * /*t*/); | 143 | static void print_value(smart_value * /*p*/, smart_threshold * /*t*/); |
| 143 | static void print_values(smart_values * /*p*/, smart_thresholds * /*t*/); | 144 | static void print_values(smart_values * /*p*/, smart_thresholds * /*t*/); |
| 144 | static mp_state_enum smart_cmd_simple(int /*fd*/, enum SmartCommand /*command*/, uint8_t /*val0*/, bool /*show_error*/); | 145 | static mp_state_enum smart_cmd_simple(int /*fd*/, enum SmartCommand /*command*/, uint8_t /*val0*/, |
| 146 | bool /*show_error*/); | ||
| 145 | static int smart_read_thresholds(int /*fd*/, smart_thresholds * /*thresholds*/); | 147 | static int smart_read_thresholds(int /*fd*/, smart_thresholds * /*thresholds*/); |
| 146 | static int verbose = 0; | 148 | static int verbose = 0; |
| 147 | 149 | ||
| @@ -150,15 +152,16 @@ typedef struct { | |||
| 150 | check_ide_smart_config config; | 152 | check_ide_smart_config config; |
| 151 | } check_ide_smart_config_wrapper; | 153 | } check_ide_smart_config_wrapper; |
| 152 | static check_ide_smart_config_wrapper process_arguments(int argc, char **argv) { | 154 | static check_ide_smart_config_wrapper process_arguments(int argc, char **argv) { |
| 153 | static struct option longopts[] = {{"device", required_argument, 0, 'd'}, | 155 | static struct option longopts[] = { |
| 154 | {"immediate", no_argument, 0, 'i'}, | 156 | {"device", required_argument, 0, 'd'}, |
| 155 | {"quiet-check", no_argument, 0, 'q'}, | 157 | {"immediate", no_argument, 0, 'i'}, |
| 156 | {"auto-on", no_argument, 0, '1'}, | 158 | {"quiet-check", no_argument, 0, 'q'}, |
| 157 | {"auto-off", no_argument, 0, '0'}, | 159 | {"auto-on", no_argument, 0, '1'}, |
| 158 | {"nagios", no_argument, 0, 'n'}, /* DEPRECATED, but we still accept it */ | 160 | {"auto-off", no_argument, 0, '0'}, |
| 159 | {"help", no_argument, 0, 'h'}, | 161 | {"nagios", no_argument, 0, 'n'}, /* DEPRECATED, but we still accept it */ |
| 160 | {"version", no_argument, 0, 'V'}, | 162 | {"help", no_argument, 0, 'h'}, |
| 161 | {0, 0, 0, 0}}; | 163 | {"version", no_argument, 0, 'V'}, |
| 164 | {0, 0, 0, 0}}; | ||
| 162 | 165 | ||
| 163 | check_ide_smart_config_wrapper result = { | 166 | check_ide_smart_config_wrapper result = { |
| 164 | .errorcode = OK, | 167 | .errorcode = OK, |
| @@ -178,18 +181,21 @@ static check_ide_smart_config_wrapper process_arguments(int argc, char **argv) { | |||
| 178 | result.config.device = optarg; | 181 | result.config.device = optarg; |
| 179 | break; | 182 | break; |
| 180 | case 'q': | 183 | case 'q': |
| 181 | fprintf(stderr, "%s\n", _("DEPRECATION WARNING: the -q switch (quiet output) is no longer \"quiet\".")); | 184 | fprintf(stderr, "%s\n", |
| 185 | _("DEPRECATION WARNING: the -q switch (quiet output) is no longer \"quiet\".")); | ||
| 182 | fprintf(stderr, "%s\n", _("Nagios-compatible output is now always returned.")); | 186 | fprintf(stderr, "%s\n", _("Nagios-compatible output is now always returned.")); |
| 183 | break; | 187 | break; |
| 184 | case 'i': | 188 | case 'i': |
| 185 | case '1': | 189 | case '1': |
| 186 | case '0': | 190 | case '0': |
| 187 | printf("%s\n", _("SMART commands are broken and have been disabled (See Notes in --help).")); | 191 | printf("%s\n", |
| 192 | _("SMART commands are broken and have been disabled (See Notes in --help).")); | ||
| 188 | result.errorcode = ERROR; | 193 | result.errorcode = ERROR; |
| 189 | return result; | 194 | return result; |
| 190 | break; | 195 | break; |
| 191 | case 'n': | 196 | case 'n': |
| 192 | fprintf(stderr, "%s\n", _("DEPRECATION WARNING: the -n switch (Nagios-compatible output) is now the")); | 197 | fprintf(stderr, "%s\n", |
| 198 | _("DEPRECATION WARNING: the -n switch (Nagios-compatible output) is now the")); | ||
| 193 | fprintf(stderr, "%s\n", _("default and will be removed from future releases.")); | 199 | fprintf(stderr, "%s\n", _("default and will be removed from future releases.")); |
| 194 | break; | 200 | break; |
| 195 | case 'v': /* verbose */ | 201 | case 'v': /* verbose */ |
| @@ -348,12 +354,13 @@ mp_state_enum compare_values_and_thresholds(smart_values *values, smart_threshol | |||
| 348 | 354 | ||
| 349 | switch (status) { | 355 | switch (status) { |
| 350 | case PREFAILURE: | 356 | case PREFAILURE: |
| 351 | printf(_("CRITICAL - %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), prefailure, prefailure > 1 ? 's' : ' ', failed, | 357 | printf(_("CRITICAL - %d Harddrive PreFailure%cDetected! %d/%d tests failed.\n"), prefailure, |
| 352 | total); | 358 | prefailure > 1 ? 's' : ' ', failed, total); |
| 353 | status = STATE_CRITICAL; | 359 | status = STATE_CRITICAL; |
| 354 | break; | 360 | break; |
| 355 | case ADVISORY: | 361 | case ADVISORY: |
| 356 | printf(_("WARNING - %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), advisory, advisory > 1 ? "ies" : "y", failed, total); | 362 | printf(_("WARNING - %d Harddrive Advisor%s Detected. %d/%d tests failed.\n"), advisory, |
| 363 | advisory > 1 ? "ies" : "y", failed, total); | ||
| 357 | status = STATE_WARNING; | 364 | status = STATE_WARNING; |
| 358 | break; | 365 | break; |
| 359 | case OPERATIONAL: | 366 | case OPERATIONAL: |
| @@ -369,9 +376,11 @@ mp_state_enum compare_values_and_thresholds(smart_values *values, smart_threshol | |||
| 369 | } | 376 | } |
| 370 | 377 | ||
| 371 | void print_value(smart_value *value_pointer, smart_threshold *threshold_pointer) { | 378 | void print_value(smart_value *value_pointer, smart_threshold *threshold_pointer) { |
| 372 | printf("Id=%3d, Status=%2d {%s , %s}, Value=%3d, Threshold=%3d, %s\n", value_pointer->id, value_pointer->status, | 379 | printf("Id=%3d, Status=%2d {%s , %s}, Value=%3d, Threshold=%3d, %s\n", value_pointer->id, |
| 373 | value_pointer->status & 1 ? "PreFailure" : "Advisory ", value_pointer->status & 2 ? "OnLine " : "OffLine", | 380 | value_pointer->status, value_pointer->status & 1 ? "PreFailure" : "Advisory ", |
| 374 | value_pointer->value, threshold_pointer->threshold, value_pointer->value >= threshold_pointer->threshold ? "Passed" : "Failed"); | 381 | value_pointer->status & 2 ? "OnLine " : "OffLine", value_pointer->value, |
| 382 | threshold_pointer->threshold, | ||
| 383 | value_pointer->value >= threshold_pointer->threshold ? "Passed" : "Failed"); | ||
| 375 | } | 384 | } |
| 376 | 385 | ||
| 377 | void print_values(smart_values *values, smart_thresholds *thresholds) { | 386 | void print_values(smart_values *values, smart_thresholds *thresholds) { |
| @@ -382,15 +391,21 @@ void print_values(smart_values *values, smart_thresholds *thresholds) { | |||
| 382 | print_value(value++, threshold++); | 391 | print_value(value++, threshold++); |
| 383 | } | 392 | } |
| 384 | } | 393 | } |
| 385 | printf(_("OffLineStatus=%d {%s}, AutoOffLine=%s, OffLineTimeout=%d minutes\n"), values->offline_status, | 394 | printf(_("OffLineStatus=%d {%s}, AutoOffLine=%s, OffLineTimeout=%d minutes\n"), |
| 386 | get_offline_text(values->offline_status & 0x7f), (values->offline_status & 0x80 ? "Yes" : "No"), values->offline_timeout / 60); | 395 | values->offline_status, get_offline_text(values->offline_status & 0x7f), |
| 387 | printf(_("OffLineCapability=%d {%s %s %s}\n"), values->offline_capability, values->offline_capability & 1 ? "Immediate" : "", | 396 | (values->offline_status & 0x80 ? "Yes" : "No"), values->offline_timeout / 60); |
| 388 | values->offline_capability & 2 ? "Auto" : "", values->offline_capability & 4 ? "AbortOnCmd" : "SuspendOnCmd"); | 397 | printf(_("OffLineCapability=%d {%s %s %s}\n"), values->offline_capability, |
| 389 | printf(_("SmartRevision=%d, CheckSum=%d, SmartCapability=%d {%s %s}\n"), values->revision, values->checksum, values->smart_capability, | 398 | values->offline_capability & 1 ? "Immediate" : "", |
| 390 | values->smart_capability & 1 ? "SaveOnStandBy" : "", values->smart_capability & 2 ? "AutoSave" : ""); | 399 | values->offline_capability & 2 ? "Auto" : "", |
| 400 | values->offline_capability & 4 ? "AbortOnCmd" : "SuspendOnCmd"); | ||
| 401 | printf(_("SmartRevision=%d, CheckSum=%d, SmartCapability=%d {%s %s}\n"), values->revision, | ||
| 402 | values->checksum, values->smart_capability, | ||
| 403 | values->smart_capability & 1 ? "SaveOnStandBy" : "", | ||
| 404 | values->smart_capability & 2 ? "AutoSave" : ""); | ||
| 391 | } | 405 | } |
| 392 | 406 | ||
| 393 | mp_state_enum smart_cmd_simple(int file_descriptor, enum SmartCommand command, uint8_t val0, bool show_error) { | 407 | mp_state_enum smart_cmd_simple(int file_descriptor, enum SmartCommand command, uint8_t val0, |
| 408 | bool show_error) { | ||
| 394 | mp_state_enum result = STATE_UNKNOWN; | 409 | mp_state_enum result = STATE_UNKNOWN; |
| 395 | #ifdef __linux__ | 410 | #ifdef __linux__ |
| 396 | uint8_t args[4] = { | 411 | uint8_t args[4] = { |
| @@ -517,15 +532,18 @@ void print_help(void) { | |||
| 517 | 532 | ||
| 518 | printf(" %s\n", "-d, --device=DEVICE"); | 533 | printf(" %s\n", "-d, --device=DEVICE"); |
| 519 | printf(" %s\n", _("Select device DEVICE")); | 534 | printf(" %s\n", _("Select device DEVICE")); |
| 520 | printf(" %s\n", _("Note: if the device is specified without this option, any further option will")); | 535 | printf(" %s\n", |
| 536 | _("Note: if the device is specified without this option, any further option will")); | ||
| 521 | printf(" %s\n", _("be ignored.")); | 537 | printf(" %s\n", _("be ignored.")); |
| 522 | 538 | ||
| 523 | printf(UT_VERBOSE); | 539 | printf(UT_VERBOSE); |
| 524 | 540 | ||
| 525 | printf("\n"); | 541 | printf("\n"); |
| 526 | printf("%s\n", _("Notes:")); | 542 | printf("%s\n", _("Notes:")); |
| 527 | printf(" %s\n", _("The SMART command modes (-i/--immediate, -0/--auto-off and -1/--auto-on) were")); | 543 | printf(" %s\n", |
| 528 | printf(" %s\n", _("broken in an underhand manner and have been disabled. You can use smartctl")); | 544 | _("The SMART command modes (-i/--immediate, -0/--auto-off and -1/--auto-on) were")); |
| 545 | printf(" %s\n", | ||
| 546 | _("broken in an underhand manner and have been disabled. You can use smartctl")); | ||
| 529 | printf(" %s\n", _("instead:")); | 547 | printf(" %s\n", _("instead:")); |
| 530 | printf(" %s\n", _("-0/--auto-off: use \"smartctl --offlineauto=off\"")); | 548 | printf(" %s\n", _("-0/--auto-off: use \"smartctl --offlineauto=off\"")); |
| 531 | printf(" %s\n", _("-1/--auto-on: use \"smartctl --offlineauto=on\"")); | 549 | printf(" %s\n", _("-1/--auto-on: use \"smartctl --offlineauto=on\"")); |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index e2f230c9..84506bb4 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
| @@ -79,7 +79,8 @@ int main(int argc, char **argv) { | |||
| 79 | /* open the status log */ | 79 | /* open the status log */ |
| 80 | FILE *log_file = fopen(config.status_log, "r"); | 80 | FILE *log_file = fopen(config.status_log, "r"); |
| 81 | if (log_file == NULL) { | 81 | if (log_file == NULL) { |
| 82 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), _("Cannot open status log for reading!")); | 82 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), |
| 83 | _("Cannot open status log for reading!")); | ||
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | unsigned long latest_entry_time = 0L; | 86 | unsigned long latest_entry_time = 0L; |
| @@ -153,7 +154,8 @@ int main(int argc, char **argv) { | |||
| 153 | } | 154 | } |
| 154 | 155 | ||
| 155 | /* May get empty procargs */ | 156 | /* May get empty procargs */ |
| 156 | if (!strstr(procargs, argv[0]) && strstr(procargs, config.process_string) && strcmp(procargs, "")) { | 157 | if (!strstr(procargs, argv[0]) && strstr(procargs, config.process_string) && |
| 158 | strcmp(procargs, "")) { | ||
| 157 | proc_entries++; | 159 | proc_entries++; |
| 158 | if (verbose >= 2) { | 160 | if (verbose >= 2) { |
| 159 | printf(_("Found process: %s %s\n"), procprog, procargs); | 161 | printf(_("Found process: %s %s\n"), procprog, procargs); |
| @@ -171,11 +173,13 @@ int main(int argc, char **argv) { | |||
| 171 | alarm(0); | 173 | alarm(0); |
| 172 | 174 | ||
| 173 | if (proc_entries == 0) { | 175 | if (proc_entries == 0) { |
| 174 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), _("Could not locate a running Nagios process!")); | 176 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), |
| 177 | _("Could not locate a running Nagios process!")); | ||
| 175 | } | 178 | } |
| 176 | 179 | ||
| 177 | if (latest_entry_time == 0L) { | 180 | if (latest_entry_time == 0L) { |
| 178 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), _("Cannot parse Nagios log file for valid time")); | 181 | die(STATE_CRITICAL, "NAGIOS %s: %s\n", _("CRITICAL"), |
| 182 | _("Cannot parse Nagios log file for valid time")); | ||
| 179 | } | 183 | } |
| 180 | 184 | ||
| 181 | time_t current_time; | 185 | time_t current_time; |
| @@ -189,7 +193,8 @@ int main(int argc, char **argv) { | |||
| 189 | printf("NAGIOS %s: ", (result == STATE_OK) ? _("OK") : _("WARNING")); | 193 | printf("NAGIOS %s: ", (result == STATE_OK) ? _("OK") : _("WARNING")); |
| 190 | printf(ngettext("%d process", "%d processes", proc_entries), proc_entries); | 194 | printf(ngettext("%d process", "%d processes", proc_entries), proc_entries); |
| 191 | printf(", "); | 195 | printf(", "); |
| 192 | printf(ngettext("status log updated %d second ago", "status log updated %d seconds ago", (int)(current_time - latest_entry_time)), | 196 | printf(ngettext("status log updated %d second ago", "status log updated %d seconds ago", |
| 197 | (int)(current_time - latest_entry_time)), | ||
| 193 | (int)(current_time - latest_entry_time)); | 198 | (int)(current_time - latest_entry_time)); |
| 194 | printf("\n"); | 199 | printf("\n"); |
| 195 | 200 | ||
| @@ -198,10 +203,11 @@ int main(int argc, char **argv) { | |||
| 198 | 203 | ||
| 199 | /* process command-line arguments */ | 204 | /* process command-line arguments */ |
| 200 | check_nagios_config_wrapper process_arguments(int argc, char **argv) { | 205 | check_nagios_config_wrapper process_arguments(int argc, char **argv) { |
| 201 | static struct option longopts[] = {{"filename", required_argument, 0, 'F'}, {"expires", required_argument, 0, 'e'}, | 206 | static struct option longopts[] = { |
| 202 | {"command", required_argument, 0, 'C'}, {"timeout", optional_argument, 0, 't'}, | 207 | {"filename", required_argument, 0, 'F'}, {"expires", required_argument, 0, 'e'}, |
| 203 | {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, | 208 | {"command", required_argument, 0, 'C'}, {"timeout", optional_argument, 0, 't'}, |
| 204 | {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}}; | 209 | {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, |
| 210 | {"verbose", no_argument, 0, 'v'}, {0, 0, 0, 0}}; | ||
| 205 | 211 | ||
| 206 | check_nagios_config_wrapper result = { | 212 | check_nagios_config_wrapper result = { |
| 207 | .errorcode = OK, | 213 | .errorcode = OK, |
| @@ -285,7 +291,8 @@ void print_help(void) { | |||
| 285 | printf("%s\n", _("This plugin checks the status of the Nagios process on the local machine")); | 291 | printf("%s\n", _("This plugin checks the status of the Nagios process on the local machine")); |
| 286 | printf("%s\n", _("The plugin will check to make sure the Nagios status log is no older than")); | 292 | printf("%s\n", _("The plugin will check to make sure the Nagios status log is no older than")); |
| 287 | printf("%s\n", _("the number of minutes specified by the expires option.")); | 293 | printf("%s\n", _("the number of minutes specified by the expires option.")); |
| 288 | printf("%s\n", _("It also checks the process table for a process matching the command argument.")); | 294 | printf("%s\n", |
| 295 | _("It also checks the process table for a process matching the command argument.")); | ||
| 289 | 296 | ||
| 290 | printf("\n\n"); | 297 | printf("\n\n"); |
| 291 | 298 | ||
| @@ -306,12 +313,14 @@ void print_help(void) { | |||
| 306 | 313 | ||
| 307 | printf("\n"); | 314 | printf("\n"); |
| 308 | printf("%s\n", _("Examples:")); | 315 | printf("%s\n", _("Examples:")); |
| 309 | printf(" %s\n", "check_nagios -t 20 -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios"); | 316 | printf(" %s\n", "check_nagios -t 20 -e 5 -F /usr/local/nagios/var/status.log -C " |
| 317 | "/usr/local/nagios/bin/nagios"); | ||
| 310 | 318 | ||
| 311 | printf(UT_SUPPORT); | 319 | printf(UT_SUPPORT); |
| 312 | } | 320 | } |
| 313 | 321 | ||
| 314 | void print_usage(void) { | 322 | void print_usage(void) { |
| 315 | printf("%s\n", _("Usage:")); | 323 | printf("%s\n", _("Usage:")); |
| 316 | printf("%s -F <status log file> -t <timeout_seconds> -e <expire_minutes> -C <process_string>\n", progname); | 324 | printf("%s -F <status log file> -t <timeout_seconds> -e <expire_minutes> -C <process_string>\n", |
| 325 | progname); | ||
| 317 | } | 326 | } |
diff --git a/plugins/common.h b/plugins/common.h index 9d1434a3..577f70fe 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
| @@ -207,9 +207,9 @@ enum { | |||
| 207 | 207 | ||
| 208 | /* for checking the result of getopt_long */ | 208 | /* for checking the result of getopt_long */ |
| 209 | #if EOF == -1 | 209 | #if EOF == -1 |
| 210 | #define CHECK_EOF(c) ((c) == EOF) | 210 | # define CHECK_EOF(c) ((c) == EOF) |
| 211 | #else | 211 | #else |
| 212 | #define CHECK_EOF(c) ((c) == -1 || (c) == EOF) | 212 | # define CHECK_EOF(c) ((c) == -1 || (c) == EOF) |
| 213 | #endif | 213 | #endif |
| 214 | 214 | ||
| 215 | #endif /* _COMMON_H_ */ | 215 | #endif /* _COMMON_H_ */ |
diff --git a/plugins/netutils.h b/plugins/netutils.h index 16c2d31f..a74930b8 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
| @@ -78,8 +78,8 @@ bool dns_lookup(const char *, struct sockaddr_storage *, int); | |||
| 78 | void host_or_die(const char *str); | 78 | void host_or_die(const char *str); |
| 79 | #define resolve_host_or_addr(addr, family) dns_lookup(addr, NULL, family) | 79 | #define resolve_host_or_addr(addr, family) dns_lookup(addr, NULL, family) |
| 80 | #define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) | 80 | #define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) |
| 81 | # define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) | 81 | #define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) |
| 82 | # define is_hostname(addr) resolve_host_or_addr(addr, address_family) | 82 | #define is_hostname(addr) resolve_host_or_addr(addr, address_family) |
| 83 | 83 | ||
| 84 | extern unsigned int socket_timeout; | 84 | extern unsigned int socket_timeout; |
| 85 | extern mp_state_enum socket_timeout_state; | 85 | extern mp_state_enum socket_timeout_state; |
| @@ -128,7 +128,8 @@ typedef struct { | |||
| 128 | double remaining_seconds; | 128 | double remaining_seconds; |
| 129 | retrieve_expiration_date_errors errors; | 129 | retrieve_expiration_date_errors errors; |
| 130 | } net_ssl_check_cert_result; | 130 | } net_ssl_check_cert_result; |
| 131 | net_ssl_check_cert_result np_net_ssl_check_cert2(unsigned int days_till_exp_warn, unsigned int days_till_exp_crit); | 131 | net_ssl_check_cert_result np_net_ssl_check_cert2(unsigned int days_till_exp_warn, |
| 132 | unsigned int days_till_exp_crit); | ||
| 132 | 133 | ||
| 133 | mp_state_enum np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); | 134 | mp_state_enum np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); |
| 134 | mp_subcheck mp_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); | 135 | mp_subcheck mp_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit); |
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index bcfb08d6..9151f722 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
| @@ -410,7 +410,8 @@ retrieve_expiration_time_result np_net_ssl_get_cert_expiration(X509 *certificate | |||
| 410 | # endif /* MOPL_USE_OPENSSL */ | 410 | # endif /* MOPL_USE_OPENSSL */ |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | net_ssl_check_cert_result np_net_ssl_check_cert2(unsigned int days_till_exp_warn, unsigned int days_till_exp_crit) { | 413 | net_ssl_check_cert_result np_net_ssl_check_cert2(unsigned int days_till_exp_warn, |
| 414 | unsigned int days_till_exp_crit) { | ||
| 414 | # ifdef MOPL_USE_OPENSSL | 415 | # ifdef MOPL_USE_OPENSSL |
| 415 | X509 *certificate = NULL; | 416 | X509 *certificate = NULL; |
| 416 | certificate = SSL_get_peer_certificate(s); | 417 | certificate = SSL_get_peer_certificate(s); |
diff --git a/plugins/utils.c b/plugins/utils.c index dc6f5a85..941efa39 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
| @@ -40,7 +40,6 @@ extern const char *progname; | |||
| 40 | #define STRLEN 64 | 40 | #define STRLEN 64 |
| 41 | #define TXTBLK 128 | 41 | #define TXTBLK 128 |
| 42 | 42 | ||
| 43 | |||
| 44 | void usage(const char *msg) { | 43 | void usage(const char *msg) { |
| 45 | printf("%s\n", msg); | 44 | printf("%s\n", msg); |
| 46 | print_usage(); | 45 | print_usage(); |
