diff options
author | Holger Weiss <hweiss@users.sourceforge.net> | 2009-04-22 00:44:15 +0200 |
---|---|---|
committer | Holger Weiss <hweiss@users.sourceforge.net> | 2009-04-22 00:47:47 +0200 |
commit | ff8b447e14451b01d3823393c74e1521e5d4cf9f (patch) | |
tree | 1a68718ff109dfcbdc01c97e543870293040e24e /plugins/check_dns.c | |
parent | 92bb86c484c3d52c5ffdfa790f7a5acf68edcc36 (diff) | |
download | monitoring-plugins-refs/heads/hw/output/plugins.tar.gz |
Convert plugins to use the new output functionshw/output/plugins
*** THIS COMMIT WILL BE MODIFIED IN THE FUTURE! ****
Convert some of the C plugins to use the new "configurable output
functions".
Diffstat (limited to 'plugins/check_dns.c')
-rw-r--r-- | plugins/check_dns.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 454f813b..d81536a1 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -56,7 +56,6 @@ void print_usage (void); | |||
56 | char query_address[ADDRESS_LENGTH] = ""; | 56 | char query_address[ADDRESS_LENGTH] = ""; |
57 | char dns_server[ADDRESS_LENGTH] = ""; | 57 | char dns_server[ADDRESS_LENGTH] = ""; |
58 | char ptr_server[ADDRESS_LENGTH] = ""; | 58 | char ptr_server[ADDRESS_LENGTH] = ""; |
59 | int verbose = FALSE; | ||
60 | char expected_address[ADDRESS_LENGTH] = ""; | 59 | char expected_address[ADDRESS_LENGTH] = ""; |
61 | int match_expected_address = FALSE; | 60 | int match_expected_address = FALSE; |
62 | int expect_authority = FALSE; | 61 | int expect_authority = FALSE; |
@@ -80,6 +79,7 @@ main (int argc, char **argv) | |||
80 | output chld_out, chld_err; | 79 | output chld_out, chld_err; |
81 | size_t i; | 80 | size_t i; |
82 | 81 | ||
82 | np_set_mynames(argv[0], "DNS"); | ||
83 | setlocale (LC_ALL, ""); | 83 | setlocale (LC_ALL, ""); |
84 | bindtextdomain (PACKAGE, LOCALEDIR); | 84 | bindtextdomain (PACKAGE, LOCALEDIR); |
85 | textdomain (PACKAGE); | 85 | textdomain (PACKAGE); |
@@ -99,8 +99,7 @@ main (int argc, char **argv) | |||
99 | alarm (timeout_interval); | 99 | alarm (timeout_interval); |
100 | gettimeofday (&tv, NULL); | 100 | gettimeofday (&tv, NULL); |
101 | 101 | ||
102 | if (verbose) | 102 | np_verbatim(command_line); |
103 | printf ("%s\n", command_line); | ||
104 | 103 | ||
105 | /* run the command */ | 104 | /* run the command */ |
106 | if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) { | 105 | if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) { |
@@ -110,8 +109,7 @@ main (int argc, char **argv) | |||
110 | 109 | ||
111 | /* scan stdout */ | 110 | /* scan stdout */ |
112 | for(i = 0; i < chld_out.lines; i++) { | 111 | for(i = 0; i < chld_out.lines; i++) { |
113 | if (verbose) | 112 | np_verbatim(chld_out.line[i]); |
114 | puts(chld_out.line[i]); | ||
115 | 113 | ||
116 | if (strstr (chld_out.line[i], ".in-addr.arpa")) { | 114 | if (strstr (chld_out.line[i], ".in-addr.arpa")) { |
117 | if ((temp_buffer = strstr (chld_out.line[i], "name = "))) | 115 | if ((temp_buffer = strstr (chld_out.line[i], "name = "))) |
@@ -161,8 +159,7 @@ main (int argc, char **argv) | |||
161 | 159 | ||
162 | /* scan stderr */ | 160 | /* scan stderr */ |
163 | for(i = 0; i < chld_err.lines; i++) { | 161 | for(i = 0; i < chld_err.lines; i++) { |
164 | if (verbose) | 162 | np_verbatim(chld_err.line[i]); |
165 | puts(chld_err.line[i]); | ||
166 | 163 | ||
167 | if (error_scan (chld_err.line[i]) != STATE_OK) { | 164 | if (error_scan (chld_err.line[i]) != STATE_OK) { |
168 | result = max_state (result, error_scan (chld_err.line[i])); | 165 | result = max_state (result, error_scan (chld_err.line[i])); |
@@ -329,7 +326,7 @@ process_arguments (int argc, char **argv) | |||
329 | print_revision (progname, revision); | 326 | print_revision (progname, revision); |
330 | exit (STATE_OK); | 327 | exit (STATE_OK); |
331 | case 'v': /* version */ | 328 | case 'v': /* version */ |
332 | verbose = TRUE; | 329 | np_increase_verbosity(1); |
333 | break; | 330 | break; |
334 | case 't': /* timeout period */ | 331 | case 't': /* timeout period */ |
335 | timeout_interval = atoi (optarg); | 332 | timeout_interval = atoi (optarg); |