diff options
Diffstat (limited to 'plugins')
34 files changed, 53 insertions, 64 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 20ae6283..f569731 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c | |||
@@ -69,17 +69,14 @@ main (int argc, char **argv) | |||
69 | 69 | ||
70 | /* process arguments */ | 70 | /* process arguments */ |
71 | if (process_arguments (argc, argv) != TRUE) | 71 | if (process_arguments (argc, argv) != TRUE) |
72 | usage (_("check_by_ssh: could not parse arguments\n")); | 72 | usage4 (_("Could not parse arguments")); |
73 | |||
74 | 73 | ||
75 | /* Set signal handling and alarm timeout */ | 74 | /* Set signal handling and alarm timeout */ |
76 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 75 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
77 | printf (_("Cannot catch SIGALRM")); | 76 | usage4 (_(" Cannot catch SIGALRM")); |
78 | return STATE_UNKNOWN; | ||
79 | } | 77 | } |
80 | alarm (timeout_interval); | 78 | alarm (timeout_interval); |
81 | 79 | ||
82 | |||
83 | /* run the command */ | 80 | /* run the command */ |
84 | 81 | ||
85 | if (verbose) | 82 | if (verbose) |
diff --git a/plugins/check_dig.c b/plugins/check_dig.c index 14c0da5..0102ea5 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c | |||
@@ -66,10 +66,10 @@ main (int argc, char **argv) | |||
66 | 66 | ||
67 | /* Set signal handling and alarm */ | 67 | /* Set signal handling and alarm */ |
68 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) | 68 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) |
69 | usage (_("Cannot catch SIGALRM\n")); | 69 | usage4 (_("Cannot catch SIGALRM")); |
70 | 70 | ||
71 | if (process_arguments (argc, argv) != TRUE) | 71 | if (process_arguments (argc, argv) != TRUE) |
72 | usage (_("Could not parse arguments\n")); | 72 | usage4 (_("Could not parse arguments")); |
73 | 73 | ||
74 | /* get the command to run */ | 74 | /* get the command to run */ |
75 | asprintf (&command_line, "%s @%s -p %d %s -t %s", | 75 | asprintf (&command_line, "%s @%s -p %d %s -t %s", |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 0cab9ac..c7ea344 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -164,7 +164,7 @@ main (int argc, char **argv) | |||
164 | mount_list = read_filesystem_list (0); | 164 | mount_list = read_filesystem_list (0); |
165 | 165 | ||
166 | if (process_arguments (argc, argv) != TRUE) | 166 | if (process_arguments (argc, argv) != TRUE) |
167 | usage (_("check_disk: could not parse arguments\n")); | 167 | usage4 (_("Could not parse arguments")); |
168 | 168 | ||
169 | for (me = mount_list; me; me = me->me_next) { | 169 | for (me = mount_list; me; me = me->me_next) { |
170 | 170 | ||
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index d64431a..070223e 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
@@ -68,12 +68,11 @@ main (int argc, char **argv) | |||
68 | 68 | ||
69 | /* Set signal handling and alarm */ | 69 | /* Set signal handling and alarm */ |
70 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 70 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
71 | printf (_("Cannot catch SIGALRM")); | 71 | usage4 (_("Cannot catch SIGALRM")); |
72 | return STATE_UNKNOWN; | ||
73 | } | 72 | } |
74 | 73 | ||
75 | if (process_arguments (argc, argv) != TRUE) { | 74 | if (process_arguments (argc, argv) != TRUE) { |
76 | usage (_("check_dns: could not parse arguments\n")); | 75 | usage4 (_("Could not parse arguments")); |
77 | } | 76 | } |
78 | 77 | ||
79 | /* get the command to run */ | 78 | /* get the command to run */ |
diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 74236d9..817d647 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c | |||
@@ -68,7 +68,7 @@ main (int argc, char **argv) | |||
68 | textdomain (PACKAGE); | 68 | textdomain (PACKAGE); |
69 | 69 | ||
70 | if (process_arguments (argc, argv) != TRUE) | 70 | if (process_arguments (argc, argv) != TRUE) |
71 | usage (_("check_fping: could not parse arguments\n")); | 71 | usage4 (_("Could not parse arguments")); |
72 | 72 | ||
73 | server = strscpy (server, server_name); | 73 | server = strscpy (server, server_name); |
74 | 74 | ||
diff --git a/plugins/check_game.c b/plugins/check_game.c index c8492d8..89c212e 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c | |||
@@ -64,22 +64,9 @@ main (int argc, char **argv) | |||
64 | setlocale (LC_ALL, ""); | 64 | setlocale (LC_ALL, ""); |
65 | bindtextdomain (PACKAGE, LOCALEDIR); | 65 | bindtextdomain (PACKAGE, LOCALEDIR); |
66 | textdomain (PACKAGE); | 66 | textdomain (PACKAGE); |
67 | |||
68 | // result = process_arguments (argc, argv); | ||
69 | 67 | ||
70 | if (process_arguments (argc, argv) != TRUE) | 68 | if (process_arguments (argc, argv) != TRUE) |
71 | usage (_("check_game: could not parse arguments\n")); | 69 | usage4 (_("Could not parse arguments")); |
72 | |||
73 | /* if (result != OK) { | ||
74 | printf (_("Incorrect arguments supplied\n")); | ||
75 | printf ("\n"); | ||
76 | print_revision (progname, revision); | ||
77 | printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); | ||
78 | printf (_("License: GPL\n")); | ||
79 | printf ("\n"); | ||
80 | return STATE_UNKNOWN; | ||
81 | } | ||
82 | */ | ||
83 | 70 | ||
84 | result = STATE_OK; | 71 | result = STATE_OK; |
85 | 72 | ||
@@ -312,6 +299,7 @@ print_help (void) | |||
312 | { | 299 | { |
313 | print_revision (progname, revision); | 300 | print_revision (progname, revision); |
314 | 301 | ||
302 | printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); | ||
315 | printf (_(COPYRIGHT), copyright, email); | 303 | printf (_(COPYRIGHT), copyright, email); |
316 | 304 | ||
317 | printf (_("This plugin tests %s connections with the specified host."), progname); | 305 | printf (_("This plugin tests %s connections with the specified host."), progname); |
diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 5fdfc8a..7c56e5d 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c | |||
@@ -85,7 +85,7 @@ main (int argc, char **argv) | |||
85 | textdomain (PACKAGE); | 85 | textdomain (PACKAGE); |
86 | 86 | ||
87 | if (process_arguments (argc, argv) != TRUE) | 87 | if (process_arguments (argc, argv) != TRUE) |
88 | usage (_("check_hpjd: could not parse arguments\n")); | 88 | usage4 (_("Could not parse arguments\n")); |
89 | 89 | ||
90 | /* removed ' 2>1' at end of command 10/27/1999 - EG */ | 90 | /* removed ' 2>1' at end of command 10/27/1999 - EG */ |
91 | /* create the query string */ | 91 | /* create the query string */ |
diff --git a/plugins/check_http.c b/plugins/check_http.c index e962e02..93bff45 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -146,7 +146,7 @@ main (int argc, char **argv) | |||
146 | clean_revstring (revision), VERSION); | 146 | clean_revstring (revision), VERSION); |
147 | 147 | ||
148 | if (process_arguments (argc, argv) != TRUE) | 148 | if (process_arguments (argc, argv) != TRUE) |
149 | usage (_("check_http: could not parse arguments\n")); | 149 | usage4 (_("Could not parse arguments")); |
150 | 150 | ||
151 | if (strstr (timestamp, ":")) { | 151 | if (strstr (timestamp, ":")) { |
152 | if (strstr (server_url, "?")) | 152 | if (strstr (server_url, "?")) |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 07b89ac..9c41cc3 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -73,7 +73,7 @@ main (int argc, char *argv[]) | |||
73 | textdomain (PACKAGE); | 73 | textdomain (PACKAGE); |
74 | 74 | ||
75 | if (process_arguments (argc, argv) != TRUE) | 75 | if (process_arguments (argc, argv) != TRUE) |
76 | usage (_("check_ldap: could not parse arguments\n")); | 76 | usage4 (_("Could not parse arguments")); |
77 | 77 | ||
78 | /* initialize alarm signal handling */ | 78 | /* initialize alarm signal handling */ |
79 | signal (SIGALRM, socket_timeout_alarm_handler); | 79 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_load.c b/plugins/check_load.c index 8322dbb..b918fa5 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c | |||
@@ -74,7 +74,7 @@ main (int argc, char **argv) | |||
74 | textdomain (PACKAGE); | 74 | textdomain (PACKAGE); |
75 | 75 | ||
76 | if (process_arguments (argc, argv) != TRUE) | 76 | if (process_arguments (argc, argv) != TRUE) |
77 | usage (_("check_load: could not parse arguments\n")); | 77 | usage4 (_("Could not parse arguments")); |
78 | 78 | ||
79 | #if HAVE_GETLOADAVG==1 | 79 | #if HAVE_GETLOADAVG==1 |
80 | result = getloadavg (la, 3); | 80 | result = getloadavg (la, 3); |
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c index 58717bf..31d132d 100644 --- a/plugins/check_mrtg.c +++ b/plugins/check_mrtg.c | |||
@@ -60,7 +60,7 @@ main (int argc, char **argv) | |||
60 | textdomain (PACKAGE); | 60 | textdomain (PACKAGE); |
61 | 61 | ||
62 | if (process_arguments (argc, argv) != TRUE) | 62 | if (process_arguments (argc, argv) != TRUE) |
63 | usage (_("check_mrtg: could not parse arguments\n")); | 63 | usage4 (_("Could not parse arguments\n")); |
64 | 64 | ||
65 | /* open the MRTG log file for reading */ | 65 | /* open the MRTG log file for reading */ |
66 | fp = fopen (log_file, "r"); | 66 | fp = fopen (log_file, "r"); |
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c index 5bbce50..24ccaa9 100644 --- a/plugins/check_mrtgtraf.c +++ b/plugins/check_mrtgtraf.c | |||
@@ -63,12 +63,12 @@ main (int argc, char **argv) | |||
63 | char outgoing_speed_rating[8]; | 63 | char outgoing_speed_rating[8]; |
64 | 64 | ||
65 | if (process_arguments (argc, argv) != TRUE) | 65 | if (process_arguments (argc, argv) != TRUE) |
66 | usage (_("check_ldap: could not parse arguments\n")); | 66 | usage4 (_("Could not parse arguments")); |
67 | 67 | ||
68 | /* open the MRTG log file for reading */ | 68 | /* open the MRTG log file for reading */ |
69 | fp = fopen (log_file, "r"); | 69 | fp = fopen (log_file, "r"); |
70 | if (fp == NULL) | 70 | if (fp == NULL) |
71 | usage (_("Unable to open MRTG log file\n")); | 71 | usage4 (_("Unable to open MRTG log file")); |
72 | 72 | ||
73 | line = 0; | 73 | line = 0; |
74 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | 74 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { |
@@ -110,7 +110,7 @@ main (int argc, char **argv) | |||
110 | 110 | ||
111 | /* if we couldn't read enough data, return an unknown error */ | 111 | /* if we couldn't read enough data, return an unknown error */ |
112 | if (line <= 2) | 112 | if (line <= 2) |
113 | usage (_("Unable to process MRTG log file\n")); | 113 | usage4 (_("Unable to process MRTG log file")); |
114 | 114 | ||
115 | /* make sure the MRTG data isn't too old */ | 115 | /* make sure the MRTG data isn't too old */ |
116 | time (¤t_time); | 116 | time (¤t_time); |
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 0564f7c..f55630b 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
@@ -56,7 +56,7 @@ main (int argc, char **argv) | |||
56 | textdomain (PACKAGE); | 56 | textdomain (PACKAGE); |
57 | 57 | ||
58 | if (process_arguments (argc, argv) != TRUE) | 58 | if (process_arguments (argc, argv) != TRUE) |
59 | usage (_("check_mysql: could not parse arguments\n")); | 59 | usage4 (_("Could not parse arguments")); |
60 | 60 | ||
61 | /* initialize mysql */ | 61 | /* initialize mysql */ |
62 | mysql_init (&mysql); | 62 | mysql_init (&mysql); |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 7c36d11..618ee57 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -66,12 +66,11 @@ main (int argc, char **argv) | |||
66 | textdomain (PACKAGE); | 66 | textdomain (PACKAGE); |
67 | 67 | ||
68 | if (process_arguments (argc, argv) != TRUE) | 68 | if (process_arguments (argc, argv) != TRUE) |
69 | usage (_("check_nagios: could not parse arguments\n")); | 69 | usage4 (_("Could not parse arguments")); |
70 | 70 | ||
71 | /* Set signal handling and alarm */ | 71 | /* Set signal handling and alarm timeout */ |
72 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { | 72 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { |
73 | printf (_("Cannot catch SIGALRM")); | 73 | usage4 (_("Cannot catch SIGALRM")); |
74 | return STATE_UNKNOWN; | ||
75 | } | 74 | } |
76 | 75 | ||
77 | /* handle timeouts gracefully... */ | 76 | /* handle timeouts gracefully... */ |
diff --git a/plugins/check_nt.c b/plugins/check_nt.c index c7fc745..efd7cde 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c | |||
@@ -111,7 +111,7 @@ int main(int argc, char **argv){ | |||
111 | textdomain (PACKAGE); | 111 | textdomain (PACKAGE); |
112 | 112 | ||
113 | if(process_arguments(argc,argv) != TRUE) | 113 | if(process_arguments(argc,argv) != TRUE) |
114 | usage (_("check_nt: could not parse arguments\n")); | 114 | usage4 (_("Could not parse arguments")); |
115 | 115 | ||
116 | /* initialize alarm signal handling */ | 116 | /* initialize alarm signal handling */ |
117 | signal(SIGALRM,socket_timeout_alarm_handler); | 117 | signal(SIGALRM,socket_timeout_alarm_handler); |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index a6d2e24..ce5773b 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -122,7 +122,7 @@ main(int argc, char **argv) { | |||
122 | textdomain (PACKAGE); | 122 | textdomain (PACKAGE); |
123 | 123 | ||
124 | if (process_arguments(argc,argv) != TRUE) | 124 | if (process_arguments(argc,argv) != TRUE) |
125 | usage (_("check_nwstat: could not parse arguments\n")); | 125 | usage4 (_("Could not parse arguments")); |
126 | 126 | ||
127 | /* initialize alarm signal handling */ | 127 | /* initialize alarm signal handling */ |
128 | signal(SIGALRM,socket_timeout_alarm_handler); | 128 | signal(SIGALRM,socket_timeout_alarm_handler); |
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index cb85dc6..22277f6 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
@@ -86,7 +86,7 @@ main (int argc, char **argv) | |||
86 | textdomain (PACKAGE); | 86 | textdomain (PACKAGE); |
87 | 87 | ||
88 | if (process_arguments (argc, argv) != TRUE) | 88 | if (process_arguments (argc, argv) != TRUE) |
89 | usage (_("check_overcr: could not parse arguments\n")); | 89 | usage4 (_("Could not parse arguments")); |
90 | 90 | ||
91 | /* initialize alarm signal handling */ | 91 | /* initialize alarm signal handling */ |
92 | signal (SIGALRM, socket_timeout_alarm_handler); | 92 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 5c3b810..f9d6611 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c | |||
@@ -133,12 +133,11 @@ main (int argc, char **argv) | |||
133 | textdomain (PACKAGE); | 133 | textdomain (PACKAGE); |
134 | 134 | ||
135 | if (process_arguments (argc, argv) != TRUE) | 135 | if (process_arguments (argc, argv) != TRUE) |
136 | usage (_("check_pgsql: could not parse arguments\n")); | 136 | usage4 (_("Could not parse arguments")); |
137 | 137 | ||
138 | /* Set signal handling and alarm */ | 138 | /* Set signal handling and alarm */ |
139 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { | 139 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { |
140 | printf (_("Cannot catch SIGALRM")); | 140 | usage4 (_("Cannot catch SIGALRM")); |
141 | return STATE_UNKNOWN; | ||
142 | } | 141 | } |
143 | alarm (timeout_interval); | 142 | alarm (timeout_interval); |
144 | 143 | ||
diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 6d8ef06..ecaf03e 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c | |||
@@ -79,12 +79,11 @@ main (int argc, char **argv) | |||
79 | addresses[0] = NULL; | 79 | addresses[0] = NULL; |
80 | 80 | ||
81 | if (process_arguments (argc, argv) != TRUE) | 81 | if (process_arguments (argc, argv) != TRUE) |
82 | usage (_("check_ping: could not parse arguments\n")); | 82 | usage4 (_("Could not parse arguments")); |
83 | 83 | ||
84 | /* Set signal handling and alarm */ | 84 | /* Set signal handling and alarm */ |
85 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 85 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
86 | printf (_("Cannot catch SIGALRM")); | 86 | usage4 (_("Cannot catch SIGALRM")); |
87 | return STATE_UNKNOWN; | ||
88 | } | 87 | } |
89 | 88 | ||
90 | /* handle timeouts gracefully */ | 89 | /* handle timeouts gracefully */ |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index d1e1b7c..4bc87c0 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -116,12 +116,11 @@ main (int argc, char **argv) | |||
116 | metric = METRIC_PROCS; | 116 | metric = METRIC_PROCS; |
117 | 117 | ||
118 | if (process_arguments (argc, argv) != TRUE) | 118 | if (process_arguments (argc, argv) != TRUE) |
119 | usage (_("check_procs: could not parse arguments\n")); | 119 | usage4 (_("Could not parse arguments")); |
120 | 120 | ||
121 | /* Set signal handling and alarm timeout */ | 121 | /* Set signal handling and alarm timeout */ |
122 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { | 122 | if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) { |
123 | printf (_("Cannot catch SIGALRM")); | 123 | usage4 (_("Cannot catch SIGALRM")); |
124 | return STATE_UNKNOWN; | ||
125 | } | 124 | } |
126 | alarm (timeout_interval); | 125 | alarm (timeout_interval); |
127 | 126 | ||
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 405b417..68ed4d8 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -113,7 +113,7 @@ main (int argc, char **argv) | |||
113 | textdomain (PACKAGE); | 113 | textdomain (PACKAGE); |
114 | 114 | ||
115 | if (process_arguments (argc, argv) != TRUE) | 115 | if (process_arguments (argc, argv) != TRUE) |
116 | usage (_("check_radius: could not parse arguments\n")); | 116 | usage4 (_("Could not parse arguments")); |
117 | 117 | ||
118 | str = strdup ("dictionary"); | 118 | str = strdup ("dictionary"); |
119 | if ((config_file && rc_read_config (config_file)) || | 119 | if ((config_file && rc_read_config (config_file)) || |
diff --git a/plugins/check_real.c b/plugins/check_real.c index 9a8f42a..4ede6a5 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c | |||
@@ -65,7 +65,7 @@ main (int argc, char **argv) | |||
65 | textdomain (PACKAGE); | 65 | textdomain (PACKAGE); |
66 | 66 | ||
67 | if (process_arguments (argc, argv) != TRUE) | 67 | if (process_arguments (argc, argv) != TRUE) |
68 | usage (_("check_real: could not parse arguments\n")); | 68 | usage4 (_("Could not parse arguments")); |
69 | 69 | ||
70 | /* initialize alarm signal handling */ | 70 | /* initialize alarm signal handling */ |
71 | signal (SIGALRM, socket_timeout_alarm_handler); | 71 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 3322494..257a38b 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -89,7 +89,7 @@ main (int argc, char **argv) | |||
89 | textdomain (PACKAGE); | 89 | textdomain (PACKAGE); |
90 | 90 | ||
91 | if (process_arguments (argc, argv) != TRUE) | 91 | if (process_arguments (argc, argv) != TRUE) |
92 | usage (_("check_smtp: could not parse arguments\n")); | 92 | usage4 (_("Could not parse arguments")); |
93 | 93 | ||
94 | /* initialize the HELO command with the localhostname */ | 94 | /* initialize the HELO command with the localhostname */ |
95 | #ifndef HOST_MAX_BYTES | 95 | #ifndef HOST_MAX_BYTES |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index c7dff3d..6a41c6a 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -157,7 +157,7 @@ main (int argc, char **argv) | |||
157 | miblist = strdup (DEFAULT_MIBLIST); | 157 | miblist = strdup (DEFAULT_MIBLIST); |
158 | 158 | ||
159 | if (process_arguments (argc, argv) != TRUE) | 159 | if (process_arguments (argc, argv) != TRUE) |
160 | usage (_("check_snmp: could not parse arguments\n")); | 160 | usage4 (_("Could not parse arguments")); |
161 | 161 | ||
162 | /* create the command line to execute */ | 162 | /* create the command line to execute */ |
163 | asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", | 163 | asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s", |
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index f9bbd12..82d0aca 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c | |||
@@ -58,7 +58,7 @@ main (int argc, char **argv) | |||
58 | textdomain (PACKAGE); | 58 | textdomain (PACKAGE); |
59 | 59 | ||
60 | if (process_arguments (argc, argv) != TRUE) | 60 | if (process_arguments (argc, argv) != TRUE) |
61 | usage (_("check_ssh: could not parse arguments\n")); | 61 | usage4 (_("Could not parse arguments")); |
62 | 62 | ||
63 | /* initialize alarm signal handling */ | 63 | /* initialize alarm signal handling */ |
64 | signal (SIGALRM, socket_timeout_alarm_handler); | 64 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index f2d722c..608080a 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -90,7 +90,7 @@ main (int argc, char **argv) | |||
90 | perf = strdup (""); | 90 | perf = strdup (""); |
91 | 91 | ||
92 | if (process_arguments (argc, argv) != TRUE) | 92 | if (process_arguments (argc, argv) != TRUE) |
93 | usage (_("Incorrect arguments supplied\n")); | 93 | usage4 (_("Could not parse arguments")); |
94 | 94 | ||
95 | #ifdef HAVE_PROC_MEMINFO | 95 | #ifdef HAVE_PROC_MEMINFO |
96 | fp = fopen (PROC_MEMINFO, "r"); | 96 | fp = fopen (PROC_MEMINFO, "r"); |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index ed51e94..af3c720 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -240,7 +240,7 @@ main (int argc, char **argv) | |||
240 | status = strdup (""); | 240 | status = strdup (""); |
241 | 241 | ||
242 | if (process_arguments (argc, argv) != TRUE) | 242 | if (process_arguments (argc, argv) != TRUE) |
243 | usage (_("check_tcp: could not parse arguments\n")); | 243 | usage4 (_("Could not parse arguments")); |
244 | 244 | ||
245 | /* use default expect if none listed in process_arguments() */ | 245 | /* use default expect if none listed in process_arguments() */ |
246 | if (EXPECT && server_expect_count == 0) { | 246 | if (EXPECT && server_expect_count == 0) { |
@@ -265,7 +265,7 @@ main (int argc, char **argv) | |||
265 | X509_free(server_cert); | 265 | X509_free(server_cert); |
266 | } | 266 | } |
267 | else { | 267 | else { |
268 | printf("CRITICAL Cannot retrieve server certificate.\n"); | 268 | printf("CRITICAL - Cannot retrieve server certificate.\n"); |
269 | result = STATE_CRITICAL; | 269 | result = STATE_CRITICAL; |
270 | } | 270 | } |
271 | SSL_shutdown (ssl); | 271 | SSL_shutdown (ssl); |
diff --git a/plugins/check_time.c b/plugins/check_time.c index 042a7d5..ee6ff43 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c | |||
@@ -63,7 +63,7 @@ main (int argc, char **argv) | |||
63 | textdomain (PACKAGE); | 63 | textdomain (PACKAGE); |
64 | 64 | ||
65 | if (process_arguments (argc, argv) != TRUE) | 65 | if (process_arguments (argc, argv) != TRUE) |
66 | usage (_("check_time: could not parse arguments\n")); | 66 | usage4 (_("Could not parse arguments")); |
67 | 67 | ||
68 | /* initialize alarm signal handling */ | 68 | /* initialize alarm signal handling */ |
69 | signal (SIGALRM, socket_timeout_alarm_handler); | 69 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_udp.c b/plugins/check_udp.c index fb7cae1..5d67174 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c | |||
@@ -52,7 +52,7 @@ main (int argc, char **argv) | |||
52 | textdomain (PACKAGE); | 52 | textdomain (PACKAGE); |
53 | 53 | ||
54 | if (process_arguments (argc, argv) != TRUE) | 54 | if (process_arguments (argc, argv) != TRUE) |
55 | usage (_("check_udp: could not parse arguments\n")); | 55 | usage4 (_("Could not parse arguments")); |
56 | 56 | ||
57 | /* initialize alarm signal handling */ | 57 | /* initialize alarm signal handling */ |
58 | signal (SIGALRM, socket_timeout_alarm_handler); | 58 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 4006031..e974b75 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -112,7 +112,7 @@ main (int argc, char **argv) | |||
112 | message = strdup (""); | 112 | message = strdup (""); |
113 | 113 | ||
114 | if (process_arguments (argc, argv) != TRUE) | 114 | if (process_arguments (argc, argv) != TRUE) |
115 | usage (_("check_ups: could not parse arguments\n")); | 115 | usage4 (_("Could not parse arguments")); |
116 | 116 | ||
117 | /* initialize alarm signal handling */ | 117 | /* initialize alarm signal handling */ |
118 | signal (SIGALRM, socket_timeout_alarm_handler); | 118 | signal (SIGALRM, socket_timeout_alarm_handler); |
diff --git a/plugins/check_users.c b/plugins/check_users.c index 23f8973..891fe3b 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c | |||
@@ -51,7 +51,7 @@ main (int argc, char **argv) | |||
51 | perf = strdup(""); | 51 | perf = strdup(""); |
52 | 52 | ||
53 | if (process_arguments (argc, argv) != TRUE) | 53 | if (process_arguments (argc, argv) != TRUE) |
54 | usage (_("check_users: could not parse arguments\n")); | 54 | usage4 (_("Could not parse arguments")); |
55 | 55 | ||
56 | /* run the command */ | 56 | /* run the command */ |
57 | child_process = spopen (WHO_COMMAND); | 57 | child_process = spopen (WHO_COMMAND); |
diff --git a/plugins/negate.c b/plugins/negate.c index 02838a6..9e25ebc 100644 --- a/plugins/negate.c +++ b/plugins/negate.c | |||
@@ -84,7 +84,7 @@ main (int argc, char **argv) | |||
84 | textdomain (PACKAGE); | 84 | textdomain (PACKAGE); |
85 | 85 | ||
86 | if (process_arguments (argc, argv) != TRUE) | 86 | if (process_arguments (argc, argv) != TRUE) |
87 | usage (_("negate: could not parse arguments\n")); | 87 | usage4 (_("Could not parse arguments")); |
88 | 88 | ||
89 | /* Set signal handling and alarm */ | 89 | /* Set signal handling and alarm */ |
90 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) | 90 | if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) |
@@ -97,6 +97,7 @@ main (int argc, char **argv) | |||
97 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line); | 97 | die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line); |
98 | 98 | ||
99 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); | 99 | child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); |
100 | |||
100 | if (child_stderr == NULL) { | 101 | if (child_stderr == NULL) { |
101 | printf (_("Could not open stderr for %s\n"), command_line); | 102 | printf (_("Could not open stderr for %s\n"), command_line); |
102 | } | 103 | } |
diff --git a/plugins/popen.c b/plugins/popen.c index f05fe97..94ad583 100644 --- a/plugins/popen.c +++ b/plugins/popen.c | |||
@@ -112,6 +112,7 @@ spopen (const char *cmdstring) | |||
112 | /* there cannot be more args than characters */ | 112 | /* there cannot be more args than characters */ |
113 | argc = strlen (cmdstring) + 1; /* add 1 for NULL termination */ | 113 | argc = strlen (cmdstring) + 1; /* add 1 for NULL termination */ |
114 | argv = malloc (sizeof(char*)*argc); | 114 | argv = malloc (sizeof(char*)*argc); |
115 | |||
115 | if (argv == NULL) { | 116 | if (argv == NULL) { |
116 | printf ("Could not malloc argv array in popen()\n"); | 117 | printf ("Could not malloc argv array in popen()\n"); |
117 | return NULL; | 118 | return NULL; |
diff --git a/plugins/utils.c b/plugins/utils.c index 460ff82..1d7c0db 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -73,6 +73,13 @@ usage3 (const char *msg, int arg) | |||
73 | exit (STATE_UNKNOWN); | 73 | exit (STATE_UNKNOWN); |
74 | } | 74 | } |
75 | 75 | ||
76 | void | ||
77 | usage4 (const char *msg) | ||
78 | { | ||
79 | printf ("%s: %s\n", progname, msg); | ||
80 | print_usage(); | ||
81 | exit (STATE_UNKNOWN); | ||
82 | } | ||
76 | 83 | ||
77 | void | 84 | void |
78 | support (void) | 85 | support (void) |