mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-20 00:10:09 -05:00
various fixes for localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
71656b2aaf
commit
e9ccc6b21a
41 changed files with 2768 additions and 1550 deletions
|
|
@ -81,9 +81,9 @@ main (int argc, char **argv)
|
|||
if (verbose) {
|
||||
printf ("%s\n", command_line);
|
||||
if(expected_address != NULL) {
|
||||
printf ("Looking for: '%s'\n", expected_address);
|
||||
printf (_("Looking for: '%s'\n"), expected_address);
|
||||
} else {
|
||||
printf ("Looking for: '%s'\n", query_address);
|
||||
printf (_("Looking for: '%s'\n"), query_address);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,9 +214,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
|||
|
|
@ -438,9 +438,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -488,7 +486,7 @@ print_path (const char *mypath)
|
|||
if (mypath == NULL)
|
||||
printf ("\n");
|
||||
else
|
||||
printf (" for %s\n", mypath);
|
||||
printf (_(" for %s\n"), mypath);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ main (int argc, char **argv)
|
|||
asprintf(&address, "%s,%s", address, temp_buffer);
|
||||
}
|
||||
|
||||
else if (strstr (input_buffer, "Non-authoritative answer:")) {
|
||||
else if (strstr (input_buffer, _("Non-authoritative answer:"))) {
|
||||
non_authoritative = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -277,7 +277,6 @@ error_scan (char *input_buffer)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
|
|
@ -313,9 +312,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -386,7 +383,6 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
validate_arguments ()
|
||||
{
|
||||
|
|
@ -397,7 +393,6 @@ validate_arguments ()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -432,7 +427,6 @@ specified in /etc/resolv.conf will be used.\n\n"));
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ void print_help (void);
|
|||
void print_usage (void);
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -242,9 +242,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -301,15 +299,13 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (server_name == NULL)
|
||||
usage (_("Hostname was not supplied\n\n"));
|
||||
usage4 (_("Hostname was not supplied"));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
get_threshold (char *arg, char *rv[2])
|
||||
{
|
||||
|
|
@ -351,7 +347,6 @@ get_threshold (char *arg, char *rv[2])
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -395,7 +390,6 @@ percentage of packet loss to trigger an alarm state.\n"));
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -123,15 +123,15 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
if (strstr (ret[2], QSTAT_HOST_ERROR)) {
|
||||
printf ("CRITICAL - Host not found\n");
|
||||
printf (_("CRITICAL - Host not found\n"));
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
else if (strstr (ret[2], QSTAT_HOST_DOWN)) {
|
||||
printf ("CRITICAL - Game server down or unavailable\n");
|
||||
printf (_("CRITICAL - Game server down or unavailable\n"));
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
else if (strstr (ret[2], QSTAT_HOST_TIMEOUT)) {
|
||||
printf ("CRITICAL - Game server timeout\n");
|
||||
printf (_("CRITICAL - Game server timeout\n"));
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
|
|
@ -156,7 +156,6 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
{
|
||||
|
|
@ -199,9 +198,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -269,6 +266,7 @@ process_arguments (int argc, char **argv)
|
|||
return validate_arguments ();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
|
|
@ -291,9 +289,6 @@ validate_arguments (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -286,7 +286,6 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
|
|
@ -334,9 +333,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +358,6 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
|
|
@ -369,7 +365,6 @@ validate_arguments (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,19 +310,19 @@ int main(int argc, char **argv)
|
|||
|
||||
/* check if we are root */
|
||||
if(geteuid()) {
|
||||
printf("Root access needed (for raw sockets)\n");
|
||||
printf(_("Root access needed (for raw sockets)\n"));
|
||||
exit(STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
/* confirm that ICMP is available on this machine */
|
||||
if((proto = getprotobyname("icmp")) == NULL)
|
||||
crash("icmp: unknown protocol");
|
||||
crash(_("icmp: unknown protocol"));
|
||||
|
||||
/* create raw socket for ICMP calls (ping) */
|
||||
sock = socket(AF_INET, SOCK_RAW, proto->p_proto);
|
||||
|
||||
if(sock < 0)
|
||||
crash("can't create raw socket");
|
||||
crash(_("Can't create raw socket"));
|
||||
|
||||
/* drop privileges now that we have the socket */
|
||||
if((uid = getuid())) {
|
||||
|
|
@ -334,7 +334,7 @@ int main(int argc, char **argv)
|
|||
ident = getpid() & 0xFFFF;
|
||||
|
||||
if(!(host_base_ptr = malloc(sizeof(struct host_name_list)))) {
|
||||
crash("Unable to allocate memory for host name list\n");
|
||||
crash(_("Unable to allocate memory for host name list\n"));
|
||||
}
|
||||
host_ptr = host_base_ptr;
|
||||
|
||||
|
|
@ -359,12 +359,12 @@ int main(int argc, char **argv)
|
|||
switch (c) {
|
||||
case 'H':
|
||||
if(!(host_ptr->entry = malloc(strlen(optarg) + 1))) {
|
||||
crash("Failed to allocate memory for hostname");
|
||||
crash(_("Failed to allocate memory for hostname"));
|
||||
}
|
||||
memset(host_ptr->entry, 0, strlen(optarg) + 1);
|
||||
host_ptr->entry = memcpy(host_ptr->entry, optarg, strlen(optarg));
|
||||
if(!(host_ptr->next = malloc(sizeof(struct host_name_list))))
|
||||
crash("Failed to allocate memory for hostname");
|
||||
crash(_("Failed to allocate memory for hostname"));
|
||||
host_ptr = host_ptr->next;
|
||||
host_ptr->next = NULL;
|
||||
// add_name(optarg);
|
||||
|
|
@ -375,35 +375,35 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
case 'w':
|
||||
if(get_threshold(optarg, &warn)) {
|
||||
printf("Illegal threshold pair specified for -%c", c);
|
||||
printf(_("Illegal threshold pair specified for -%c"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if(get_threshold(optarg, &crit)) {
|
||||
printf("Illegal threshold pair specified for -%c", c);
|
||||
printf(_("Illegal threshold pair specified for -%c"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if(!(timeout = (u_int) strtoul(optarg, NULL, 0) * 100)) {
|
||||
printf("option -%c requires integer argument\n", c);
|
||||
printf(_("Option -%c requires integer argument\n"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
if(!(retry = (u_int) strtoul(optarg, NULL, 0))) {
|
||||
printf("option -%c requires integer argument\n", c);
|
||||
printf(_("Option -%c requires integer argument\n"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
if(!(interval = (u_int) strtoul(optarg, NULL, 0) * 100)) {
|
||||
printf("option -%c requires positive non-zero integer argument\n", c);
|
||||
printf(_("Option -%c requires positive non-zero integer argument\n"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
|
@ -411,14 +411,14 @@ int main(int argc, char **argv)
|
|||
case 'p':
|
||||
case 'n':
|
||||
if(!(count = (u_int) strtoul(optarg, NULL, 0))) {
|
||||
printf("option -%c requires positive non-zero integer argument\n", c);
|
||||
printf(_("Option -%c requires positive non-zero integer argument\n"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if(!(ping_data_size = (u_int) strtoul(optarg, NULL, 0))) {
|
||||
printf("option -%c requires integer argument\n", c);
|
||||
printf(_("Option -%c requires integer argument\n"), c);
|
||||
print_usage();
|
||||
}
|
||||
break;
|
||||
|
|
@ -467,7 +467,7 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("option flag -%c specified, but not recognized\n", c);
|
||||
printf(_("Option flag -%c specified, but not recognized\n"), c);
|
||||
print_usage();
|
||||
break;
|
||||
}
|
||||
|
|
@ -494,30 +494,30 @@ int main(int argc, char **argv)
|
|||
else if(timeout < warn.rta) timeout = warn.rta;
|
||||
|
||||
if((interval < MIN_INTERVAL * 100 || retry > MAX_RETRY) && getuid()) {
|
||||
printf("%s: these options are too risky for mere mortals.\n", prog);
|
||||
printf("%s: You need i >= %u and r < %u\n",
|
||||
printf(_("%s: these options are too risky for mere mortals.\n"), prog);
|
||||
printf(_("%s: You need i >= %u and r < %u\n"),
|
||||
prog, MIN_INTERVAL, MAX_RETRY);
|
||||
printf("Current settings; i = %d, r = %d\n",
|
||||
printf(_("Current settings; i = %d, r = %d\n"),
|
||||
interval / 100, retry);
|
||||
print_usage();
|
||||
}
|
||||
|
||||
if((ping_data_size > MAX_PING_DATA) || (ping_data_size < MIN_PING_DATA)) {
|
||||
printf("%s: data size %u not valid, must be between %u and %u\n",
|
||||
printf(_("%s: data size %u not valid, must be between %u and %u\n"),
|
||||
prog, ping_data_size, MIN_PING_DATA, MAX_PING_DATA);
|
||||
print_usage();
|
||||
|
||||
}
|
||||
|
||||
if((backoff > MAX_BACKOFF_FACTOR) || (backoff < MIN_BACKOFF_FACTOR)) {
|
||||
printf("%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n",
|
||||
printf(_("%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n"),
|
||||
prog, backoff, MIN_BACKOFF_FACTOR, MAX_BACKOFF_FACTOR);
|
||||
print_usage();
|
||||
|
||||
}
|
||||
|
||||
if(count > MAX_COUNT) {
|
||||
printf("%s: count %u not valid, must be less than %u\n",
|
||||
printf(_("%s: count %u not valid, must be less than %u\n"),
|
||||
prog, count, MAX_COUNT);
|
||||
print_usage();
|
||||
}
|
||||
|
|
@ -536,19 +536,19 @@ int main(int argc, char **argv)
|
|||
|
||||
/* generate requires command line parameters beyond the switches */
|
||||
if(generate_flag && !*argv) {
|
||||
printf("generate flag requires command line parameters beyond switches\n");
|
||||
printf(_("Generate flag requires command line parameters beyond switches\n"));
|
||||
print_usage();
|
||||
}
|
||||
|
||||
if(*argv && !generate_flag) {
|
||||
while(*argv) {
|
||||
if(!(host_ptr->entry = malloc(strlen(*argv) + 1))) {
|
||||
crash("Failed to allocate memory for hostname");
|
||||
crash(_("Failed to allocate memory for hostname"));
|
||||
}
|
||||
memset(host_ptr->entry, 0, strlen(*argv) + 1);
|
||||
host_ptr->entry = memcpy(host_ptr->entry, *argv, strlen(*argv));
|
||||
if(!(host_ptr->next = malloc(sizeof(struct host_name_list))))
|
||||
crash("Failed to allocate memory for hostname");
|
||||
crash(_("Failed to allocate memory for hostname"));
|
||||
host_ptr = host_ptr->next;
|
||||
host_ptr->next = NULL;
|
||||
|
||||
|
|
@ -565,13 +565,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
if(!num_hosts) {
|
||||
printf("No hosts to work with!\n\n");
|
||||
printf(_("No hosts to work with!\n\n"));
|
||||
print_usage();
|
||||
}
|
||||
|
||||
/* allocate array to hold outstanding ping requests */
|
||||
table = (HOST_ENTRY **) malloc(sizeof(HOST_ENTRY *) * num_hosts);
|
||||
if(!table) crash("Can't malloc array of hosts");
|
||||
if(!table) crash(_("Can't malloc array of hosts"));
|
||||
|
||||
cursor = rrlist;
|
||||
|
||||
|
|
@ -703,7 +703,7 @@ void finish()
|
|||
warn.pl, crit.pl);
|
||||
}
|
||||
else {
|
||||
printf("%s is down (lost 100%%)", h->host);
|
||||
printf(_("%s is down (lost 100%%)"), h->host);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -754,7 +754,7 @@ void finish()
|
|||
}
|
||||
|
||||
if(num_noaddress) {
|
||||
printf("No hostaddress specified.\n");
|
||||
printf(_("No hostaddress specified.\n"));
|
||||
print_usage();
|
||||
}
|
||||
else if(num_alive != num_hosts) {
|
||||
|
|
@ -765,10 +765,10 @@ void finish()
|
|||
|
||||
if(num_hosts > 1) {
|
||||
if(num_alive == num_hosts) {
|
||||
printf("OK - All %d hosts are alive\n", num_hosts);
|
||||
printf(_("OK - All %d hosts are alive\n"), num_hosts);
|
||||
}
|
||||
else {
|
||||
printf("CRITICAL - %d of %d hosts are alive\n", num_alive, num_hosts);
|
||||
printf(_("CRITICAL - %d of %d hosts are alive\n"), num_alive, num_hosts);
|
||||
}
|
||||
}
|
||||
exit(fin_stat);
|
||||
|
|
@ -784,7 +784,7 @@ void send_ping(int lsock, HOST_ENTRY *h)
|
|||
|
||||
buffer = (char *)malloc((size_t) ping_pkt_size);
|
||||
if(!buffer)
|
||||
crash("can't malloc ping packet");
|
||||
crash(_("Can't malloc ping packet"));
|
||||
|
||||
memset(buffer, 0, ping_pkt_size * sizeof(char));
|
||||
icp = (struct icmp *)buffer;
|
||||
|
|
@ -808,7 +808,7 @@ void send_ping(int lsock, HOST_ENTRY *h)
|
|||
|
||||
if(n < 0 || (unsigned int)n != ping_pkt_size) {
|
||||
if(unreachable_flag) {
|
||||
printf("%s error while sending ping: %s\n",
|
||||
printf(_("%s error while sending ping: %s\n"),
|
||||
h->host, strerror(errno));
|
||||
} /* IF */
|
||||
|
||||
|
|
@ -860,7 +860,7 @@ int wait_for_reply(int lsock)
|
|||
#endif /* defined(__alpha__) && __STDC__ */
|
||||
|
||||
if(result < hlen + ICMP_MINLEN) {
|
||||
printf("received packet too short for ICMP (%d bytes from %s)\n", result,
|
||||
printf(_("Received packet too short for ICMP (%d bytes from %s)\n"), result,
|
||||
inet_ntoa(response_addr.sin_addr));
|
||||
|
||||
return (1); /* too short */
|
||||
|
|
@ -903,7 +903,7 @@ int wait_for_reply(int lsock)
|
|||
/* note reply time in array, probably */
|
||||
if((this_count >= 0) && ((unsigned int)this_count < trials)) {
|
||||
if(h->resp_times[this_count] != RESP_WAITING) {
|
||||
printf("%s : duplicate for [%d], %d bytes, %s ms",
|
||||
printf(_("%s : duplicate for [%d], %d bytes, %s ms"),
|
||||
h->host, this_count, result, sprint_tm(this_reply));
|
||||
|
||||
if(response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr)
|
||||
|
|
@ -913,7 +913,7 @@ int wait_for_reply(int lsock)
|
|||
} /* IF */
|
||||
else {
|
||||
/* count is out of bounds?? */
|
||||
printf("%s : duplicate for [%d], %d bytes, %s ms\n",
|
||||
printf(_("%s : duplicate for [%d], %d bytes, %s ms\n"),
|
||||
h->host, this_count, result, sprint_tm(this_reply));
|
||||
} /* ELSE */
|
||||
|
||||
|
|
@ -942,12 +942,12 @@ int handle_random_icmp(struct icmp *p, struct sockaddr_in *addr)
|
|||
h = table[sent_icmp->icmp_seq];
|
||||
|
||||
if(p->icmp_code > ICMP_UNREACH_MAXTYPE) {
|
||||
printf("ICMP Unreachable (Invalid Code) from %s for ICMP Echo sent to %s",
|
||||
printf(_("ICMP Unreachable (Invalid Code) from %s for ICMP Echo sent to %s"),
|
||||
inet_ntoa(addr->sin_addr), h->host);
|
||||
|
||||
} /* IF */
|
||||
else {
|
||||
printf("ICMP Unreachable from %s for ICMP Echo sent to %s",
|
||||
printf(_("ICMP Unreachable from %s for ICMP Echo sent to %s"),
|
||||
inet_ntoa(addr->sin_addr), h->host);
|
||||
|
||||
} /* ELSE */
|
||||
|
|
@ -971,7 +971,7 @@ int handle_random_icmp(struct icmp *p, struct sockaddr_in *addr)
|
|||
(sent_icmp->icmp_seq < (n_short) num_hosts)) {
|
||||
/* this is a response to a ping we sent */
|
||||
h = table[sent_icmp->icmp_seq];
|
||||
printf("ICMP Unreachable from %s for ICMP Echo sent to %s",
|
||||
printf(_("ICMP Unreachable from %s for ICMP Echo sent to %s"),
|
||||
inet_ntoa(addr->sin_addr), h->host);
|
||||
|
||||
if(inet_addr(h->host) == INADDR_NONE)
|
||||
|
|
@ -1056,7 +1056,7 @@ void add_name(char *name)
|
|||
} /* IF */
|
||||
|
||||
if(host_ent == NULL) {
|
||||
printf("%s address not found\n", name);
|
||||
printf(_("%s address not found\n"), name);
|
||||
num_noaddress++;
|
||||
return;
|
||||
} /* IF */
|
||||
|
|
@ -1064,7 +1064,7 @@ void add_name(char *name)
|
|||
|
||||
host_add = (struct in_addr *)*(host_ent->h_addr_list);
|
||||
if(host_add == NULL) {
|
||||
printf("%s has no address data\n", name);
|
||||
printf(_("%s has no address data\n"), name);
|
||||
num_noaddress++;
|
||||
return;
|
||||
} /* IF */
|
||||
|
|
@ -1097,7 +1097,7 @@ char *na_cat(char *name, struct in_addr ipaddr)
|
|||
nm = (char *)malloc(strlen(name) + strlen(as) + 4);
|
||||
|
||||
if(!nm)
|
||||
crash("can't allocate some space for a string");
|
||||
crash(_("Can't allocate some space for a string"));
|
||||
|
||||
strcpy(nm, name);
|
||||
strcat(nm, " (");
|
||||
|
|
@ -1116,7 +1116,7 @@ void add_addr(char *name, char *host, struct in_addr ipaddr)
|
|||
int *i;
|
||||
|
||||
if(!(p = (HOST_ENTRY *) malloc(sizeof(HOST_ENTRY)))) {
|
||||
crash("can't allocate HOST_ENTRY");
|
||||
crash(_("Can't allocate HOST_ENTRY"));
|
||||
}
|
||||
|
||||
memset((char *)p, 0, sizeof(HOST_ENTRY));
|
||||
|
|
@ -1129,7 +1129,7 @@ void add_addr(char *name, char *host, struct in_addr ipaddr)
|
|||
|
||||
/* array for response time results */
|
||||
if(!(i = (int *)malloc(trials * sizeof(int)))) {
|
||||
crash("can't allocate resp_times array");
|
||||
crash(_("Can't allocate resp_times array"));
|
||||
}
|
||||
|
||||
for(n = 1; n < trials; n++)
|
||||
|
|
@ -1193,7 +1193,7 @@ char *cpystr(char *string)
|
|||
|
||||
if(string) {
|
||||
dst = (char *)malloc(1 + strlen(string));
|
||||
if(!dst) crash("malloc() failed!");
|
||||
if(!dst) crash(_("malloc() failed!"));
|
||||
|
||||
strcpy(dst, string);
|
||||
return dst;
|
||||
|
|
@ -1210,7 +1210,7 @@ void crash(char *msg)
|
|||
if(errno)
|
||||
printf("%s: %s : %s\n", prog, msg, strerror(errno));
|
||||
if(h_errno)
|
||||
printf("%s: %s : A network error occurred\n", prog, msg);
|
||||
printf(_("%s: %s : A network error occurred\n"), prog, msg);
|
||||
}
|
||||
else printf("%s: %s\n", prog, msg);
|
||||
|
||||
|
|
@ -1276,7 +1276,7 @@ void u_sleep(int u_sec)
|
|||
FD_ZERO(&readset);
|
||||
nfound = select(0, &readset, &writeset, NULL, &to);
|
||||
if(nfound < 0)
|
||||
crash("select() in u_sleep:");
|
||||
crash(_("select() in u_sleep:"));
|
||||
|
||||
return;
|
||||
} /* u_sleep() */
|
||||
|
|
@ -1306,14 +1306,14 @@ int recvfrom_wto(int lsock, char *buf, int len, struct sockaddr *saddr, int timo
|
|||
FD_ZERO(&writeset);
|
||||
FD_SET(lsock, &readset);
|
||||
nfound = select(lsock + 1, &readset, &writeset, NULL, &to);
|
||||
if(nfound < 0) crash("select() in recvfrom_wto");
|
||||
if(nfound < 0) crash(_("select() in recvfrom_wto"));
|
||||
|
||||
if(nfound == 0) return -1; /* timeout */
|
||||
|
||||
if(nfound) {
|
||||
slen = sizeof(struct sockaddr);
|
||||
n = recvfrom(sock, buf, len, 0, saddr, &slen);
|
||||
if(n < 0) crash("recvfrom");
|
||||
if(n < 0) crash(_("recvfrom"));
|
||||
return(n);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,9 +206,7 @@ main (int argc, char *argv[])
|
|||
print_revision (progname, revision);
|
||||
return STATE_OK;
|
||||
default:
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
|
||||
if (optind < argc) {
|
||||
|
|
@ -488,7 +486,6 @@ smart_read_thresholds (int fd, thresholds_t * thresholds)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help ()
|
||||
{
|
||||
|
|
@ -515,7 +512,6 @@ Usage: %s [DEVICE] [OPTION]\n\
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,11 +134,11 @@ main (int argc, char *argv[])
|
|||
if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS)
|
||||
{
|
||||
/*ldap_perror(ld, "ldaps_option"); */
|
||||
printf ("Could not init TLS at port %i!\n", ld_port);
|
||||
printf (_("Could not init TLS at port %i!\n"), ld_port);
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
#else
|
||||
printf ("TLS not supported by the libraries!\n", ld_port);
|
||||
printf (_("TLS not supported by the libraries!\n"), ld_port);
|
||||
return STATE_CRITICAL;
|
||||
#endif /* LDAP_OPT_X_TLS */
|
||||
} else {
|
||||
|
|
@ -157,11 +157,11 @@ main (int argc, char *argv[])
|
|||
if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS)
|
||||
{
|
||||
/*ldap_perror(ld, "ldap_start_tls"); */
|
||||
printf ("Could not init startTLS at port %i!\n", ld_port);
|
||||
printf (_("Could not init startTLS at port %i!\n"), ld_port);
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
#else
|
||||
printf ("startTLS not supported by the library, needs LDAPv3!\n");
|
||||
printf (_("startTLS not supported by the library, needs LDAPv3!\n"));
|
||||
return STATE_CRITICAL;
|
||||
#endif /* HAVE_LDAP_START_TLS_S */
|
||||
}
|
||||
|
|
@ -312,9 +312,7 @@ process_arguments (int argc, char **argv)
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -328,21 +326,20 @@ process_arguments (int argc, char **argv)
|
|||
return validate_arguments ();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
validate_arguments ()
|
||||
{
|
||||
if (ld_host==NULL || strlen(ld_host)==0)
|
||||
usage (_("please specify the host name\n"));
|
||||
usage4 (_("Please specify the host name\n"));
|
||||
|
||||
if (ld_base==NULL || strlen(ld_base)==0)
|
||||
usage (_("please specify the LDAP base\n"));
|
||||
usage4 (_("Please specify the LDAP base\n"));
|
||||
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -392,7 +389,6 @@ print_help (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -224,9 +224,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -233,9 +233,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -260,9 +260,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,7 +302,6 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
|
|
@ -312,7 +309,6 @@ validate_arguments (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,25 +98,25 @@ main (int argc, char **argv)
|
|||
/* check the slave status */
|
||||
if (mysql_query (&mysql, "show slave status") != 0) {
|
||||
mysql_close (&mysql);
|
||||
die (STATE_CRITICAL, "slave query error: %s\n", mysql_error (&mysql));
|
||||
die (STATE_CRITICAL, _("slave query error: %s\n"), mysql_error (&mysql));
|
||||
}
|
||||
|
||||
/* store the result */
|
||||
if ( (res = mysql_store_result (&mysql)) == NULL) {
|
||||
mysql_close (&mysql);
|
||||
die (STATE_CRITICAL, "slave store_result error: %s\n", mysql_error (&mysql));
|
||||
die (STATE_CRITICAL, _("slave store_result error: %s\n"), mysql_error (&mysql));
|
||||
}
|
||||
|
||||
/* fetch the first row */
|
||||
if ( (row = mysql_fetch_row (res)) == NULL) {
|
||||
mysql_free_result (res);
|
||||
mysql_close (&mysql);
|
||||
die (STATE_CRITICAL, "slave fetch row error: %s\n", mysql_error (&mysql));
|
||||
die (STATE_CRITICAL, _("slave fetch row error: %s\n"), mysql_error (&mysql));
|
||||
}
|
||||
|
||||
if (mysql_field_count (&mysql) == 12) {
|
||||
/* mysql 3.23.x */
|
||||
snprintf (slaveresult, SLAVERESULTSIZE, "Slave running: %s", row[6]);
|
||||
snprintf (slaveresult, SLAVERESULTSIZE, _("Slave running: %s"), row[6]);
|
||||
if (strcmp (row[6], "Yes") != 0) {
|
||||
mysql_free_result (res);
|
||||
mysql_close (&mysql);
|
||||
|
|
@ -151,7 +151,6 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
|
|
@ -212,9 +211,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +242,6 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
|
|
@ -265,7 +261,6 @@ validate_arguments (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -304,7 +299,6 @@ a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ main (int argc, char **argv)
|
|||
fclose (fp);
|
||||
|
||||
if (verbose >= 2)
|
||||
printf("command: %s\n", PS_COMMAND);
|
||||
printf(_("command: %s\n"), PS_COMMAND);
|
||||
|
||||
/* run the command to check for the Nagios process.. */
|
||||
child_process = spopen (PS_COMMAND);
|
||||
|
|
@ -206,8 +206,7 @@ process_arguments (int argc, char **argv)
|
|||
expire_minutes = atoi (argv[2]);
|
||||
else
|
||||
die (STATE_UNKNOWN,
|
||||
_("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
|
||||
progname);
|
||||
_("Expiration time must be an integer (seconds)\n"));
|
||||
process_string = argv[3];
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -220,9 +219,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %c\n\n"), progname, optopt);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -240,8 +237,7 @@ process_arguments (int argc, char **argv)
|
|||
expire_minutes = atoi (optarg);
|
||||
else
|
||||
die (STATE_UNKNOWN,
|
||||
_("Expiration time must be an integer (seconds)\nType '%s -h' for additional help\n"),
|
||||
progname);
|
||||
_("Expiration time must be an integer (seconds)\n"));
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
|
|
@ -252,12 +248,10 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
if (status_log == NULL)
|
||||
die (STATE_UNKNOWN,
|
||||
_("You must provide the status_log\nType '%s -h' for additional help\n"),
|
||||
progname);
|
||||
_("You must provide the status_log\n"));
|
||||
else if (process_string == NULL)
|
||||
die (STATE_UNKNOWN,
|
||||
_("You must provide a process string\nType '%s -h' for additional help\n"),
|
||||
progname);
|
||||
_("You must provide a process string\n"));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ int main(int argc, char **argv){
|
|||
|
||||
case CHECK_NONE:
|
||||
default:
|
||||
usage (_("Please specify a variable to check"));
|
||||
usage4 (_("Please specify a variable to check"));
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
@ -487,14 +487,12 @@ int process_arguments(int argc, char **argv){
|
|||
switch (c)
|
||||
{
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf("%s: Unknown argument: %s\n\n",progname,optarg);
|
||||
print_usage();
|
||||
exit(STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help();
|
||||
exit(STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision(progname,"$Revision$");
|
||||
print_revision(progname,revision);
|
||||
exit(STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
if (server_address) free(server_address);
|
||||
|
|
@ -507,7 +505,7 @@ int process_arguments(int argc, char **argv){
|
|||
if (is_intnonneg(optarg))
|
||||
server_port=atoi(optarg);
|
||||
else
|
||||
die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
|
||||
die(STATE_UNKNOWN,_("Server port must be an integer\n"));
|
||||
break;
|
||||
case 'v':
|
||||
if(strlen(optarg)<4)
|
||||
|
|
@ -573,7 +571,7 @@ void fetch_data (const char *address, int port, const char *sendb) {
|
|||
result=process_tcp_request(address, port, sendb, recv_buffer,sizeof(recv_buffer));
|
||||
|
||||
if(result!=STATE_OK)
|
||||
die (result, "could not fetch information from server\n");
|
||||
die (result, _("could not fetch information from server\n"));
|
||||
|
||||
if (!strncmp(recv_buffer,"ERROR",5))
|
||||
die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer);
|
||||
|
|
|
|||
|
|
@ -760,9 +760,7 @@ int process_arguments(int argc, char **argv) {
|
|||
switch (c)
|
||||
{
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf ("%s: Unknown argument: %s\n\n", progname, optarg);
|
||||
print_usage();
|
||||
exit(STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help();
|
||||
exit(STATE_OK);
|
||||
|
|
@ -779,7 +777,7 @@ int process_arguments(int argc, char **argv) {
|
|||
if (is_intnonneg(optarg))
|
||||
server_port=atoi(optarg);
|
||||
else
|
||||
die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
|
||||
die(STATE_UNKNOWN,_("Server port an integer\n"));
|
||||
break;
|
||||
case 'v':
|
||||
if (strlen(optarg)<3)
|
||||
|
|
|
|||
|
|
@ -272,17 +272,9 @@ main (int argc, char **argv)
|
|||
die (STATE_UNKNOWN, _("Nothing to check!\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
/* reset timeout */
|
||||
/* alarm (0); */
|
||||
|
||||
/* printf (_("Reached end of program with no data returned\n")); */
|
||||
|
||||
/* return result; */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
|
|
@ -332,9 +324,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -349,8 +339,7 @@ process_arguments (int argc, char **argv)
|
|||
server_port = atoi (optarg);
|
||||
else
|
||||
die (STATE_UNKNOWN,
|
||||
_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),
|
||||
progname);
|
||||
_("Server port an integer\n"));
|
||||
break;
|
||||
case 'v': /* variable */
|
||||
if (strcmp (optarg, "LOAD") == 0) {
|
||||
|
|
@ -403,7 +392,6 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -459,7 +447,6 @@ Notes:\n\
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -209,9 +209,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -232,7 +230,7 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
case 'w': /* warning time threshold */
|
||||
if (!is_nonnegative (optarg))
|
||||
usage2 (_("Critical threshold must be a positive integer"), optarg);
|
||||
usage2 (_("Warning threshold must be a positive integer"), optarg);
|
||||
else
|
||||
twarn = strtod (optarg, NULL);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -194,9 +194,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
|||
|
|
@ -343,9 +343,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -368,7 +366,7 @@ process_arguments (int argc, char **argv)
|
|||
else if (sscanf (optarg, "%d:", &cmin) == 1)
|
||||
break;
|
||||
else
|
||||
usage (_("Critical Process Count must be an integer!\n\n"));
|
||||
usage4 (_("Critical Process Count must be an integer!"));
|
||||
break;
|
||||
case 'w': /* warning threshold */
|
||||
if (is_integer (optarg))
|
||||
|
|
@ -380,7 +378,7 @@ process_arguments (int argc, char **argv)
|
|||
else if (sscanf (optarg, "%d:", &wmin) == 1)
|
||||
break;
|
||||
else
|
||||
usage (_("Warning Process Count must be an integer!\n\n"));
|
||||
usage4 (_("Warning Process Count must be an integer!"));
|
||||
break;
|
||||
case 'p': /* process id */
|
||||
if (sscanf (optarg, "%d%[^0-9]", &ppid, tmp) == 1) {
|
||||
|
|
@ -388,7 +386,7 @@ process_arguments (int argc, char **argv)
|
|||
options |= PPID;
|
||||
break;
|
||||
}
|
||||
usage2 (_("%s: Parent Process ID must be an integer!\n\n"), progname);
|
||||
usage4 (_("Parent Process ID must be an integer!"));
|
||||
case 's': /* status */
|
||||
if (statopts)
|
||||
break;
|
||||
|
|
@ -403,13 +401,13 @@ process_arguments (int argc, char **argv)
|
|||
pw = getpwuid ((uid_t) uid);
|
||||
/* check to be sure user exists */
|
||||
if (pw == NULL)
|
||||
usage2 (_("UID %s was not found\n"), optarg);
|
||||
usage2 (_("UID %s was not found"), optarg);
|
||||
}
|
||||
else {
|
||||
pw = getpwnam (optarg);
|
||||
/* check to be sure user exists */
|
||||
if (pw == NULL)
|
||||
usage2 (_("User name %s was not found\n"), optarg);
|
||||
usage2 (_("User name %s was not found"), optarg);
|
||||
/* then get uid */
|
||||
uid = pw->pw_uid;
|
||||
}
|
||||
|
|
@ -443,14 +441,14 @@ process_arguments (int argc, char **argv)
|
|||
options |= RSS;
|
||||
break;
|
||||
}
|
||||
usage2 (_("%s: RSS must be an integer!\n\n"), progname);
|
||||
usage4 (_("RSS must be an integer!"));
|
||||
case 'z': /* VSZ */
|
||||
if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
|
||||
asprintf (&fmt, _("%s%sVSZ >= %d"), (fmt ? fmt : ""), (options ? ", " : ""), vsz);
|
||||
options |= VSZ;
|
||||
break;
|
||||
}
|
||||
usage2 (_("%s: VSZ must be an integer!\n\n"), progname);
|
||||
usage4 (_("VSZ must be an integer!"));
|
||||
case 'P': /* PCPU */
|
||||
/* TODO: -P 1.5.5 is accepted */
|
||||
if (sscanf (optarg, "%f%[^0-9.]", &pcpu, tmp) == 1) {
|
||||
|
|
@ -458,7 +456,7 @@ process_arguments (int argc, char **argv)
|
|||
options |= PCPU;
|
||||
break;
|
||||
}
|
||||
usage2 (_("%s: PCPU must be a float!\n\n"), progname);
|
||||
usage4 (_("PCPU must be a float!"));
|
||||
case 'm':
|
||||
asprintf (&metric_name, "%s", optarg);
|
||||
if ( strcmp(optarg, "PROCS") == 0) {
|
||||
|
|
@ -482,10 +480,7 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
|
||||
printf (_("%s: metric must be one of PROCS, VSZ, RSS, CPU, ELAPSED!\n\n"),
|
||||
progname);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage4 (_("Metric must be one of PROCS, VSZ, RSS, CPU, ELAPSED!"));
|
||||
case 'v': /* command */
|
||||
verbose++;
|
||||
break;
|
||||
|
|
@ -588,8 +583,6 @@ check_thresholds (int value)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* convert the elapsed time to seconds */
|
||||
int
|
||||
convert_to_seconds(char *etime) {
|
||||
|
|
@ -653,7 +646,6 @@ convert_to_seconds(char *etime) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -199,12 +199,12 @@ process_arguments (int argc, char **argv)
|
|||
if (is_intpos (argv[5]))
|
||||
retries = atoi (argv[5]);
|
||||
else
|
||||
usage (_("Number of retries must be a positive integer"));
|
||||
usage4 (_("Number of retries must be a positive integer"));
|
||||
server = argv[6];
|
||||
if (is_intpos (argv[7]))
|
||||
port = atoi (argv[7]);
|
||||
else
|
||||
usage (_("Port must be a positive integer"));
|
||||
usage4 (_("Port must be a positive integer"));
|
||||
expect = argv[8];
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -218,9 +218,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (OK);
|
||||
|
|
@ -240,7 +238,7 @@ process_arguments (int argc, char **argv)
|
|||
if (is_intnonneg (optarg))
|
||||
port = atoi (optarg);
|
||||
else
|
||||
usage (_("Port must be a positive integer"));
|
||||
usage4 (_("Port must be a positive integer"));
|
||||
break;
|
||||
case 'u': /* username */
|
||||
username = optarg;
|
||||
|
|
@ -261,7 +259,7 @@ process_arguments (int argc, char **argv)
|
|||
if (is_intpos (optarg))
|
||||
retries = atoi (optarg);
|
||||
else
|
||||
usage (_("Number of retries must be a positive integer"));
|
||||
usage4 (_("Number of retries must be a positive integer"));
|
||||
break;
|
||||
case 't': /* timeout */
|
||||
if (is_intpos (optarg))
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ process_arguments (int argc, char **argv)
|
|||
check_critical_time = TRUE;
|
||||
}
|
||||
else {
|
||||
usage4 (_("Critical time must be a nonnegative integer"));
|
||||
usage4 (_("Critical time must be a positive integer"));
|
||||
}
|
||||
break;
|
||||
case 'v': /* verbose */
|
||||
|
|
@ -341,7 +341,7 @@ process_arguments (int argc, char **argv)
|
|||
socket_timeout = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage4 (_("Time interval must be a nonnegative integer"));
|
||||
usage4 (_("Timeout interval must be a positive integer"));
|
||||
}
|
||||
break;
|
||||
case 'V': /* version */
|
||||
|
|
@ -351,9 +351,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* usage */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +366,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
if (server_address==NULL)
|
||||
usage (_("You must provide a server to check\n"));
|
||||
usage4 (_("You must provide a server to check"));
|
||||
|
||||
if (host_name==NULL)
|
||||
host_name = strdup (server_address);
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ process_arguments (int argc, char **argv)
|
|||
socket_timeout = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage4 (_("Time interval must be a positive integer"));
|
||||
usage4 (_("Timeout interval must be a positive integer"));
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
|
|
@ -371,9 +371,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ main (int argc, char **argv)
|
|||
eval_method[i] & WARN_NE) {
|
||||
p2 = strpbrk (p2, "0123456789");
|
||||
if (p2 == NULL)
|
||||
die (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]);
|
||||
|
|
@ -398,9 +398,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -795,7 +793,7 @@ thisarg (char *str)
|
|||
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, "'"))
|
||||
die (STATE_UNKNOWN, "Unbalanced quotes\n");
|
||||
die (STATE_UNKNOWN, _("Unbalanced quotes\n"));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,9 +110,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
exit (STATE_OK);
|
||||
|
|
@ -135,7 +133,7 @@ process_arguments (int argc, char **argv)
|
|||
#ifdef USE_IPV6
|
||||
address_family = AF_INET6;
|
||||
#else
|
||||
usage (_("IPv6 support not available\n"));
|
||||
usage4 (_("IPv6 support not available"));
|
||||
#endif
|
||||
break;
|
||||
case 'r': /* remote version */
|
||||
|
|
@ -151,11 +149,9 @@ process_arguments (int argc, char **argv)
|
|||
port = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
printf ("Port number nust be a positive integer: %s\n", optarg);
|
||||
usage ("");
|
||||
usage2 (_("Port number must be a positive integer"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c = optind;
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ main (int argc, char **argv)
|
|||
/* and now, tally 'em up */
|
||||
swapctl_res=swapctl(SC_LIST, tbl);
|
||||
if(swapctl_res < 0){
|
||||
perror("swapctl failed: ");
|
||||
perror(_("swapctl failed: "));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ main (int argc, char **argv)
|
|||
/* and now, tally 'em up */
|
||||
swapctl_res=swapctl(SWAP_STATS, ent, nswaps);
|
||||
if(swapctl_res < 0){
|
||||
perror("swapctl failed: ");
|
||||
perror(_("swapctl failed: "));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
else {
|
||||
usage (_("Warning threshold must be integer or percentage!\n"));
|
||||
usage4 (_("Warning threshold must be integer or percentage!"));
|
||||
}
|
||||
case 'c': /* critical size threshold */
|
||||
if (is_intnonneg (optarg)) {
|
||||
|
|
@ -420,9 +420,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* error */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,13 +259,13 @@ main (int argc, char **argv)
|
|||
#ifdef HAVE_SSL
|
||||
if (use_ssl && check_cert == TRUE) {
|
||||
if (connect_SSL () != OK)
|
||||
die (STATE_CRITICAL,"CRITICAL - Could not make SSL connection\n");
|
||||
die (STATE_CRITICAL,_("CRITICAL - Could not make SSL connection\n"));
|
||||
if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
|
||||
result = check_certificate (&server_cert);
|
||||
X509_free(server_cert);
|
||||
}
|
||||
else {
|
||||
printf("CRITICAL - Cannot retrieve server certificate.\n");
|
||||
printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
SSL_shutdown (ssl);
|
||||
|
|
@ -434,7 +434,7 @@ process_arguments (int argc, char **argv)
|
|||
};
|
||||
|
||||
if (argc < 2)
|
||||
usage ("No arguments found\n");
|
||||
usage4 (_("No arguments found"));
|
||||
|
||||
/* backwards compatibility */
|
||||
for (c = 1; c < argc; c++) {
|
||||
|
|
@ -462,14 +462,12 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, "$Revision$");
|
||||
print_revision (progname, revision);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* verbose mode */
|
||||
verbose = TRUE;
|
||||
|
|
@ -575,7 +573,7 @@ process_arguments (int argc, char **argv)
|
|||
case 'D': /* Check SSL cert validity - days 'til certificate expiration */
|
||||
#ifdef HAVE_SSL
|
||||
if (!is_intnonneg (optarg))
|
||||
usage2 ("invalid certificate expiration period", optarg);
|
||||
usage2 (_("Invalid certificate expiration period"), optarg);
|
||||
days_till_exp = atoi (optarg);
|
||||
check_cert = TRUE;
|
||||
use_ssl = TRUE;
|
||||
|
|
@ -583,14 +581,14 @@ process_arguments (int argc, char **argv)
|
|||
case 'S':
|
||||
use_ssl = TRUE;
|
||||
#else
|
||||
die (STATE_UNKNOWN, "SSL support not available. Install OpenSSL and recompile.");
|
||||
die (STATE_UNKNOWN, _("SSL support not available. Install OpenSSL and recompile."));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (server_address == NULL)
|
||||
usage (_("You must provide a server address\n"));
|
||||
usage4 (_("You must provide a server address"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -669,7 +667,7 @@ check_certificate (X509 ** certificate)
|
|||
/* Generate tm structure to process timestamp */
|
||||
if (tm->type == V_ASN1_UTCTIME) {
|
||||
if (tm->length < 10) {
|
||||
printf ("CRITICAL - Wrong time format in certificate.\n");
|
||||
printf (_("CRITICAL - Wrong time format in certificate.\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
|
|
@ -681,7 +679,7 @@ check_certificate (X509 ** certificate)
|
|||
}
|
||||
else {
|
||||
if (tm->length < 12) {
|
||||
printf ("CRITICAL - Wrong time format in certificate.\n");
|
||||
printf (_("CRITICAL - Wrong time format in certificate.\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
|
|
@ -710,20 +708,20 @@ check_certificate (X509 ** certificate)
|
|||
stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min);
|
||||
|
||||
if (days_left > 0 && days_left <= days_till_exp) {
|
||||
printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp);
|
||||
printf (_("Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);
|
||||
return STATE_WARNING;
|
||||
}
|
||||
if (days_left < 0) {
|
||||
printf ("Certificate expired on %s.\n", timestamp);
|
||||
printf (_("Certificate expired on %s.\n"), timestamp);
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
|
||||
if (days_left == 0) {
|
||||
printf ("Certificate expires today (%s).\n", timestamp);
|
||||
printf (_("Certificate expires today (%s).\n"), timestamp);
|
||||
return STATE_WARNING;
|
||||
}
|
||||
|
||||
printf ("Certificate will expire on %s.\n", timestamp);
|
||||
printf (_("Certificate will expire on %s.\n"), timestamp);
|
||||
|
||||
return STATE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,9 +216,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ main (int argc, char **argv)
|
|||
time (&end_time);
|
||||
|
||||
if (result != STATE_OK) {
|
||||
printf ("No response from host on port %d\n", server_port);
|
||||
printf (_("No response from host on port %d\n"), server_port);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ main (int argc, char **argv)
|
|||
/* check to see if we got the response we wanted */
|
||||
if (server_expect) {
|
||||
if (!strstr (recv_buffer, server_expect)) {
|
||||
printf ("Invalid response received from host on port %d\n",
|
||||
printf (_("Invalid response received from host on port %d\n"),
|
||||
server_port);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
|
|
@ -146,9 +146,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -254,8 +252,6 @@ STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n"));
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Original Command line:
|
||||
check_udp <host_address> [-p port] [-s send] [-e expect] \
|
||||
[-wt warn_time] [-ct crit_time] [-to to_sec] */
|
||||
|
|
|
|||
|
|
@ -133,48 +133,48 @@ main (int argc, char **argv)
|
|||
}
|
||||
else if ((status & (UPSSTATUS_OB | UPSSTATUS_LB)) ==
|
||||
(UPSSTATUS_OB | UPSSTATUS_LB)) {
|
||||
asprintf (&ups_status, "On Battery, Low Battery");
|
||||
asprintf (&ups_status, _("On Battery, Low Battery"));
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
if (status & UPSSTATUS_OL) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, "Online");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _("Online"));
|
||||
}
|
||||
if (status & UPSSTATUS_OB) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, "On Battery");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _("On Battery"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
if (status & UPSSTATUS_LB) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Low Battery");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Low Battery"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
if (status & UPSSTATUS_CAL) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Calibrating");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Calibrating"));
|
||||
}
|
||||
if (status & UPSSTATUS_RB) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Replace Battery");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Replace Battery"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
if (status & UPSSTATUS_BYPASS) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", On Bypass");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", On Bypass"));
|
||||
}
|
||||
if (status & UPSSTATUS_OVER) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Overload");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Overload"));
|
||||
}
|
||||
if (status & UPSSTATUS_TRIM) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Trimming");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Trimming"));
|
||||
}
|
||||
if (status & UPSSTATUS_BOOST) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Boosting");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Boosting"));
|
||||
}
|
||||
if (status & UPSSTATUS_CHRG) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Charging");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Charging"));
|
||||
}
|
||||
if (status & UPSSTATUS_DISCHRG) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Discharging");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Discharging"));
|
||||
}
|
||||
if (status & UPSSTATUS_UNKOWN) {
|
||||
asprintf (&ups_status, "%s%s", ups_status, ", Unknown");
|
||||
asprintf (&ups_status, "%s%s", ups_status, _(", Unknown"));
|
||||
}
|
||||
}
|
||||
asprintf (&message, "%sStatus=%s ", message, ups_status);
|
||||
|
|
@ -311,7 +311,7 @@ main (int argc, char **argv)
|
|||
/* if the UPS does not support any options we are looking for, report an error */
|
||||
if (supported_options == UPS_NONE) {
|
||||
result = STATE_CRITICAL;
|
||||
asprintf (&message, "UPS does not support any available options\n");
|
||||
asprintf (&message, _("UPS does not support any available options\n"));
|
||||
}
|
||||
|
||||
/* reset timeout */
|
||||
|
|
@ -335,7 +335,7 @@ determine_status (void)
|
|||
res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer));
|
||||
if (res == NOSUCHVAR) return OK;
|
||||
if (res != STATE_OK) {
|
||||
printf ("Invalid response received from host\n");
|
||||
printf (_("Invalid response received from host\n"));
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
if (process_tcp_request
|
||||
(server_address, server_port, send_buffer, temp_buffer,
|
||||
sizeof (temp_buffer)) != STATE_OK) {
|
||||
printf ("Invalid response received from host\n");
|
||||
printf (_("Invalid response received from host\n"));
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
len = strlen(ptr);
|
||||
if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
|
||||
if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
|
||||
printf ("CRITICAL - no such ups '%s' on that host\n", ups_name);
|
||||
printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
|
@ -413,19 +413,19 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
}
|
||||
|
||||
if (strcmp (ptr, "ERR DATA-STALE") == 0) {
|
||||
printf ("CRITICAL - UPS data is stale\n");
|
||||
printf (_("CRITICAL - UPS data is stale\n"));
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (strncmp (ptr, "ERR", 3) == 0) {
|
||||
printf ("Unknown error: %s\n", ptr);
|
||||
printf (_("Unknown error: %s\n"), ptr);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6;
|
||||
len = strlen(ptr);
|
||||
if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') {
|
||||
printf ("Error: unable to parse variable\n");
|
||||
printf (_("Error: unable to parse variable\n"));
|
||||
return ERROR;
|
||||
}
|
||||
strncpy (buf, ptr+1, len - 2);
|
||||
|
|
@ -481,9 +481,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'H': /* hostname */
|
||||
if (is_host (optarg)) {
|
||||
server_address = optarg;
|
||||
|
|
@ -503,7 +501,7 @@ process_arguments (int argc, char **argv)
|
|||
server_port = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage2 ("Port must be a positive integer", optarg);
|
||||
usage2 (_("Port must be a positive integer"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'c': /* critical time threshold */
|
||||
|
|
@ -512,7 +510,7 @@ process_arguments (int argc, char **argv)
|
|||
check_crit = TRUE;
|
||||
}
|
||||
else {
|
||||
usage2 ("Critical time must be a positive integer", optarg);
|
||||
usage2 (_("Critical time must be a positive integer"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'w': /* warning time threshold */
|
||||
|
|
@ -521,7 +519,7 @@ process_arguments (int argc, char **argv)
|
|||
check_warn = TRUE;
|
||||
}
|
||||
else {
|
||||
usage2 ("Warning time must be a positive integer", optarg);
|
||||
usage2 (_("Warning time must be a positive integer"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'v': /* variable */
|
||||
|
|
@ -534,14 +532,14 @@ process_arguments (int argc, char **argv)
|
|||
else if (!strcmp (optarg, "LOADPCT"))
|
||||
check_variable = UPS_LOADPCT;
|
||||
else
|
||||
usage2 ("Unrecognized UPS variable", optarg);
|
||||
usage2 (_("Unrecognized UPS variable"), optarg);
|
||||
break;
|
||||
case 't': /* timeout */
|
||||
if (is_intnonneg (optarg)) {
|
||||
socket_timeout = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage ("Time interval must be a positive integer\n");
|
||||
usage4 (_("Timeout interval must be a positive integer"));
|
||||
}
|
||||
break;
|
||||
case 'V': /* version */
|
||||
|
|
@ -568,19 +566,17 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
if (! ups_name) {
|
||||
printf ("Error : no ups indicated\n");
|
||||
printf (_("Error : no ups indicated\n"));
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
|
@ -641,7 +637,6 @@ http://www.networkupstools.org\n\n"));
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -140,9 +140,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
@ -151,13 +149,13 @@ process_arguments (int argc, char **argv)
|
|||
exit (STATE_OK);
|
||||
case 'c': /* critical */
|
||||
if (!is_intnonneg (optarg))
|
||||
usage (_("Critical threshold must be a positive integer\n"));
|
||||
usage4 (_("Critical threshold must be a positive integer"));
|
||||
else
|
||||
cusers = atoi (optarg);
|
||||
break;
|
||||
case 'w': /* warning */
|
||||
if (!is_intnonneg (optarg))
|
||||
usage (_("Warning threshold must be a positive integer\n"));
|
||||
usage4 (_("Warning threshold must be a positive integer"));
|
||||
else
|
||||
wusers = atoi (optarg);
|
||||
break;
|
||||
|
|
@ -167,14 +165,14 @@ process_arguments (int argc, char **argv)
|
|||
c = optind;
|
||||
if (wusers == -1 && argc > c) {
|
||||
if (is_intnonneg (argv[c]) == FALSE)
|
||||
usage (_("Warning threshold must be a positive integer\n"));
|
||||
usage4 (_("Warning threshold must be a positive integer"));
|
||||
else
|
||||
wusers = atoi (argv[c++]);
|
||||
}
|
||||
|
||||
if (cusers == -1 && argc > c) {
|
||||
if (is_intnonneg (argv[c]) == FALSE)
|
||||
usage (_("Warning threshold must be a positive integer\n"));
|
||||
usage4 (_("Warning threshold must be a positive integer"));
|
||||
else
|
||||
cusers = atoi (argv[c]);
|
||||
}
|
||||
|
|
@ -210,7 +208,6 @@ system and generates an error if the number exceeds the thresholds specified.\n"
|
|||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_usage (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -174,9 +174,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
break;
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ void
|
|||
socket_timeout_alarm_handler (int sig)
|
||||
{
|
||||
if (sig == SIGALRM)
|
||||
printf ("CRITICAL - Socket timeout after %d seconds\n", socket_timeout);
|
||||
printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout);
|
||||
else
|
||||
printf ("CRITICAL - Abnormal timeout after %d seconds\n", socket_timeout);
|
||||
printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout);
|
||||
|
||||
exit (STATE_CRITICAL);
|
||||
}
|
||||
|
|
@ -106,7 +106,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
|
||||
send_result = send (sd, send_buffer, strlen (send_buffer), 0);
|
||||
if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) {
|
||||
printf ("Send failed\n");
|
||||
printf (_("Send failed\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
if (!FD_ISSET (sd, &readfds)) { /* it hasn't */
|
||||
if (!recv_length) {
|
||||
strcpy (recv_buffer, "");
|
||||
printf ("No data was received from host!\n");
|
||||
printf (_("No data was received from host!\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
else { /* this one failed, but previous ones worked */
|
||||
|
|
@ -239,7 +239,7 @@ my_connect (const char *host_name, int port, int *sd, int proto)
|
|||
SOCK_DGRAM : SOCK_STREAM, res->ai_protocol);
|
||||
|
||||
if (*sd < 0) {
|
||||
printf ("Socket creation failed\n");
|
||||
printf (_("Socket creation failed\n"));
|
||||
freeaddrinfo (res);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
|
@ -315,7 +315,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
|
|||
|
||||
send_result = send (sd, send_buffer, strlen (send_buffer), 0);
|
||||
if (send_result<0 || (size_t)send_result!=strlen(send_buffer)) {
|
||||
printf ("Send failed\n");
|
||||
printf (_("Send failed\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +330,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
|
|||
/* make sure some data has arrived */
|
||||
if (!FD_ISSET (sd, &readfds)) {
|
||||
strcpy (recv_buffer, "");
|
||||
printf ("No data was received from host!\n");
|
||||
printf (_("No data was received from host!\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
|
|
@ -339,7 +339,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
|
|||
if (recv_result == -1) {
|
||||
strcpy (recv_buffer, "");
|
||||
if (proto != IPPROTO_TCP)
|
||||
printf ("Receive failed\n");
|
||||
printf (_("Receive failed\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ spopen (const char *cmdstring)
|
|||
argv = malloc (sizeof(char*)*argc);
|
||||
|
||||
if (argv == NULL) {
|
||||
printf ("Could not malloc argv array in popen()\n");
|
||||
printf (_("Could not malloc argv array in popen()\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ spopen (const char *cmdstring)
|
|||
str += strspn (str, " \t\r\n"); /* trim any leading whitespace */
|
||||
|
||||
if (i >= argc - 2) {
|
||||
printf ("CRITICAL - You need more args!!!\n");
|
||||
printf (_("CRITICAL - You need more args!!!\n"));
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
|
@ -239,17 +239,19 @@ static int openmax = 0;
|
|||
#define OPEN_MAX_GUESS 256 /* if OPEN_MAX is indeterminate */
|
||||
/* no guarantee this is adequate */
|
||||
|
||||
|
||||
void
|
||||
popen_timeout_alarm_handler (int signo)
|
||||
{
|
||||
if (signo == SIGALRM) {
|
||||
kill (childpid[fileno (child_process)], SIGKILL);
|
||||
printf ("CRITICAL - Plugin timed out after %d seconds\n",
|
||||
printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
|
||||
timeout_interval);
|
||||
exit (STATE_CRITICAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
open_max (void)
|
||||
{
|
||||
|
|
@ -259,14 +261,13 @@ open_max (void)
|
|||
if (errno == 0)
|
||||
openmax = OPEN_MAX_GUESS; /* it's indeterminate */
|
||||
else
|
||||
err_sys ("sysconf error for _SC_OPEN_MAX");
|
||||
err_sys (_("sysconf error for _SC_OPEN_MAX"));
|
||||
}
|
||||
}
|
||||
return (openmax);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Fatal error related to a system call.
|
||||
* Print a message and die. */
|
||||
|
||||
|
|
@ -309,4 +310,3 @@ rtrim (char *str, const char *tok)
|
|||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,9 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
FILE *spopen (const char *);
|
||||
int spclose (FILE *);
|
||||
RETSIGTYPE popen_timeout_alarm_handler (int);
|
||||
|
|
|
|||
|
|
@ -71,9 +71,7 @@ main (int argc, char **argv)
|
|||
break;
|
||||
case '?':
|
||||
default:
|
||||
printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ max_state (int a, int b)
|
|||
|
||||
void usage (const char *msg)
|
||||
{
|
||||
printf ("%s", msg);
|
||||
printf ("%s\n", msg);
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ void
|
|||
timeout_alarm_handler (int signo)
|
||||
{
|
||||
if (signo == SIGALRM) {
|
||||
printf ("CRITICAL - Plugin timed out after %d seconds\n",
|
||||
printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
|
||||
timeout_interval);
|
||||
exit (STATE_CRITICAL);
|
||||
}
|
||||
|
|
@ -430,7 +430,7 @@ strpcpy (char *dest, const char *src, const char *str)
|
|||
if (dest == NULL || strlen (dest) < len)
|
||||
dest = realloc (dest, len + 1);
|
||||
if (dest == NULL)
|
||||
die (STATE_UNKNOWN, "failed realloc in strpcpy\n");
|
||||
die (STATE_UNKNOWN, _("failed realloc in strpcpy\n"));
|
||||
|
||||
strncpy (dest, src, len);
|
||||
dest[len] = '\0';
|
||||
|
|
@ -472,7 +472,7 @@ strpcat (char *dest, const char *src, const char *str)
|
|||
|
||||
dest = realloc (dest, len + l2 + 1);
|
||||
if (dest == NULL)
|
||||
die (STATE_UNKNOWN, "failed malloc in strscat\n");
|
||||
die (STATE_UNKNOWN, _("failed malloc in strscat\n"));
|
||||
|
||||
strncpy (dest + len, src, l2);
|
||||
dest[len + l2] = '\0';
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue