diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-11-26 14:04:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-26 14:04:51 +0100 |
| commit | 0378484a57f219fc0156e208bff5152ee8624837 (patch) | |
| tree | a676bd3f036767d598dbe7a8b3ecc9328e4bb360 /plugins/check_mysql.c | |
| parent | 3657197cf77ca78f6e2d003a71d48dc5d4dc45ae (diff) | |
| parent | 317ee266a88bd8752113df39f12e2d133edd6802 (diff) | |
| download | monitoring-plugins-0378484a57f219fc0156e208bff5152ee8624837.tar.gz | |
Merge pull request #2181 from RincewindsHat/fix/output_arguments
Add output formatting option where they were forgotten
Diffstat (limited to 'plugins/check_mysql.c')
| -rw-r--r-- | plugins/check_mysql.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 9d8094c0..009c9908 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
| @@ -96,6 +96,10 @@ int main(int argc, char **argv) { | |||
| 96 | 96 | ||
| 97 | const check_mysql_config config = tmp_config.config; | 97 | const check_mysql_config config = tmp_config.config; |
| 98 | 98 | ||
| 99 | if (config.output_format_is_set) { | ||
| 100 | mp_set_format(config.output_format); | ||
| 101 | } | ||
| 102 | |||
| 99 | MYSQL mysql; | 103 | MYSQL mysql; |
| 100 | /* initialize mysql */ | 104 | /* initialize mysql */ |
| 101 | mysql_init(&mysql); | 105 | mysql_init(&mysql); |
| @@ -471,6 +475,7 @@ check_mysql_config_wrapper process_arguments(int argc, char **argv) { | |||
| 471 | 475 | ||
| 472 | enum { | 476 | enum { |
| 473 | CHECK_REPLICA_OPT = CHAR_MAX + 1, | 477 | CHECK_REPLICA_OPT = CHAR_MAX + 1, |
| 478 | output_format_index, | ||
| 474 | }; | 479 | }; |
| 475 | 480 | ||
| 476 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, | 481 | static struct option longopts[] = {{"hostname", required_argument, 0, 'H'}, |
| @@ -495,6 +500,7 @@ check_mysql_config_wrapper process_arguments(int argc, char **argv) { | |||
| 495 | {"cert", required_argument, 0, 'a'}, | 500 | {"cert", required_argument, 0, 'a'}, |
| 496 | {"ca-dir", required_argument, 0, 'D'}, | 501 | {"ca-dir", required_argument, 0, 'D'}, |
| 497 | {"ciphers", required_argument, 0, 'L'}, | 502 | {"ciphers", required_argument, 0, 'L'}, |
| 503 | {"output-format", required_argument, 0, output_format_index}, | ||
| 498 | {0, 0, 0, 0}}; | 504 | {0, 0, 0, 0}}; |
| 499 | 505 | ||
| 500 | check_mysql_config_wrapper result = { | 506 | check_mysql_config_wrapper result = { |
| @@ -605,6 +611,17 @@ check_mysql_config_wrapper process_arguments(int argc, char **argv) { | |||
| 605 | break; | 611 | break; |
| 606 | case '?': /* help */ | 612 | case '?': /* help */ |
| 607 | usage5(); | 613 | usage5(); |
| 614 | case output_format_index: { | ||
| 615 | parsed_output_format parser = mp_parse_output_format(optarg); | ||
| 616 | if (!parser.parsing_success) { | ||
| 617 | printf("Invalid output format: %s\n", optarg); | ||
| 618 | exit(STATE_UNKNOWN); | ||
| 619 | } | ||
| 620 | |||
| 621 | result.config.output_format_is_set = true; | ||
| 622 | result.config.output_format = parser.output_format; | ||
| 623 | break; | ||
| 624 | } | ||
| 608 | } | 625 | } |
| 609 | } | 626 | } |
| 610 | 627 | ||
| @@ -711,6 +728,8 @@ void print_help(void) { | |||
| 711 | printf(" %s\n", "-L, --ciphers=STRING"); | 728 | printf(" %s\n", "-L, --ciphers=STRING"); |
| 712 | printf(" %s\n", _("List of valid SSL ciphers")); | 729 | printf(" %s\n", _("List of valid SSL ciphers")); |
| 713 | 730 | ||
| 731 | printf(UT_OUTPUT_FORMAT); | ||
| 732 | |||
| 714 | printf("\n"); | 733 | printf("\n"); |
| 715 | printf(" %s\n", | 734 | printf(" %s\n", |
| 716 | _("There are no required arguments. By default, the local database is checked")); | 735 | _("There are no required arguments. By default, the local database is checked")); |
