diff options
Diffstat (limited to 'plugins/check_by_ssh.c')
-rw-r--r-- | plugins/check_by_ssh.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 46d1297f..55940876 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -57,7 +57,6 @@ char *outputfile = NULL; | |||
57 | char *host_shortname = NULL; | 57 | char *host_shortname = NULL; |
58 | char **service; | 58 | char **service; |
59 | int passive = FALSE; | 59 | int passive = FALSE; |
60 | int verbose = FALSE; | ||
61 | 60 | ||
62 | int | 61 | int |
63 | main (int argc, char **argv) | 62 | main (int argc, char **argv) |
@@ -71,6 +70,7 @@ main (int argc, char **argv) | |||
71 | FILE *fp = NULL; | 70 | FILE *fp = NULL; |
72 | struct output chld_out, chld_err; | 71 | struct output chld_out, chld_err; |
73 | 72 | ||
73 | np_set_mynames(argv[0], "BY-SSH"); | ||
74 | remotecmd = ""; | 74 | remotecmd = ""; |
75 | comm = strdup (SSH_COMMAND); | 75 | comm = strdup (SSH_COMMAND); |
76 | 76 | ||
@@ -89,8 +89,7 @@ main (int argc, char **argv) | |||
89 | alarm (timeout_interval); | 89 | alarm (timeout_interval); |
90 | 90 | ||
91 | /* run the command */ | 91 | /* run the command */ |
92 | if (verbose) | 92 | np_verbatim(comm); |
93 | printf ("%s\n", comm); | ||
94 | 93 | ||
95 | result = np_runcmd(comm, &chld_out, &chld_err, 0); | 94 | result = np_runcmd(comm, &chld_out, &chld_err, 0); |
96 | 95 | ||
@@ -206,7 +205,7 @@ process_arguments (int argc, char **argv) | |||
206 | print_help (); | 205 | print_help (); |
207 | exit (STATE_OK); | 206 | exit (STATE_OK); |
208 | case 'v': /* help */ | 207 | case 'v': /* help */ |
209 | verbose = TRUE; | 208 | np_increase_verbosity(1); |
210 | break; | 209 | break; |
211 | case 't': /* timeout period */ | 210 | case 't': /* timeout period */ |
212 | if (!is_integer (optarg)) | 211 | if (!is_integer (optarg)) |
@@ -292,7 +291,7 @@ process_arguments (int argc, char **argv) | |||
292 | c = optind; | 291 | c = optind; |
293 | if (hostname == NULL) { | 292 | if (hostname == NULL) { |
294 | if (c <= argc) { | 293 | if (c <= argc) { |
295 | die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); | 294 | np_die(STATE_UNKNOWN, _("You must provide a host name")); |
296 | } | 295 | } |
297 | host_or_die(argv[c]); | 296 | host_or_die(argv[c]); |
298 | hostname = argv[c++]; | 297 | hostname = argv[c++]; |
@@ -326,10 +325,10 @@ validate_arguments (void) | |||
326 | return ERROR; | 325 | return ERROR; |
327 | 326 | ||
328 | if (passive && commands != services) | 327 | if (passive && commands != services) |
329 | die (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname); | 328 | np_die(STATE_UNKNOWN, _("In passive mode, you must provide a service name for each command.")); |
330 | 329 | ||
331 | if (passive && host_shortname == NULL) | 330 | if (passive && host_shortname == NULL) |
332 | die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname); | 331 | np_die(STATE_UNKNOWN, _("In passive mode, you must provide the host short name from the nagios configs.")); |
333 | 332 | ||
334 | return OK; | 333 | return OK; |
335 | } | 334 | } |