summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_by_ssh.c8
-rw-r--r--plugins/check_disk.c4
-rw-r--r--plugins/check_dns.c28
-rw-r--r--plugins/check_fping.c14
-rw-r--r--plugins/check_game.c4
-rw-r--r--plugins/check_http.c34
-rw-r--r--plugins/check_mrtg.c2
-rw-r--r--plugins/check_mrtgtraf.c2
-rw-r--r--plugins/check_nagios.c8
-rw-r--r--plugins/check_nt.c2
-rw-r--r--plugins/check_nwstat.c2
-rw-r--r--plugins/check_overcr.c36
-rw-r--r--plugins/check_radius.c14
-rw-r--r--plugins/check_real.c4
-rw-r--r--plugins/check_snmp.c14
-rw-r--r--plugins/check_swap.c2
-rw-r--r--plugins/check_tcp.c6
-rw-r--r--plugins/check_time.c6
-rw-r--r--plugins/negate.c6
-rw-r--r--plugins/netutils.c2
-rw-r--r--plugins/popen.c2
-rw-r--r--plugins/utils.c15
-rw-r--r--plugins/utils.h1
23 files changed, 102 insertions, 114 deletions
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index ae19253..1211daa 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -349,9 +349,9 @@ process_arguments (int argc, char **argv)
349 c = optind; 349 c = optind;
350 if (hostname == NULL) { 350 if (hostname == NULL) {
351 if (c <= argc) { 351 if (c <= argc) {
352 terminate (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname); 352 die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname);
353 } else if (!is_host (argv[c])) 353 } else if (!is_host (argv[c]))
354 terminate (STATE_UNKNOWN, _("%s: Invalid host name %s\n"), progname, argv[c]); 354 die (STATE_UNKNOWN, _("%s: Invalid host name %s\n"), progname, argv[c]);
355 hostname = argv[c++]; 355 hostname = argv[c++];
356 } 356 }
357 357
@@ -385,10 +385,10 @@ validate_arguments (void)
385 return ERROR; 385 return ERROR;
386 386
387 if (passive && commands != services) 387 if (passive && commands != services)
388 terminate (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname); 388 die (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname);
389 389
390 if (passive && host_shortname == NULL) 390 if (passive && host_shortname == NULL)
391 terminate (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname); 391 die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname);
392 392
393 return OK; 393 return OK;
394} 394}
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index c758530..b0b0d2a 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -287,7 +287,7 @@ main (int argc, char **argv)
287 temp_list = temp_list->name_next; 287 temp_list = temp_list->name_next;
288 } 288 }
289 289
290 terminate (result, "DISK %s%s\n", state_text (result), output, details); 290 die (result, "DISK %s%s\n", state_text (result), output, details);
291 return STATE_UNKNOWN; 291 return STATE_UNKNOWN;
292} 292}
293 293
@@ -406,7 +406,7 @@ process_arguments (int argc, char **argv)
406 mult = (unsigned long)1024 * 1024 * 1024 * 1024; 406 mult = (unsigned long)1024 * 1024 * 1024 * 1024;
407 units = "TB"; 407 units = "TB";
408 } else { 408 } else {
409 terminate (STATE_UNKNOWN, _("unit type %s not known\n"), optarg); 409 die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
410 } 410 }
411 break; 411 break;
412 case 'k': /* display mountpoint */ 412 case 'k': /* display mountpoint */
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index eae5880..8b3bb4f 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -180,7 +180,7 @@ main (int argc, char **argv)
180 address = strdup (temp_buffer); 180 address = strdup (temp_buffer);
181 strip (address); 181 strip (address);
182 if (address==NULL || strlen(address)==0) 182 if (address==NULL || strlen(address)==0)
183 terminate (STATE_CRITICAL, 183 die (STATE_CRITICAL,
184 _("DNS CRITICAL - '%s' returned empty host name string\n"), 184 _("DNS CRITICAL - '%s' returned empty host name string\n"),
185 NSLOOKUP_COMMAND); 185 NSLOOKUP_COMMAND);
186 result = STATE_OK; 186 result = STATE_OK;
@@ -224,7 +224,7 @@ main (int argc, char **argv)
224 /* If we got here, we should have an address string, 224 /* If we got here, we should have an address string,
225 and we can segfault if we do not */ 225 and we can segfault if we do not */
226 if (address==NULL || strlen(address)==0) 226 if (address==NULL || strlen(address)==0)
227 terminate (STATE_CRITICAL, 227 die (STATE_CRITICAL,
228 _("DNS CRITICAL - '%s' output parsing exited with no address\n"), 228 _("DNS CRITICAL - '%s' output parsing exited with no address\n"),
229 NSLOOKUP_COMMAND); 229 NSLOOKUP_COMMAND);
230 230
@@ -270,32 +270,32 @@ error_scan (char *input_buffer)
270 270
271 /* DNS server is not running... */ 271 /* DNS server is not running... */
272 else if (strstr (input_buffer, "No response from server")) 272 else if (strstr (input_buffer, "No response from server"))
273 terminate (STATE_CRITICAL, _("No response from name server %s\n"), dns_server); 273 die (STATE_CRITICAL, _("No response from name server %s\n"), dns_server);
274 274
275 /* Host name is valid, but server doesn't have records... */ 275 /* Host name is valid, but server doesn't have records... */
276 else if (strstr (input_buffer, "No records")) 276 else if (strstr (input_buffer, "No records"))
277 terminate (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server); 277 die (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server);
278 278
279 /* Connection was refused */ 279 /* Connection was refused */
280 else if (strstr (input_buffer, "Connection refused") || 280 else if (strstr (input_buffer, "Connection refused") ||
281 (strstr (input_buffer, "** server can't find") && 281 (strstr (input_buffer, "** server can't find") &&
282 strstr (input_buffer, ": REFUSED")) || 282 strstr (input_buffer, ": REFUSED")) ||
283 (strstr (input_buffer, "Refused"))) 283 (strstr (input_buffer, "Refused")))
284 terminate (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server); 284 die (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server);
285 285
286 /* Host or domain name does not exist */ 286 /* Host or domain name does not exist */
287 else if (strstr (input_buffer, "Non-existent") || 287 else if (strstr (input_buffer, "Non-existent") ||
288 strstr (input_buffer, "** server can't find") || 288 strstr (input_buffer, "** server can't find") ||
289 strstr (input_buffer,"NXDOMAIN")) 289 strstr (input_buffer,"NXDOMAIN"))
290 terminate (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address); 290 die (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
291 291
292 /* Network is unreachable */ 292 /* Network is unreachable */
293 else if (strstr (input_buffer, "Network is unreachable")) 293 else if (strstr (input_buffer, "Network is unreachable"))
294 terminate (STATE_CRITICAL, _("Network is unreachable\n")); 294 die (STATE_CRITICAL, _("Network is unreachable\n"));
295 295
296 /* Internal server failure */ 296 /* Internal server failure */
297 else if (strstr (input_buffer, "Server failure")) 297 else if (strstr (input_buffer, "Server failure"))
298 terminate (STATE_CRITICAL, _("Server failure for %s\n"), dns_server); 298 die (STATE_CRITICAL, _("Server failure for %s\n"), dns_server);
299 299
300 /* Request error or the DNS lookup timed out */ 300 /* Request error or the DNS lookup timed out */
301 else if (strstr (input_buffer, "Format error") || 301 else if (strstr (input_buffer, "Format error") ||
@@ -357,7 +357,7 @@ process_arguments (int argc, char **argv)
357 break; 357 break;
358 case 'H': /* hostname */ 358 case 'H': /* hostname */
359 if (strlen (optarg) >= ADDRESS_LENGTH) 359 if (strlen (optarg) >= ADDRESS_LENGTH)
360 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 360 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
361 strcpy (query_address, optarg); 361 strcpy (query_address, optarg);
362 break; 362 break;
363 case 's': /* server name */ 363 case 's': /* server name */
@@ -369,7 +369,7 @@ process_arguments (int argc, char **argv)
369 exit (STATE_UNKNOWN); 369 exit (STATE_UNKNOWN);
370 } 370 }
371 if (strlen (optarg) >= ADDRESS_LENGTH) 371 if (strlen (optarg) >= ADDRESS_LENGTH)
372 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 372 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
373 strcpy (dns_server, optarg); 373 strcpy (dns_server, optarg);
374 break; 374 break;
375 case 'r': /* reverse server name */ 375 case 'r': /* reverse server name */
@@ -380,12 +380,12 @@ process_arguments (int argc, char **argv)
380 exit (STATE_UNKNOWN); 380 exit (STATE_UNKNOWN);
381 } 381 }
382 if (strlen (optarg) >= ADDRESS_LENGTH) 382 if (strlen (optarg) >= ADDRESS_LENGTH)
383 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 383 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
384 strcpy (ptr_server, optarg); 384 strcpy (ptr_server, optarg);
385 break; 385 break;
386 case 'a': /* expected address */ 386 case 'a': /* expected address */
387 if (strlen (optarg) >= ADDRESS_LENGTH) 387 if (strlen (optarg) >= ADDRESS_LENGTH)
388 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 388 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
389 strcpy (expected_address, optarg); 389 strcpy (expected_address, optarg);
390 match_expected_address = TRUE; 390 match_expected_address = TRUE;
391 break; 391 break;
@@ -395,7 +395,7 @@ process_arguments (int argc, char **argv)
395 c = optind; 395 c = optind;
396 if (strlen(query_address)==0 && c<argc) { 396 if (strlen(query_address)==0 && c<argc) {
397 if (strlen(argv[c])>=ADDRESS_LENGTH) 397 if (strlen(argv[c])>=ADDRESS_LENGTH)
398 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 398 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
399 strcpy (query_address, argv[c++]); 399 strcpy (query_address, argv[c++]);
400 } 400 }
401 401
@@ -406,7 +406,7 @@ process_arguments (int argc, char **argv)
406 return ERROR; 406 return ERROR;
407 } 407 }
408 if (strlen(argv[c]) >= ADDRESS_LENGTH) 408 if (strlen(argv[c]) >= ADDRESS_LENGTH)
409 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 409 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
410 strcpy (dns_server, argv[c++]); 410 strcpy (dns_server, argv[c++]);
411 } 411 }
412 412
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 16e177c..7e4049c 100644
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
@@ -173,16 +173,16 @@ textscan (char *buf)
173 int status = STATE_UNKNOWN; 173 int status = STATE_UNKNOWN;
174 174
175 if (strstr (buf, "not found")) { 175 if (strstr (buf, "not found")) {
176 terminate (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name); 176 die (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
177 177
178 } 178 }
179 else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) { 179 else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
180 terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"), 180 die (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
181 "host"); 181 "host");
182 182
183 } 183 }
184 else if (strstr (buf, "is down")) { 184 else if (strstr (buf, "is down")) {
185 terminate (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name); 185 die (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
186 186
187 } 187 }
188 else if (strstr (buf, "is alive")) { 188 else if (strstr (buf, "is alive")) {
@@ -208,7 +208,7 @@ textscan (char *buf)
208 status = STATE_WARNING; 208 status = STATE_WARNING;
209 else 209 else
210 status = STATE_OK; 210 status = STATE_OK;
211 terminate (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"), 211 die (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
212 state_text (status), server_name, loss, rta); 212 state_text (status), server_name, loss, rta);
213 213
214 } 214 }
@@ -227,7 +227,7 @@ textscan (char *buf)
227 else 227 else
228 status = STATE_OK; 228 status = STATE_OK;
229 229
230 terminate (status, _("FPING %s - %s (loss=%f%% )\n"), 230 die (status, _("FPING %s - %s (loss=%f%% )\n"),
231 state_text (status), server_name, loss ); 231 state_text (status), server_name, loss );
232 232
233 } 233 }
@@ -363,11 +363,11 @@ get_threshold (char *arg, char *rv[2])
363 if (arg2) { 363 if (arg2) {
364 arg1[strcspn (arg1, ",:")] = 0; 364 arg1[strcspn (arg1, ",:")] = 0;
365 if (strstr (arg1, "%") && strstr (arg2, "%")) 365 if (strstr (arg1, "%") && strstr (arg2, "%"))
366 terminate (STATE_UNKNOWN, 366 die (STATE_UNKNOWN,
367 _("%s: Only one threshold may be packet loss (%s)\n"), progname, 367 _("%s: Only one threshold may be packet loss (%s)\n"), progname,
368 arg); 368 arg);
369 if (!strstr (arg1, "%") && !strstr (arg2, "%")) 369 if (!strstr (arg1, "%") && !strstr (arg2, "%"))
370 terminate (STATE_UNKNOWN, 370 die (STATE_UNKNOWN,
371 _("%s: Only one threshold must be packet loss (%s)\n"), 371 _("%s: Only one threshold must be packet loss (%s)\n"),
372 progname, arg); 372 progname, arg);
373 } 373 }
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 811da27..2b10991 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -252,7 +252,7 @@ process_arguments (int argc, char **argv)
252 break; 252 break;
253 case 'H': /* hostname */ 253 case 'H': /* hostname */
254 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH) 254 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
255 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 255 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
256 server_ip = strdup (optarg); 256 server_ip = strdup (optarg);
257 break; 257 break;
258 case 'P': /* port */ 258 case 'P': /* port */
@@ -260,7 +260,7 @@ process_arguments (int argc, char **argv)
260 break; 260 break;
261 case 'G': /* hostname */ 261 case 'G': /* hostname */
262 if (strlen (optarg) >= MAX_INPUT_BUFFER) 262 if (strlen (optarg) >= MAX_INPUT_BUFFER)
263 terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); 263 die (STATE_UNKNOWN, _("Input buffer overflow\n"));
264 game_type = strdup (optarg); 264 game_type = strdup (optarg);
265 break; 265 break;
266 case 'p': /* index of ping field */ 266 case 'p': /* index of ping field */
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 951c764..b5f2a56 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -285,7 +285,7 @@ main (int argc, char **argv)
285#ifdef HAVE_SSL 285#ifdef HAVE_SSL
286 if (use_ssl && check_cert == TRUE) { 286 if (use_ssl && check_cert == TRUE) {
287 if (connect_SSL () != OK) 287 if (connect_SSL () != OK)
288 terminate (STATE_CRITICAL, 288 die (STATE_CRITICAL,
289 _("HTTP CRITICAL - Could not make SSL connection\n")); 289 _("HTTP CRITICAL - Could not make SSL connection\n"));
290 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { 290 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
291 result = check_certificate (&server_cert); 291 result = check_certificate (&server_cert);
@@ -596,7 +596,7 @@ check_http (void)
596 if (use_ssl == TRUE) { 596 if (use_ssl == TRUE) {
597 597
598 if (connect_SSL () != OK) { 598 if (connect_SSL () != OK) {
599 terminate (STATE_CRITICAL, _("Unable to open TCP socket")); 599 die (STATE_CRITICAL, _("Unable to open TCP socket"));
600 } 600 }
601 601
602 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { 602 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
@@ -611,7 +611,7 @@ check_http (void)
611 else { 611 else {
612#endif 612#endif
613 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) 613 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
614 terminate (STATE_CRITICAL, _("Unable to open TCP socket")); 614 die (STATE_CRITICAL, _("Unable to open TCP socket"));
615#ifdef HAVE_SSL 615#ifdef HAVE_SSL
616 } 616 }
617#endif 617#endif
@@ -669,14 +669,14 @@ check_http (void)
669 if (use_ssl) { 669 if (use_ssl) {
670 sslerr=SSL_get_error(ssl, i); 670 sslerr=SSL_get_error(ssl, i);
671 if ( sslerr == SSL_ERROR_SSL ) { 671 if ( sslerr == SSL_ERROR_SSL ) {
672 terminate (STATE_WARNING, _("Client Certificate Required\n")); 672 die (STATE_WARNING, _("Client Certificate Required\n"));
673 } else { 673 } else {
674 terminate (STATE_CRITICAL, _("Error in recv()")); 674 die (STATE_CRITICAL, _("Error in recv()"));
675 } 675 }
676 } 676 }
677 else { 677 else {
678#endif 678#endif
679 terminate (STATE_CRITICAL, _("Error in recv()")); 679 die (STATE_CRITICAL, _("Error in recv()"));
680#ifdef HAVE_SSL 680#ifdef HAVE_SSL
681 } 681 }
682#endif 682#endif
@@ -684,7 +684,7 @@ check_http (void)
684 684
685 /* return a CRITICAL status if we couldn't read any data */ 685 /* return a CRITICAL status if we couldn't read any data */
686 if (pagesize == (size_t) 0) 686 if (pagesize == (size_t) 0)
687 terminate (STATE_CRITICAL, _("No data received %s"), timestamp); 687 die (STATE_CRITICAL, _("No data received %s"), timestamp);
688 688
689 /* close the connection */ 689 /* close the connection */
690 my_close (); 690 my_close ();
@@ -708,7 +708,7 @@ check_http (void)
708 if (verbose) 708 if (verbose)
709 printf ("STATUS: %s\n", status_line); 709 printf ("STATUS: %s\n", status_line);
710 710
711 /* find header info and null terminate it */ 711 /* find header info and null-terminate it */
712 header = page; 712 header = page;
713 while (strcspn (page, "\r\n") > 0) { 713 while (strcspn (page, "\r\n") > 0) {
714 page += (size_t) strcspn (page, "\r\n"); 714 page += (size_t) strcspn (page, "\r\n");
@@ -732,7 +732,7 @@ check_http (void)
732 asprintf (&msg, 732 asprintf (&msg,
733 _("Invalid HTTP response received from host on port %d\n"), 733 _("Invalid HTTP response received from host on port %d\n"),
734 server_port); 734 server_port);
735 terminate (STATE_CRITICAL, msg); 735 die (STATE_CRITICAL, msg);
736 } 736 }
737 737
738 738
@@ -753,7 +753,7 @@ check_http (void)
753 strstr (status_line, "501") || 753 strstr (status_line, "501") ||
754 strstr (status_line, "502") || 754 strstr (status_line, "502") ||
755 strstr (status_line, "503")) { 755 strstr (status_line, "503")) {
756 terminate (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line); 756 die (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line);
757 } 757 }
758 758
759 /* client errors result in a warning state */ 759 /* client errors result in a warning state */
@@ -762,7 +762,7 @@ check_http (void)
762 strstr (status_line, "402") || 762 strstr (status_line, "402") ||
763 strstr (status_line, "403") || 763 strstr (status_line, "403") ||
764 strstr (status_line, "404")) { 764 strstr (status_line, "404")) {
765 terminate (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line); 765 die (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line);
766 } 766 }
767 767
768 /* check redirected page if specified */ 768 /* check redirected page if specified */
@@ -778,12 +778,12 @@ check_http (void)
778 while (pos) { 778 while (pos) {
779 server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH + 1); 779 server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH + 1);
780 if (server_address == NULL) 780 if (server_address == NULL)
781 terminate (STATE_UNKNOWN, 781 die (STATE_UNKNOWN,
782 _("HTTP UNKNOWN: could not allocate server_address")); 782 _("HTTP UNKNOWN: could not allocate server_address"));
783 if (strcspn (pos, "\r\n") > (size_t)server_url_length) { 783 if (strcspn (pos, "\r\n") > (size_t)server_url_length) {
784 server_url = realloc (server_url, strcspn (pos, "\r\n")); 784 server_url = realloc (server_url, strcspn (pos, "\r\n"));
785 if (server_url == NULL) 785 if (server_url == NULL)
786 terminate (STATE_UNKNOWN, 786 die (STATE_UNKNOWN,
787 _("HTTP UNKNOWN: could not allocate server_url")); 787 _("HTTP UNKNOWN: could not allocate server_url"));
788 server_url_length = strcspn (pos, "\r\n"); 788 server_url_length = strcspn (pos, "\r\n");
789 } 789 }
@@ -840,7 +840,7 @@ check_http (void)
840 asprintf (&msg, _(" - %s - %.3f second response time %s%s|time=%.3f\n"), 840 asprintf (&msg, _(" - %s - %.3f second response time %s%s|time=%.3f\n"),
841 status_line, elapsed_time, timestamp, 841 status_line, elapsed_time, timestamp,
842 (display_html ? "</A>" : ""), elapsed_time); 842 (display_html ? "</A>" : ""), elapsed_time);
843 terminate (onredirect, msg); 843 die (onredirect, msg);
844 } /* end if (strstr (status_line, "30[0-4]") */ 844 } /* end if (strstr (status_line, "30[0-4]") */
845 845
846 846
@@ -853,9 +853,9 @@ check_http (void)
853 status_line, elapsed_time, timestamp, 853 status_line, elapsed_time, timestamp,
854 (display_html ? "</A>" : ""), elapsed_time); 854 (display_html ? "</A>" : ""), elapsed_time);
855 if (check_critical_time == TRUE && elapsed_time > critical_time) 855 if (check_critical_time == TRUE && elapsed_time > critical_time)
856 terminate (STATE_CRITICAL, msg); 856 die (STATE_CRITICAL, msg);
857 if (check_warning_time == TRUE && elapsed_time > warning_time) 857 if (check_warning_time == TRUE && elapsed_time > warning_time)
858 terminate (STATE_WARNING, msg); 858 die (STATE_WARNING, msg);
859 859
860 /* Page and Header content checks go here */ 860 /* Page and Header content checks go here */
861 /* these checks should be last */ 861 /* these checks should be last */
@@ -908,7 +908,7 @@ check_http (void)
908 asprintf (&msg, _("HTTP OK %s - %.3f second response time %s%s|time=%.3f\n"), 908 asprintf (&msg, _("HTTP OK %s - %.3f second response time %s%s|time=%.3f\n"),
909 status_line, (float)elapsed_time, 909 status_line, (float)elapsed_time,
910 timestamp, (display_html ? "</A>" : ""), elapsed_time); 910 timestamp, (display_html ? "</A>" : ""), elapsed_time);
911 terminate (STATE_OK, msg); 911 die (STATE_OK, msg);
912 return STATE_UNKNOWN; 912 return STATE_UNKNOWN;
913} 913}
914 914
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 88c8e49..2a9958d 100644
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
@@ -304,7 +304,7 @@ process_arguments (int argc, char **argv)
304 if (is_intpos (argv[c])) 304 if (is_intpos (argv[c]))
305 expire_minutes = atoi (argv[c++]); 305 expire_minutes = atoi (argv[c++]);
306 else 306 else
307 terminate (STATE_UNKNOWN, 307 die (STATE_UNKNOWN,
308 _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"), 308 _("%s is not a valid expiration time\nUse '%s -h' for additional help\n"),
309 argv[c], progname); 309 argv[c], progname);
310 } 310 }
diff --git a/plugins/check_mrtgtraf.c b/plugins/check_mrtgtraf.c
index c99e421..ce9ab19 100644
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
@@ -163,7 +163,7 @@ main (int argc, char **argv)
163 time (&current_time); 163 time (&current_time);
164 if (expire_minutes > 0 164 if (expire_minutes > 0
165 && (current_time - timestamp) > 165 && (current_time - timestamp) >
166 (expire_minutes * 60)) terminate (STATE_WARNING, 166 (expire_minutes * 60)) die (STATE_WARNING,
167 _("MRTG data has expired (%d minutes old)\n"), 167 _("MRTG data has expired (%d minutes old)\n"),
168 (int) ((current_time - timestamp) / 168 (int) ((current_time - timestamp) /
169 60)); 169 60));
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index 7ae0ff8..a678e2a 100644
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
@@ -217,7 +217,7 @@ process_arguments (int argc, char **argv)
217 if (is_intnonneg (argv[2])) 217 if (is_intnonneg (argv[2]))
218 expire_minutes = atoi (argv[2]); 218 expire_minutes = atoi (argv[2]);
219 else 219 else
220 terminate (STATE_UNKNOWN, 220 die (STATE_UNKNOWN,
221 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"), 221 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
222 progname); 222 progname);
223 process_string = argv[3]; 223 process_string = argv[3];
@@ -251,7 +251,7 @@ process_arguments (int argc, char **argv)
251 if (is_intnonneg (optarg)) 251 if (is_intnonneg (optarg))
252 expire_minutes = atoi (optarg); 252 expire_minutes = atoi (optarg);
253 else 253 else
254 terminate (STATE_UNKNOWN, 254 die (STATE_UNKNOWN,
255 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"), 255 _("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
256 progname); 256 progname);
257 break; 257 break;
@@ -263,11 +263,11 @@ process_arguments (int argc, char **argv)
263 263
264 264
265 if (status_log == NULL) 265 if (status_log == NULL)
266 terminate (STATE_UNKNOWN, 266 die (STATE_UNKNOWN,
267 _("You must provide the status_log\nType '%s -h' for additional help\n"), 267 _("You must provide the status_log\nType '%s -h' for additional help\n"),
268 progname); 268 progname);
269 else if (process_string == NULL) 269 else if (process_string == NULL)
270 terminate (STATE_UNKNOWN, 270 die (STATE_UNKNOWN,
271 _("You must provide a process string\nType '%s -h' for additional help\n"), 271 _("You must provide a process string\nType '%s -h' for additional help\n"),
272 progname); 272 progname);
273 273
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 9652fa6..85c6753 100644
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
@@ -448,7 +448,7 @@ int process_arguments(int argc, char **argv){
448 if (is_intnonneg(optarg)) 448 if (is_intnonneg(optarg))
449 server_port=atoi(optarg); 449 server_port=atoi(optarg);
450 else 450 else
451 terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname); 451 die(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname);
452 break; 452 break;
453 case 'v': 453 case 'v':
454 if(strlen(optarg)<4) 454 if(strlen(optarg)<4)
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 94f0543..de8a620 100644
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
@@ -763,7 +763,7 @@ int process_arguments(int argc, char **argv) {
763 if (is_intnonneg(optarg)) 763 if (is_intnonneg(optarg))
764 server_port=atoi(optarg); 764 server_port=atoi(optarg);
765 else 765 else
766 terminate(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname); 766 die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
767 break; 767 break;
768 case 'v': 768 case 'v':
769 if (strlen(optarg)<3) 769 if (strlen(optarg)<3)
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 4ee47a5..5f50ca7 100644
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.c
@@ -101,21 +101,21 @@ main (int argc, char **argv)
101 case LOAD15: 101 case LOAD15:
102 102
103 if (result != STATE_OK) 103 if (result != STATE_OK)
104 terminate (result, _("Unknown error fetching load data\n")); 104 die (result, _("Unknown error fetching load data\n"));
105 105
106 temp_ptr = (char *) strtok (recv_buffer, "\r\n"); 106 temp_ptr = (char *) strtok (recv_buffer, "\r\n");
107 if (temp_ptr == NULL) 107 if (temp_ptr == NULL)
108 terminate (STATE_CRITICAL, _("Invalid response from server - no load information\n")); 108 die (STATE_CRITICAL, _("Invalid response from server - no load information\n"));
109 load_1min = strtod (temp_ptr, NULL); 109 load_1min = strtod (temp_ptr, NULL);
110 110
111 temp_ptr = (char *) strtok (NULL, "\r\n"); 111 temp_ptr = (char *) strtok (NULL, "\r\n");
112 if (temp_ptr == NULL) 112 if (temp_ptr == NULL)
113 terminate (STATE_CRITICAL, _("Invalid response from server after load 1\n")); 113 die (STATE_CRITICAL, _("Invalid response from server after load 1\n"));
114 load_5min = strtod (temp_ptr, NULL); 114 load_5min = strtod (temp_ptr, NULL);
115 115
116 temp_ptr = (char *) strtok (NULL, "\r\n"); 116 temp_ptr = (char *) strtok (NULL, "\r\n");
117 if (temp_ptr == NULL) 117 if (temp_ptr == NULL)
118 terminate (STATE_CRITICAL, _("Invalid response from server after load 5\n")); 118 die (STATE_CRITICAL, _("Invalid response from server after load 5\n"));
119 load_15min = strtod (temp_ptr, NULL); 119 load_15min = strtod (temp_ptr, NULL);
120 120
121 switch (vars_to_check) { 121 switch (vars_to_check) {
@@ -138,7 +138,7 @@ main (int argc, char **argv)
138 else if (check_warning_value == TRUE && (load >= warning_value)) 138 else if (check_warning_value == TRUE && (load >= warning_value))
139 result = STATE_WARNING; 139 result = STATE_WARNING;
140 140
141 terminate (result, 141 die (result,
142 _("Load %s - %s-min load average = %0.2f"), 142 _("Load %s - %s-min load average = %0.2f"),
143 state_text(result), 143 state_text(result),
144 temp_buffer, 144 temp_buffer,
@@ -149,7 +149,7 @@ main (int argc, char **argv)
149 case DPU: 149 case DPU:
150 150
151 if (result != STATE_OK) 151 if (result != STATE_OK)
152 terminate (result, _("Unknown error fetching disk data\n")); 152 die (result, _("Unknown error fetching disk data\n"));
153 153
154 for (temp_ptr = (char *) strtok (recv_buffer, " "); 154 for (temp_ptr = (char *) strtok (recv_buffer, " ");
155 temp_ptr != NULL; 155 temp_ptr != NULL;
@@ -159,7 +159,7 @@ main (int argc, char **argv)
159 found_disk = TRUE; 159 found_disk = TRUE;
160 temp_ptr = (char *) strtok (NULL, "%"); 160 temp_ptr = (char *) strtok (NULL, "%");
161 if (temp_ptr == NULL) 161 if (temp_ptr == NULL)
162 terminate (STATE_CRITICAL, _("Invalid response from server\n")); 162 die (STATE_CRITICAL, _("Invalid response from server\n"));
163 percent_used_disk_space = strtoul (temp_ptr, NULL, 10); 163 percent_used_disk_space = strtoul (temp_ptr, NULL, 10);
164 break; 164 break;
165 } 165 }
@@ -169,7 +169,7 @@ main (int argc, char **argv)
169 169
170 /* error if we couldn't find the info for the disk */ 170 /* error if we couldn't find the info for the disk */
171 if (found_disk == FALSE) 171 if (found_disk == FALSE)
172 terminate (STATE_CRITICAL, 172 die (STATE_CRITICAL,
173 "Error: Disk '%s' non-existent or not mounted", 173 "Error: Disk '%s' non-existent or not mounted",
174 disk_name); 174 disk_name);
175 175
@@ -178,14 +178,14 @@ main (int argc, char **argv)
178 else if (check_warning_value == TRUE && (percent_used_disk_space >= warning_value)) 178 else if (check_warning_value == TRUE && (percent_used_disk_space >= warning_value))
179 result = STATE_WARNING; 179 result = STATE_WARNING;
180 180
181 terminate (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name); 181 die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name);
182 182
183 break; 183 break;
184 184
185 case NETSTAT: 185 case NETSTAT:
186 186
187 if (result != STATE_OK) 187 if (result != STATE_OK)
188 terminate (result, _("Unknown error fetching network status\n")); 188 die (result, _("Unknown error fetching network status\n"));
189 189
190 port_connections = strtod (recv_buffer, NULL); 190 port_connections = strtod (recv_buffer, NULL);
191 191
@@ -194,7 +194,7 @@ main (int argc, char **argv)
194 else if (check_warning_value == TRUE && (port_connections >= warning_value)) 194 else if (check_warning_value == TRUE && (port_connections >= warning_value))
195 result = STATE_WARNING; 195 result = STATE_WARNING;
196 196
197 terminate (result, 197 die (result,
198 _("Net %s - %d connection%s on port %d"), 198 _("Net %s - %d connection%s on port %d"),
199 state_text(result), 199 state_text(result),
200 port_connections, 200 port_connections,
@@ -206,15 +206,15 @@ main (int argc, char **argv)
206 case PROCS: 206 case PROCS:
207 207
208 if (result != STATE_OK) 208 if (result != STATE_OK)
209 terminate (result, _("Unknown error fetching process status\n")); 209 die (result, _("Unknown error fetching process status\n"));
210 210
211 temp_ptr = (char *) strtok (recv_buffer, "("); 211 temp_ptr = (char *) strtok (recv_buffer, "(");
212 if (temp_ptr == NULL) 212 if (temp_ptr == NULL)
213 terminate (STATE_CRITICAL, _("Invalid response from server\n")); 213 die (STATE_CRITICAL, _("Invalid response from server\n"));
214 214
215 temp_ptr = (char *) strtok (NULL, ")"); 215 temp_ptr = (char *) strtok (NULL, ")");
216 if (temp_ptr == NULL) 216 if (temp_ptr == NULL)
217 terminate (STATE_CRITICAL, _("Invalid response from server\n")); 217 die (STATE_CRITICAL, _("Invalid response from server\n"));
218 218
219 processes = strtod (temp_ptr, NULL); 219 processes = strtod (temp_ptr, NULL);
220 220
@@ -223,7 +223,7 @@ main (int argc, char **argv)
223 else if (check_warning_value == TRUE && (processes >= warning_value)) 223 else if (check_warning_value == TRUE && (processes >= warning_value))
224 result = STATE_WARNING; 224 result = STATE_WARNING;
225 225
226 terminate (result, 226 die (result,
227 _("Process %s - %d instance%s of %s running"), 227 _("Process %s - %d instance%s of %s running"),
228 state_text(result), 228 state_text(result),
229 processes, 229 processes,
@@ -250,7 +250,7 @@ main (int argc, char **argv)
250 uptime_raw_minutes %= 60; 250 uptime_raw_minutes %= 60;
251 uptime_minutes = uptime_raw_minutes; 251 uptime_minutes = uptime_raw_minutes;
252 252
253 terminate (result, 253 die (result,
254 _("Uptime %s - Up %d days %d hours %d minutes"), 254 _("Uptime %s - Up %d days %d hours %d minutes"),
255 state_text(result), 255 state_text(result),
256 uptime_days, 256 uptime_days,
@@ -259,7 +259,7 @@ main (int argc, char **argv)
259 break; 259 break;
260 260
261 default: 261 default:
262 terminate (STATE_UNKNOWN, _("Nothing to check!\n")); 262 die (STATE_UNKNOWN, _("Nothing to check!\n"));
263 break; 263 break;
264 } 264 }
265 265
@@ -340,7 +340,7 @@ process_arguments (int argc, char **argv)
340 if (is_intnonneg (optarg)) 340 if (is_intnonneg (optarg))
341 server_port = atoi (optarg); 341 server_port = atoi (optarg);
342 else 342 else
343 terminate (STATE_UNKNOWN, 343 die (STATE_UNKNOWN,
344 _("Server port an integer (seconds)\nType '%s -h' for additional help\n"), 344 _("Server port an integer (seconds)\nType '%s -h' for additional help\n"),
345 progname); 345 progname);
346 break; 346 break;
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 3aa5ae7..714de58 100644
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
@@ -165,14 +165,14 @@ main (int argc, char **argv)
165 165
166 if ((config_file && rc_read_config (config_file)) || 166 if ((config_file && rc_read_config (config_file)) ||
167 rc_read_dictionary (rc_conf_str ("dictionary"))) 167 rc_read_dictionary (rc_conf_str ("dictionary")))
168 terminate (STATE_UNKNOWN, _("Config file error")); 168 die (STATE_UNKNOWN, _("Config file error"));
169 169
170 service = PW_AUTHENTICATE_ONLY; 170 service = PW_AUTHENTICATE_ONLY;
171 171
172 if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) && 172 if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
173 rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) && 173 rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
174 rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0))) 174 rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)))
175 terminate (STATE_UNKNOWN, _("Out of Memory?")); 175 die (STATE_UNKNOWN, _("Out of Memory?"));
176 176
177 /* 177 /*
178 * Fill in NAS-IP-Address 178 * Fill in NAS-IP-Address
@@ -193,15 +193,15 @@ main (int argc, char **argv)
193 rc_avpair_free (data.receive_pairs); 193 rc_avpair_free (data.receive_pairs);
194 194
195 if (result == TIMEOUT_RC) 195 if (result == TIMEOUT_RC)
196 terminate (STATE_CRITICAL, _("Timeout")); 196 die (STATE_CRITICAL, _("Timeout"));
197 if (result == ERROR_RC) 197 if (result == ERROR_RC)
198 terminate (STATE_CRITICAL, _("Auth Error")); 198 die (STATE_CRITICAL, _("Auth Error"));
199 if (result == BADRESP_RC) 199 if (result == BADRESP_RC)
200 terminate (STATE_WARNING, _("Auth Failed")); 200 die (STATE_WARNING, _("Auth Failed"));
201 if (expect && !strstr (msg, expect)) 201 if (expect && !strstr (msg, expect))
202 terminate (STATE_WARNING, msg); 202 die (STATE_WARNING, msg);
203 if (result == OK_RC) 203 if (result == OK_RC)
204 terminate (STATE_OK, _("Auth OK")); 204 die (STATE_OK, _("Auth OK"));
205 return (0); 205 return (0);
206} 206}
207 207
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 1744b32..875f9c4 100644
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
@@ -91,7 +91,7 @@ main (int argc, char **argv)
91 91
92 /* try to connect to the host at the given port number */ 92 /* try to connect to the host at the given port number */
93 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) 93 if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
94 terminate (STATE_CRITICAL, "Unable to connect to %s on port %d\n", 94 die (STATE_CRITICAL, "Unable to connect to %s on port %d\n",
95 server_address, server_port); 95 server_address, server_port);
96 96
97 /* Part I - Server Check */ 97 /* Part I - Server Check */
@@ -113,7 +113,7 @@ main (int argc, char **argv)
113 113
114 /* return a CRITICAL status if we couldn't read any data */ 114 /* return a CRITICAL status if we couldn't read any data */
115 if (result == -1) 115 if (result == -1)
116 terminate (STATE_CRITICAL, "No data received from %s\n", host_name); 116 die (STATE_CRITICAL, "No data received from %s\n", host_name);
117 117
118 /* make sure we find the response we are looking for */ 118 /* make sure we find the response we are looking for */
119 if (!strstr (buffer, server_expect)) { 119 if (!strstr (buffer, server_expect)) {
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 68ffaf5..2e2430d 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -361,7 +361,7 @@ main (int argc, char **argv)
361 eval_method[i] & WARN_NE) { 361 eval_method[i] & WARN_NE) {
362 p2 = strpbrk (p2, "0123456789"); 362 p2 = strpbrk (p2, "0123456789");
363 if (p2 == NULL) 363 if (p2 == NULL)
364 terminate (STATE_UNKNOWN,"No valid data returned"); 364 die (STATE_UNKNOWN,"No valid data returned");
365 response_value[i] = strtoul (p2, NULL, 10); 365 response_value[i] = strtoul (p2, NULL, 10);
366 iresult = check_num (i); 366 iresult = check_num (i);
367 asprintf (&show, "%lu", response_value[i]); 367 asprintf (&show, "%lu", response_value[i]);
@@ -427,7 +427,7 @@ main (int argc, char **argv)
427 } /* end while (ptr) */ 427 } /* end while (ptr) */
428 428
429 if (found == 0) 429 if (found == 0)
430 terminate 430 die
431 (STATE_UNKNOWN, 431 (STATE_UNKNOWN,
432 _("%s problem - No data recieved from host\nCMD: %s\n"), 432 _("%s problem - No data recieved from host\nCMD: %s\n"),
433 label, command_line); 433 label, command_line);
@@ -643,7 +643,7 @@ process_arguments (int argc, char **argv)
643 labels_size += 8; 643 labels_size += 8;
644 labels = realloc (labels, labels_size); 644 labels = realloc (labels, labels_size);
645 if (labels == NULL) 645 if (labels == NULL)
646 terminate (STATE_UNKNOWN, 646 die (STATE_UNKNOWN,
647 _("Could not realloc() labels[%d]"), nlabels); 647 _("Could not realloc() labels[%d]"), nlabels);
648 } 648 }
649 labels[nlabels - 1] = optarg; 649 labels[nlabels - 1] = optarg;
@@ -657,7 +657,7 @@ process_arguments (int argc, char **argv)
657 labels_size += 8; 657 labels_size += 8;
658 labels = realloc (labels, labels_size); 658 labels = realloc (labels, labels_size);
659 if (labels == NULL) 659 if (labels == NULL)
660 terminate (STATE_UNKNOWN, _("Could not realloc() labels\n")); 660 die (STATE_UNKNOWN, _("Could not realloc() labels\n"));
661 } 661 }
662 labels++; 662 labels++;
663 ptr = thisarg (ptr); 663 ptr = thisarg (ptr);
@@ -674,7 +674,7 @@ process_arguments (int argc, char **argv)
674 unitv_size += 8; 674 unitv_size += 8;
675 unitv = realloc (unitv, unitv_size); 675 unitv = realloc (unitv, unitv_size);
676 if (unitv == NULL) 676 if (unitv == NULL)
677 terminate (STATE_UNKNOWN, 677 die (STATE_UNKNOWN,
678 _("Could not realloc() units [%d]\n"), nunits); 678 _("Could not realloc() units [%d]\n"), nunits);
679 } 679 }
680 unitv[nunits - 1] = optarg; 680 unitv[nunits - 1] = optarg;
@@ -688,7 +688,7 @@ process_arguments (int argc, char **argv)
688 unitv_size += 8; 688 unitv_size += 8;
689 unitv = realloc (unitv, unitv_size); 689 unitv = realloc (unitv, unitv_size);
690 if (units == NULL) 690 if (units == NULL)
691 terminate (STATE_UNKNOWN, _("Could not realloc() units\n")); 691 die (STATE_UNKNOWN, _("Could not realloc() units\n"));
692 } 692 }
693 nunits++; 693 nunits++;
694 ptr = thisarg (ptr); 694 ptr = thisarg (ptr);
@@ -905,7 +905,7 @@ thisarg (char *str)
905 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */ 905 str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
906 if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */ 906 if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */
907 if (strlen (str) == 1 || !strstr (str + 1, "'")) 907 if (strlen (str) == 1 || !strstr (str + 1, "'"))
908 terminate (STATE_UNKNOWN, "Unbalanced quotes\n"); 908 die (STATE_UNKNOWN, "Unbalanced quotes\n");
909 } 909 }
910 return str; 910 return str;
911} 911}
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 65cd899..b92694d 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -225,7 +225,7 @@ main (int argc, char **argv)
225 result = max_state (result, STATE_WARNING); 225 result = max_state (result, STATE_WARNING);
226#endif 226#endif
227 227
228 terminate (result, "SWAP %s:%s\n", state_text (result), status); 228 die (result, "SWAP %s:%s\n", state_text (result), status);
229 return STATE_UNKNOWN; 229 return STATE_UNKNOWN;
230} 230}
231 231
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 32bdae7..a897d8e 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -323,7 +323,7 @@ main (int argc, char **argv)
323 323
324 /* return a CRITICAL status if we couldn't read any data */ 324 /* return a CRITICAL status if we couldn't read any data */
325 if (status == NULL) 325 if (status == NULL)
326 terminate (STATE_CRITICAL, _("No data received from host\n")); 326 die (STATE_CRITICAL, _("No data received from host\n"));
327 327
328 strip (status); 328 strip (status);
329 329
@@ -335,7 +335,7 @@ main (int argc, char **argv)
335 if (verbose) 335 if (verbose)
336 printf ("%d %d\n", i, server_expect_count); 336 printf ("%d %d\n", i, server_expect_count);
337 if (i >= server_expect_count) 337 if (i >= server_expect_count)
338 terminate (STATE_WARNING, _("Invalid response from host\n")); 338 die (STATE_WARNING, _("Invalid response from host\n"));
339 if (strstr (status, server_expect[i])) 339 if (strstr (status, server_expect[i]))
340 break; 340 break;
341 } 341 }
@@ -542,7 +542,7 @@ process_arguments (int argc, char **argv)
542 break; 542 break;
543 case 'S': 543 case 'S':
544#ifndef HAVE_SSL 544#ifndef HAVE_SSL
545 terminate (STATE_UNKNOWN, 545 die (STATE_UNKNOWN,
546 _("SSL support not available. Install OpenSSL and recompile.")); 546 _("SSL support not available. Install OpenSSL and recompile."));
547#endif 547#endif
548 use_ssl = TRUE; 548 use_ssl = TRUE;
diff --git a/plugins/check_time.c b/plugins/check_time.c
index b3210bc..dde6eea 100644
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
@@ -119,7 +119,7 @@ main (int argc, char **argv)
119 result = STATE_WARNING; 119 result = STATE_WARNING;
120 else 120 else
121 result = STATE_UNKNOWN; 121 result = STATE_UNKNOWN;
122 terminate (result, 122 die (result,
123 _("TIME UNKNOWN - could not connect to server %s, port %d\n"), 123 _("TIME UNKNOWN - could not connect to server %s, port %d\n"),
124 server_address, server_port); 124 server_address, server_port);
125 } 125 }
@@ -142,7 +142,7 @@ main (int argc, char **argv)
142 result = STATE_WARNING; 142 result = STATE_WARNING;
143 else 143 else
144 result = STATE_UNKNOWN; 144 result = STATE_UNKNOWN;
145 terminate (result, 145 die (result,
146 _("TIME UNKNOWN - no data on recv() from server %s, port %d\n"), 146 _("TIME UNKNOWN - no data on recv() from server %s, port %d\n"),
147 server_address, server_port); 147 server_address, server_port);
148 } 148 }
@@ -155,7 +155,7 @@ main (int argc, char **argv)
155 && (end_time - start_time) > warning_time) result = STATE_WARNING; 155 && (end_time - start_time) > warning_time) result = STATE_WARNING;
156 156
157 if (result != STATE_OK) 157 if (result != STATE_OK)
158 terminate (result, _("TIME %s - %d second response time\n"), 158 die (result, _("TIME %s - %d second response time\n"),
159 state_text (result), (int) (end_time - start_time)); 159 state_text (result), (int) (end_time - start_time));
160 160
161 server_time = ntohl (raw_server_time) - UNIX_EPOCH; 161 server_time = ntohl (raw_server_time) - UNIX_EPOCH;
diff --git a/plugins/negate.c b/plugins/negate.c
index faf81b3..3ef5ee7 100644
--- a/plugins/negate.c
+++ b/plugins/negate.c
@@ -138,13 +138,13 @@ main (int argc, char **argv)
138 138
139 /* Set signal handling and alarm */ 139 /* Set signal handling and alarm */
140 if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) 140 if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
141 terminate (STATE_UNKNOWN, _("Cannot catch SIGALRM")); 141 die (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
142 142
143 (void) alarm ((unsigned) timeout_interval); 143 (void) alarm ((unsigned) timeout_interval);
144 144
145 child_process = spopen (command_line); 145 child_process = spopen (command_line);
146 if (child_process == NULL) 146 if (child_process == NULL)
147 terminate (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line); 147 die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line);
148 148
149 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 149 child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
150 if (child_stderr == NULL) { 150 if (child_stderr == NULL) {
@@ -163,7 +163,7 @@ main (int argc, char **argv)
163 } 163 }
164 164
165 if (!found) 165 if (!found)
166 terminate (STATE_UNKNOWN,\ 166 die (STATE_UNKNOWN,\
167 _("%s problem - No data recieved from host\nCMD: %s\n"),\ 167 _("%s problem - No data recieved from host\nCMD: %s\n"),\
168 argv[0], command_line); 168 argv[0], command_line);
169 169
diff --git a/plugins/netutils.c b/plugins/netutils.c
index ea004bb..4ca3168 100644
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
@@ -211,7 +211,7 @@ process_request (char *server_address, int server_port, int proto,
211 else 211 else
212 recv_buffer[recv_result] = 0; 212 recv_buffer[recv_result] = 0;
213 213
214 /* terminate returned string */ 214 /* die returned string */
215 recv_buffer[recv_size - 1] = 0; 215 recv_buffer[recv_size - 1] = 0;
216 } 216 }
217 217
diff --git a/plugins/popen.c b/plugins/popen.c
index e41ae9a..fb855d7 100644
--- a/plugins/popen.c
+++ b/plugins/popen.c
@@ -264,7 +264,7 @@ static void err_doit (int, const char *, va_list);
264char *pname = NULL; /* caller can set this from argv[0] */ 264char *pname = NULL; /* caller can set this from argv[0] */
265 265
266/* Fatal error related to a system call. 266/* Fatal error related to a system call.
267 * Print a message and terminate. */ 267 * Print a message and die. */
268 268
269void 269void
270err_sys (const char *fmt, ...) 270err_sys (const char *fmt, ...)
diff --git a/plugins/utils.c b/plugins/utils.c
index 5f770a1..959541b 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -132,17 +132,6 @@ void
132die (int result, const char *fmt, ...) 132die (int result, const char *fmt, ...)
133{ 133{
134 va_list ap; 134 va_list ap;
135 printf ("%s %s: ", sizeof (char) + index(progname, '_'), state_text(result));
136 va_start (ap, fmt);
137 vprintf (fmt, ap);
138 va_end (ap);
139 exit (result);
140}
141
142void
143terminate (int result, const char *fmt, ...)
144{
145 va_list ap;
146 va_start (ap, fmt); 135 va_start (ap, fmt);
147 vprintf (fmt, ap); 136 vprintf (fmt, ap);
148 va_end (ap); 137 va_end (ap);
@@ -482,7 +471,7 @@ strpcpy (char *dest, const char *src, const char *str)
482 if (dest == NULL || strlen (dest) < len) 471 if (dest == NULL || strlen (dest) < len)
483 dest = realloc (dest, len + 1); 472 dest = realloc (dest, len + 1);
484 if (dest == NULL) 473 if (dest == NULL)
485 terminate (STATE_UNKNOWN, "failed realloc in strpcpy\n"); 474 die (STATE_UNKNOWN, "failed realloc in strpcpy\n");
486 475
487 strncpy (dest, src, len); 476 strncpy (dest, src, len);
488 dest[len] = '\0'; 477 dest[len] = '\0';
@@ -526,7 +515,7 @@ strpcat (char *dest, const char *src, const char *str)
526 515
527 dest = realloc (dest, len + l2 + 1); 516 dest = realloc (dest, len + l2 + 1);
528 if (dest == NULL) 517 if (dest == NULL)
529 terminate (STATE_UNKNOWN, "failed malloc in strscat\n"); 518 die (STATE_UNKNOWN, "failed malloc in strscat\n");
530 519
531 strncpy (dest + len, src, l2); 520 strncpy (dest + len, src, l2);
532 dest[len + l2] = '\0'; 521 dest[len + l2] = '\0';
diff --git a/plugins/utils.h b/plugins/utils.h
index 83793e4..f36834f 100644
--- a/plugins/utils.h
+++ b/plugins/utils.h
@@ -17,7 +17,6 @@ void support (void);
17char *clean_revstring (const char *revstring); 17char *clean_revstring (const char *revstring);
18void print_revision (const char *, const char *); 18void print_revision (const char *, const char *);
19void die (int result, const char *fmt, ...); 19void die (int result, const char *fmt, ...);
20void terminate (int result, const char *msg, ...);
21 20
22/* Handle timeouts */ 21/* Handle timeouts */
23 22