summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f1bb2a)
raw | patch | inline | side by side (parent: 7f1bb2a)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 7 Aug 2003 11:51:12 +0000 (11:51 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 7 Aug 2003 11:51:12 +0000 (11:51 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@656 f882894a-f735-0410-b71e-b25c423dba1c
23 files changed:
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index ae19253fad8853398741e4fd1474bd83da643035..1211daa33d593fd11c3c8153e2085f02679a4e70 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
c = optind;
if (hostname == NULL) {
if (c <= argc) {
- terminate (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname);
+ die (STATE_UNKNOWN, _("%s: You must provide a host name\n"), progname);
} else if (!is_host (argv[c]))
- terminate (STATE_UNKNOWN, _("%s: Invalid host name %s\n"), progname, argv[c]);
+ die (STATE_UNKNOWN, _("%s: Invalid host name %s\n"), progname, argv[c]);
hostname = argv[c++];
}
return ERROR;
if (passive && commands != services)
- terminate (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname);
+ die (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname);
if (passive && host_shortname == NULL)
- terminate (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname);
+ die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname);
return OK;
}
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index c758530e71c33ac5a307ef481d149791186b2903..b0b0d2a5cf0e58491e9494cd113c5e6d4131d9ae 100644 (file)
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
temp_list = temp_list->name_next;
}
- terminate (result, "DISK %s%s\n", state_text (result), output, details);
+ die (result, "DISK %s%s\n", state_text (result), output, details);
return STATE_UNKNOWN;
}
mult = (unsigned long)1024 * 1024 * 1024 * 1024;
units = "TB";
} else {
- terminate (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
+ die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
}
break;
case 'k': /* display mountpoint */
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index eae5880e5aec40b9f1d8300b78ed0a1e6b37050f..8b3bb4f6addfd21b4edadba0432bd8d0ff084dfd 100644 (file)
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
address = strdup (temp_buffer);
strip (address);
if (address==NULL || strlen(address)==0)
- terminate (STATE_CRITICAL,
+ die (STATE_CRITICAL,
_("DNS CRITICAL - '%s' returned empty host name string\n"),
NSLOOKUP_COMMAND);
result = STATE_OK;
/* If we got here, we should have an address string,
and we can segfault if we do not */
if (address==NULL || strlen(address)==0)
- terminate (STATE_CRITICAL,
+ die (STATE_CRITICAL,
_("DNS CRITICAL - '%s' output parsing exited with no address\n"),
NSLOOKUP_COMMAND);
/* DNS server is not running... */
else if (strstr (input_buffer, "No response from server"))
- terminate (STATE_CRITICAL, _("No response from name server %s\n"), dns_server);
+ die (STATE_CRITICAL, _("No response from name server %s\n"), dns_server);
/* Host name is valid, but server doesn't have records... */
else if (strstr (input_buffer, "No records"))
- terminate (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server);
+ die (STATE_CRITICAL, _("Name server %s has no records\n"), dns_server);
/* Connection was refused */
else if (strstr (input_buffer, "Connection refused") ||
(strstr (input_buffer, "** server can't find") &&
strstr (input_buffer, ": REFUSED")) ||
(strstr (input_buffer, "Refused")))
- terminate (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server);
+ die (STATE_CRITICAL, _("Connection to name server %s was refused\n"), dns_server);
/* Host or domain name does not exist */
else if (strstr (input_buffer, "Non-existent") ||
strstr (input_buffer, "** server can't find") ||
strstr (input_buffer,"NXDOMAIN"))
- terminate (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
+ die (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
/* Network is unreachable */
else if (strstr (input_buffer, "Network is unreachable"))
- terminate (STATE_CRITICAL, _("Network is unreachable\n"));
+ die (STATE_CRITICAL, _("Network is unreachable\n"));
/* Internal server failure */
else if (strstr (input_buffer, "Server failure"))
- terminate (STATE_CRITICAL, _("Server failure for %s\n"), dns_server);
+ die (STATE_CRITICAL, _("Server failure for %s\n"), dns_server);
/* Request error or the DNS lookup timed out */
else if (strstr (input_buffer, "Format error") ||
break;
case 'H': /* hostname */
if (strlen (optarg) >= ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (query_address, optarg);
break;
case 's': /* server name */
exit (STATE_UNKNOWN);
}
if (strlen (optarg) >= ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (dns_server, optarg);
break;
case 'r': /* reverse server name */
exit (STATE_UNKNOWN);
}
if (strlen (optarg) >= ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (ptr_server, optarg);
break;
case 'a': /* expected address */
if (strlen (optarg) >= ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (expected_address, optarg);
match_expected_address = TRUE;
break;
c = optind;
if (strlen(query_address)==0 && c<argc) {
if (strlen(argv[c])>=ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (query_address, argv[c++]);
}
return ERROR;
}
if (strlen(argv[c]) >= ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (dns_server, argv[c++]);
}
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 16e177cec2cdf2efe80dcf72768614927a213a3c..7e4049c8189c8d9e313fdec49598e83cebeaaf06 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
int status = STATE_UNKNOWN;
if (strstr (buf, "not found")) {
- terminate (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
+ die (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
}
else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
- terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
+ die (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
"host");
}
else if (strstr (buf, "is down")) {
- terminate (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
+ die (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
}
else if (strstr (buf, "is alive")) {
status = STATE_WARNING;
else
status = STATE_OK;
- terminate (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
+ die (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
state_text (status), server_name, loss, rta);
}
else
status = STATE_OK;
- terminate (status, _("FPING %s - %s (loss=%f%% )\n"),
+ die (status, _("FPING %s - %s (loss=%f%% )\n"),
state_text (status), server_name, loss );
}
if (arg2) {
arg1[strcspn (arg1, ",:")] = 0;
if (strstr (arg1, "%") && strstr (arg2, "%"))
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("%s: Only one threshold may be packet loss (%s)\n"), progname,
arg);
if (!strstr (arg1, "%") && !strstr (arg2, "%"))
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("%s: Only one threshold must be packet loss (%s)\n"),
progname, arg);
}
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 811da2706e78572a636e6b71b262c451967b9bb5..2b10991505794c7e88fe0cf94851c481547cb6bb 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
break;
case 'H': /* hostname */
if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
server_ip = strdup (optarg);
break;
case 'P': /* port */
break;
case 'G': /* hostname */
if (strlen (optarg) >= MAX_INPUT_BUFFER)
- terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
+ die (STATE_UNKNOWN, _("Input buffer overflow\n"));
game_type = strdup (optarg);
break;
case 'p': /* index of ping field */
diff --git a/plugins/check_http.c b/plugins/check_http.c
index 951c76415cec97f48db648ec62a76f1adab1d46e..b5f2a562af4c727af52816993c9be8c76bc2aed4 100644 (file)
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
#ifdef HAVE_SSL
if (use_ssl && check_cert == TRUE) {
if (connect_SSL () != OK)
- terminate (STATE_CRITICAL,
+ die (STATE_CRITICAL,
_("HTTP CRITICAL - Could not make SSL connection\n"));
if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
result = check_certificate (&server_cert);
if (use_ssl == TRUE) {
if (connect_SSL () != OK) {
- terminate (STATE_CRITICAL, _("Unable to open TCP socket"));
+ die (STATE_CRITICAL, _("Unable to open TCP socket"));
}
if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
else {
#endif
if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
- terminate (STATE_CRITICAL, _("Unable to open TCP socket"));
+ die (STATE_CRITICAL, _("Unable to open TCP socket"));
#ifdef HAVE_SSL
}
#endif
if (use_ssl) {
sslerr=SSL_get_error(ssl, i);
if ( sslerr == SSL_ERROR_SSL ) {
- terminate (STATE_WARNING, _("Client Certificate Required\n"));
+ die (STATE_WARNING, _("Client Certificate Required\n"));
} else {
- terminate (STATE_CRITICAL, _("Error in recv()"));
+ die (STATE_CRITICAL, _("Error in recv()"));
}
}
else {
#endif
- terminate (STATE_CRITICAL, _("Error in recv()"));
+ die (STATE_CRITICAL, _("Error in recv()"));
#ifdef HAVE_SSL
}
#endif
/* return a CRITICAL status if we couldn't read any data */
if (pagesize == (size_t) 0)
- terminate (STATE_CRITICAL, _("No data received %s"), timestamp);
+ die (STATE_CRITICAL, _("No data received %s"), timestamp);
/* close the connection */
my_close ();
if (verbose)
printf ("STATUS: %s\n", status_line);
- /* find header info and null terminate it */
+ /* find header info and null-terminate it */
header = page;
while (strcspn (page, "\r\n") > 0) {
page += (size_t) strcspn (page, "\r\n");
asprintf (&msg,
_("Invalid HTTP response received from host on port %d\n"),
server_port);
- terminate (STATE_CRITICAL, msg);
+ die (STATE_CRITICAL, msg);
}
strstr (status_line, "501") ||
strstr (status_line, "502") ||
strstr (status_line, "503")) {
- terminate (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line);
+ die (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line);
}
/* client errors result in a warning state */
strstr (status_line, "402") ||
strstr (status_line, "403") ||
strstr (status_line, "404")) {
- terminate (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line);
+ die (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line);
}
/* check redirected page if specified */
while (pos) {
server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH + 1);
if (server_address == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("HTTP UNKNOWN: could not allocate server_address"));
if (strcspn (pos, "\r\n") > (size_t)server_url_length) {
server_url = realloc (server_url, strcspn (pos, "\r\n"));
if (server_url == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("HTTP UNKNOWN: could not allocate server_url"));
server_url_length = strcspn (pos, "\r\n");
}
asprintf (&msg, _(" - %s - %.3f second response time %s%s|time=%.3f\n"),
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""), elapsed_time);
- terminate (onredirect, msg);
+ die (onredirect, msg);
} /* end if (strstr (status_line, "30[0-4]") */
status_line, elapsed_time, timestamp,
(display_html ? "</A>" : ""), elapsed_time);
if (check_critical_time == TRUE && elapsed_time > critical_time)
- terminate (STATE_CRITICAL, msg);
+ die (STATE_CRITICAL, msg);
if (check_warning_time == TRUE && elapsed_time > warning_time)
- terminate (STATE_WARNING, msg);
+ die (STATE_WARNING, msg);
/* Page and Header content checks go here */
/* these checks should be last */
asprintf (&msg, _("HTTP OK %s - %.3f second response time %s%s|time=%.3f\n"),
status_line, (float)elapsed_time,
timestamp, (display_html ? "</A>" : ""), elapsed_time);
- terminate (STATE_OK, msg);
+ die (STATE_OK, msg);
return STATE_UNKNOWN;
}
diff --git a/plugins/check_mrtg.c b/plugins/check_mrtg.c
index 88c8e49074376312f310a174deea0e0bdb83148b..2a9958d0be77455a8895520c88cbd87c10375980 100644 (file)
--- a/plugins/check_mrtg.c
+++ b/plugins/check_mrtg.c
if (is_intpos (argv[c]))
expire_minutes = atoi (argv[c++]);
else
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("%s is not a valid expiration time\nUse '%s -h' for additional help\n"),
argv[c], progname);
}
index c99e421394a98bae412433cd2019270584487500..ce9ab19184b24a69f5de3998840802cab9aff09a 100644 (file)
--- a/plugins/check_mrtgtraf.c
+++ b/plugins/check_mrtgtraf.c
time (¤t_time);
if (expire_minutes > 0
&& (current_time - timestamp) >
- (expire_minutes * 60)) terminate (STATE_WARNING,
+ (expire_minutes * 60)) die (STATE_WARNING,
_("MRTG data has expired (%d minutes old)\n"),
(int) ((current_time - timestamp) /
60));
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c
index 7ae0ff855dcdada5bc6b762046c442bc3b66ceee..a678e2a4e8f2d975e85cf7a70d8465c6aefe13b1 100644 (file)
--- a/plugins/check_nagios.c
+++ b/plugins/check_nagios.c
if (is_intnonneg (argv[2]))
expire_minutes = atoi (argv[2]);
else
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
progname);
process_string = argv[3];
if (is_intnonneg (optarg))
expire_minutes = atoi (optarg);
else
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
progname);
break;
if (status_log == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("You must provide the status_log\nType '%s -h' for additional help\n"),
progname);
else if (process_string == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("You must provide a process string\nType '%s -h' for additional help\n"),
progname);
diff --git a/plugins/check_nt.c b/plugins/check_nt.c
index 9652fa6b04d322bc70ce3a8d6e1573de80e5ad36..85c67531faabee25d9ea1e9edfb5b35a141410d6 100644 (file)
--- a/plugins/check_nt.c
+++ b/plugins/check_nt.c
if (is_intnonneg(optarg))
server_port=atoi(optarg);
else
- terminate(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname);
+ die(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname);
break;
case 'v':
if(strlen(optarg)<4)
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c
index 94f0543b2c89f92632bed5a43f6de42334179f55..de8a620069aca2bbee411ec48449cfbbdbe66437 100644 (file)
--- a/plugins/check_nwstat.c
+++ b/plugins/check_nwstat.c
if (is_intnonneg(optarg))
server_port=atoi(optarg);
else
- terminate(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
+ die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
break;
case 'v':
if (strlen(optarg)<3)
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c
index 4ee47a519fa99bbf02943aa0075484777a43aeac..5f50ca7ec4c848538ddb3ac4e2cd06b1589990fe 100644 (file)
--- a/plugins/check_overcr.c
+++ b/plugins/check_overcr.c
case LOAD15:
if (result != STATE_OK)
- terminate (result, _("Unknown error fetching load data\n"));
+ die (result, _("Unknown error fetching load data\n"));
temp_ptr = (char *) strtok (recv_buffer, "\r\n");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server - no load information\n"));
+ die (STATE_CRITICAL, _("Invalid response from server - no load information\n"));
load_1min = strtod (temp_ptr, NULL);
temp_ptr = (char *) strtok (NULL, "\r\n");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server after load 1\n"));
+ die (STATE_CRITICAL, _("Invalid response from server after load 1\n"));
load_5min = strtod (temp_ptr, NULL);
temp_ptr = (char *) strtok (NULL, "\r\n");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server after load 5\n"));
+ die (STATE_CRITICAL, _("Invalid response from server after load 5\n"));
load_15min = strtod (temp_ptr, NULL);
switch (vars_to_check) {
else if (check_warning_value == TRUE && (load >= warning_value))
result = STATE_WARNING;
- terminate (result,
+ die (result,
_("Load %s - %s-min load average = %0.2f"),
state_text(result),
temp_buffer,
case DPU:
if (result != STATE_OK)
- terminate (result, _("Unknown error fetching disk data\n"));
+ die (result, _("Unknown error fetching disk data\n"));
for (temp_ptr = (char *) strtok (recv_buffer, " ");
temp_ptr != NULL;
found_disk = TRUE;
temp_ptr = (char *) strtok (NULL, "%");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server\n"));
+ die (STATE_CRITICAL, _("Invalid response from server\n"));
percent_used_disk_space = strtoul (temp_ptr, NULL, 10);
break;
}
/* error if we couldn't find the info for the disk */
if (found_disk == FALSE)
- terminate (STATE_CRITICAL,
+ die (STATE_CRITICAL,
"Error: Disk '%s' non-existent or not mounted",
disk_name);
else if (check_warning_value == TRUE && (percent_used_disk_space >= warning_value))
result = STATE_WARNING;
- terminate (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name);
+ die (result, "Disk %s - %lu%% used on %s", state_text(result), percent_used_disk_space, disk_name);
break;
case NETSTAT:
if (result != STATE_OK)
- terminate (result, _("Unknown error fetching network status\n"));
+ die (result, _("Unknown error fetching network status\n"));
port_connections = strtod (recv_buffer, NULL);
else if (check_warning_value == TRUE && (port_connections >= warning_value))
result = STATE_WARNING;
- terminate (result,
+ die (result,
_("Net %s - %d connection%s on port %d"),
state_text(result),
port_connections,
case PROCS:
if (result != STATE_OK)
- terminate (result, _("Unknown error fetching process status\n"));
+ die (result, _("Unknown error fetching process status\n"));
temp_ptr = (char *) strtok (recv_buffer, "(");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server\n"));
+ die (STATE_CRITICAL, _("Invalid response from server\n"));
temp_ptr = (char *) strtok (NULL, ")");
if (temp_ptr == NULL)
- terminate (STATE_CRITICAL, _("Invalid response from server\n"));
+ die (STATE_CRITICAL, _("Invalid response from server\n"));
processes = strtod (temp_ptr, NULL);
else if (check_warning_value == TRUE && (processes >= warning_value))
result = STATE_WARNING;
- terminate (result,
+ die (result,
_("Process %s - %d instance%s of %s running"),
state_text(result),
processes,
uptime_raw_minutes %= 60;
uptime_minutes = uptime_raw_minutes;
- terminate (result,
+ die (result,
_("Uptime %s - Up %d days %d hours %d minutes"),
state_text(result),
uptime_days,
break;
default:
- terminate (STATE_UNKNOWN, _("Nothing to check!\n"));
+ die (STATE_UNKNOWN, _("Nothing to check!\n"));
break;
}
if (is_intnonneg (optarg))
server_port = atoi (optarg);
else
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),
progname);
break;
diff --git a/plugins/check_radius.c b/plugins/check_radius.c
index 3aa5ae713401df11c9b273bc87bbec061c5d0ac9..714de58c83158c21740a558a7844612cf4017747 100644 (file)
--- a/plugins/check_radius.c
+++ b/plugins/check_radius.c
if ((config_file && rc_read_config (config_file)) ||
rc_read_dictionary (rc_conf_str ("dictionary")))
- terminate (STATE_UNKNOWN, _("Config file error"));
+ die (STATE_UNKNOWN, _("Config file error"));
service = PW_AUTHENTICATE_ONLY;
if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)))
- terminate (STATE_UNKNOWN, _("Out of Memory?"));
+ die (STATE_UNKNOWN, _("Out of Memory?"));
/*
* Fill in NAS-IP-Address
rc_avpair_free (data.receive_pairs);
if (result == TIMEOUT_RC)
- terminate (STATE_CRITICAL, _("Timeout"));
+ die (STATE_CRITICAL, _("Timeout"));
if (result == ERROR_RC)
- terminate (STATE_CRITICAL, _("Auth Error"));
+ die (STATE_CRITICAL, _("Auth Error"));
if (result == BADRESP_RC)
- terminate (STATE_WARNING, _("Auth Failed"));
+ die (STATE_WARNING, _("Auth Failed"));
if (expect && !strstr (msg, expect))
- terminate (STATE_WARNING, msg);
+ die (STATE_WARNING, msg);
if (result == OK_RC)
- terminate (STATE_OK, _("Auth OK"));
+ die (STATE_OK, _("Auth OK"));
return (0);
}
diff --git a/plugins/check_real.c b/plugins/check_real.c
index 1744b329a81ba11d90e6b9a3a39cfd6a18163758..875f9c40c84738d1913ecc01b1e3132c48851085 100644 (file)
--- a/plugins/check_real.c
+++ b/plugins/check_real.c
/* try to connect to the host at the given port number */
if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
- terminate (STATE_CRITICAL, "Unable to connect to %s on port %d\n",
+ die (STATE_CRITICAL, "Unable to connect to %s on port %d\n",
server_address, server_port);
/* Part I - Server Check */
/* return a CRITICAL status if we couldn't read any data */
if (result == -1)
- terminate (STATE_CRITICAL, "No data received from %s\n", host_name);
+ die (STATE_CRITICAL, "No data received from %s\n", host_name);
/* make sure we find the response we are looking for */
if (!strstr (buffer, server_expect)) {
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 68ffaf55c4e37a19ff4669eff869d75b13ab55c1..2e2430da62951f5ef8cb650573b7c95f761a8b6c 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
eval_method[i] & WARN_NE) {
p2 = strpbrk (p2, "0123456789");
if (p2 == NULL)
- terminate (STATE_UNKNOWN,"No valid data returned");
+ die (STATE_UNKNOWN,"No valid data returned");
response_value[i] = strtoul (p2, NULL, 10);
iresult = check_num (i);
asprintf (&show, "%lu", response_value[i]);
} /* end while (ptr) */
if (found == 0)
- terminate
+ die
(STATE_UNKNOWN,
_("%s problem - No data recieved from host\nCMD: %s\n"),
label, command_line);
labels_size += 8;
labels = realloc (labels, labels_size);
if (labels == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("Could not realloc() labels[%d]"), nlabels);
}
labels[nlabels - 1] = optarg;
labels_size += 8;
labels = realloc (labels, labels_size);
if (labels == NULL)
- terminate (STATE_UNKNOWN, _("Could not realloc() labels\n"));
+ die (STATE_UNKNOWN, _("Could not realloc() labels\n"));
}
labels++;
ptr = thisarg (ptr);
unitv_size += 8;
unitv = realloc (unitv, unitv_size);
if (unitv == NULL)
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("Could not realloc() units [%d]\n"), nunits);
}
unitv[nunits - 1] = optarg;
unitv_size += 8;
unitv = realloc (unitv, unitv_size);
if (units == NULL)
- terminate (STATE_UNKNOWN, _("Could not realloc() units\n"));
+ die (STATE_UNKNOWN, _("Could not realloc() units\n"));
}
nunits++;
ptr = thisarg (ptr);
str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
if (strstr (str, "'") == str) { /* handle SIMPLE quoted strings */
if (strlen (str) == 1 || !strstr (str + 1, "'"))
- terminate (STATE_UNKNOWN, "Unbalanced quotes\n");
+ die (STATE_UNKNOWN, "Unbalanced quotes\n");
}
return str;
}
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 65cd899c65915b97d683a8ef173c92a04103f782..b92694d90ef923a87b59047a598d2736561d099f 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
result = max_state (result, STATE_WARNING);
#endif
- terminate (result, "SWAP %s:%s\n", state_text (result), status);
+ die (result, "SWAP %s:%s\n", state_text (result), status);
return STATE_UNKNOWN;
}
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 32bdae70cc55b64d834f7142c25ab0c037a03adc..a897d8e8ec96b446dd579af66297c4c72a14ef7b 100644 (file)
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
/* return a CRITICAL status if we couldn't read any data */
if (status == NULL)
- terminate (STATE_CRITICAL, _("No data received from host\n"));
+ die (STATE_CRITICAL, _("No data received from host\n"));
strip (status);
if (verbose)
printf ("%d %d\n", i, server_expect_count);
if (i >= server_expect_count)
- terminate (STATE_WARNING, _("Invalid response from host\n"));
+ die (STATE_WARNING, _("Invalid response from host\n"));
if (strstr (status, server_expect[i]))
break;
}
break;
case 'S':
#ifndef HAVE_SSL
- terminate (STATE_UNKNOWN,
+ die (STATE_UNKNOWN,
_("SSL support not available. Install OpenSSL and recompile."));
#endif
use_ssl = TRUE;
diff --git a/plugins/check_time.c b/plugins/check_time.c
index b3210bc3e1f85b59319f7d0bcc61a3fb7bffe3ea..dde6eeaf7cca411aea1ba7578f89ba7fba000f46 100644 (file)
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
result = STATE_WARNING;
else
result = STATE_UNKNOWN;
- terminate (result,
+ die (result,
_("TIME UNKNOWN - could not connect to server %s, port %d\n"),
server_address, server_port);
}
result = STATE_WARNING;
else
result = STATE_UNKNOWN;
- terminate (result,
+ die (result,
_("TIME UNKNOWN - no data on recv() from server %s, port %d\n"),
server_address, server_port);
}
&& (end_time - start_time) > warning_time) result = STATE_WARNING;
if (result != STATE_OK)
- terminate (result, _("TIME %s - %d second response time\n"),
+ die (result, _("TIME %s - %d second response time\n"),
state_text (result), (int) (end_time - start_time));
server_time = ntohl (raw_server_time) - UNIX_EPOCH;
diff --git a/plugins/negate.c b/plugins/negate.c
index faf81b34d475b59968cc6d48bd788aec0f1c9325..3ef5ee769e4075220bafd48d9a7350ff365bc68a 100644 (file)
--- a/plugins/negate.c
+++ b/plugins/negate.c
/* Set signal handling and alarm */
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
- terminate (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
+ die (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
(void) alarm ((unsigned) timeout_interval);
child_process = spopen (command_line);
if (child_process == NULL)
- terminate (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line);
+ die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), command_line);
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
if (child_stderr == NULL) {
}
if (!found)
- terminate (STATE_UNKNOWN,\
+ die (STATE_UNKNOWN,\
_("%s problem - No data recieved from host\nCMD: %s\n"),\
argv[0], command_line);
diff --git a/plugins/netutils.c b/plugins/netutils.c
index ea004bb40bafc59409049d2b5af13466d351b50d..4ca3168d9553e7767ef893b9aba0ea8769f42a60 100644 (file)
--- a/plugins/netutils.c
+++ b/plugins/netutils.c
else
recv_buffer[recv_result] = 0;
- /* terminate returned string */
+ /* die returned string */
recv_buffer[recv_size - 1] = 0;
}
diff --git a/plugins/popen.c b/plugins/popen.c
index e41ae9ae7f4dd975322653b59ee4204b4867c3a5..fb855d7bbb134641c6195005162524ac4983778f 100644 (file)
--- a/plugins/popen.c
+++ b/plugins/popen.c
char *pname = NULL; /* caller can set this from argv[0] */
/* Fatal error related to a system call.
- * Print a message and terminate. */
+ * Print a message and die. */
void
err_sys (const char *fmt, ...)
diff --git a/plugins/utils.c b/plugins/utils.c
index 5f770a1f5a508c339238f45209bc829a36452131..959541bf53f382939e677b29fa450e8feeda1a29 100644 (file)
--- a/plugins/utils.c
+++ b/plugins/utils.c
void
die (int result, const char *fmt, ...)
-{
- va_list ap;
- printf ("%s %s: ", sizeof (char) + index(progname, '_'), state_text(result));
- va_start (ap, fmt);
- vprintf (fmt, ap);
- va_end (ap);
- exit (result);
-}
-
-void
-terminate (int result, const char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
if (dest == NULL || strlen (dest) < len)
dest = realloc (dest, len + 1);
if (dest == NULL)
- terminate (STATE_UNKNOWN, "failed realloc in strpcpy\n");
+ die (STATE_UNKNOWN, "failed realloc in strpcpy\n");
strncpy (dest, src, len);
dest[len] = '\0';
dest = realloc (dest, len + l2 + 1);
if (dest == NULL)
- terminate (STATE_UNKNOWN, "failed malloc in strscat\n");
+ die (STATE_UNKNOWN, "failed malloc in strscat\n");
strncpy (dest + len, src, l2);
dest[len + l2] = '\0';
diff --git a/plugins/utils.h b/plugins/utils.h
index 83793e4650ab5891d57f1abcccb3b30f93fb56eb..f36834f9cdcefa4590849403716396a4aa633773 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
char *clean_revstring (const char *revstring);
void print_revision (const char *, const char *);
void die (int result, const char *fmt, ...);
-void terminate (int result, const char *msg, ...);
/* Handle timeouts */