mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-02-20 08:20:36 -05:00
markup for translation
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@661 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
parent
ee37af8e56
commit
92cd137176
2 changed files with 211 additions and 197 deletions
|
|
@ -64,9 +64,10 @@ int show_all=FALSE;
|
|||
const char *progname = "check_nt";
|
||||
|
||||
int process_arguments(int, char **);
|
||||
void print_usage(void);
|
||||
void print_help(void);
|
||||
void preparelist(char *string);
|
||||
int strtoularray(unsigned long *array, char *string, char *delim);
|
||||
void print_help(void);
|
||||
void print_usage(void);
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int result;
|
||||
|
|
@ -91,10 +92,10 @@ int main(int argc, char **argv){
|
|||
int uphours=0;
|
||||
int upminutes=0;
|
||||
|
||||
asprintf(&req_password,"None");
|
||||
asprintf(&req_password, _("None"));
|
||||
|
||||
if(process_arguments(argc,argv)==ERROR)
|
||||
usage("Could not parse arguments\n");
|
||||
usage(_("Could not parse arguments\n"));
|
||||
|
||||
/* initialize alarm signal handling */
|
||||
signal(SIGALRM,socket_timeout_alarm_handler);
|
||||
|
|
@ -116,15 +117,15 @@ int main(int argc, char **argv){
|
|||
else if(vars_to_check==CHECK_CPULOAD){
|
||||
|
||||
if (check_value_list==TRUE) {
|
||||
if (strtolarray(&lvalue_list,value_list,",")==TRUE) {
|
||||
if (strtoularray(&lvalue_list,value_list,",")==TRUE) {
|
||||
/* -l parameters is present with only integers */
|
||||
return_code=STATE_OK;
|
||||
asprintf(&temp_string,"CPU Load");
|
||||
while (lvalue_list[0+offset]>(unsigned long)0 &&
|
||||
asprintf(&temp_string,_("CPU Load"));
|
||||
while (lvalue_list[0+offset]> (unsigned long)0 &&
|
||||
lvalue_list[0+offset]<=(unsigned long)17280 &&
|
||||
lvalue_list[1+offset]>=(unsigned long)0 &&
|
||||
lvalue_list[1+offset]> (unsigned long)0 &&
|
||||
lvalue_list[1+offset]<=(unsigned long)100 &&
|
||||
lvalue_list[2+offset]>=(unsigned long)0 &&
|
||||
lvalue_list[2+offset]> (unsigned long)0 &&
|
||||
lvalue_list[2+offset]<=(unsigned long)100) {
|
||||
/* loop until one of the parameters is wrong or not present */
|
||||
|
||||
|
|
@ -147,7 +148,7 @@ int main(int argc, char **argv){
|
|||
else if(utilization >= lvalue_list[1+offset] && return_code<STATE_WARNING)
|
||||
return_code=STATE_WARNING;
|
||||
|
||||
asprintf(&output_message," %lu%% (%lu min average)", utilization, lvalue_list[0+offset]);
|
||||
asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]);
|
||||
asprintf(&temp_string,"%s%s",temp_string,output_message);
|
||||
offset+=3; /* move across the array */
|
||||
}
|
||||
|
|
@ -156,13 +157,13 @@ int main(int argc, char **argv){
|
|||
asprintf(&output_message,"%s",temp_string);
|
||||
}
|
||||
else
|
||||
asprintf(&output_message,"%s","not enough values for -l parameters");
|
||||
asprintf(&output_message,"%s",_("not enough values for -l parameters"));
|
||||
|
||||
} else
|
||||
asprintf(&output_message,"wrong -l parameter.");
|
||||
asprintf(&output_message,_("wrong -l parameter."));
|
||||
|
||||
} else
|
||||
asprintf(&output_message,"missing -l parameters");
|
||||
asprintf(&output_message,_("missing -l parameters"));
|
||||
}
|
||||
|
||||
else if(vars_to_check==CHECK_UPTIME){
|
||||
|
|
@ -181,7 +182,7 @@ int main(int argc, char **argv){
|
|||
updays = uptime / 86400;
|
||||
uphours = (uptime % 86400) / 3600;
|
||||
upminutes = ((uptime % 86400) % 3600) / 60;
|
||||
asprintf(&output_message,"System Uptime : %u day(s) %u hour(s) %u minute(s)",updays,uphours, upminutes);
|
||||
asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
|
||||
return_code=STATE_OK;
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ int main(int argc, char **argv){
|
|||
percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100;
|
||||
|
||||
if (free_disk_space>=0) {
|
||||
asprintf(&temp_string,"%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)",
|
||||
asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
|
||||
value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, percent_used_space,
|
||||
free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100);
|
||||
|
||||
|
|
@ -221,14 +222,14 @@ int main(int argc, char **argv){
|
|||
|
||||
}
|
||||
else {
|
||||
asprintf(&output_message,"Free disk space : Invalid drive ");
|
||||
asprintf(&output_message,_("Free disk space : Invalid drive "));
|
||||
return_code=STATE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
asprintf(&output_message,"wrong -l argument");
|
||||
asprintf(&output_message,_("wrong -l argument"));
|
||||
} else
|
||||
asprintf(&output_message,"missing -l parameters");
|
||||
asprintf(&output_message,_("missing -l parameters"));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +238,7 @@ int main(int argc, char **argv){
|
|||
if (check_value_list==TRUE) {
|
||||
preparelist(value_list); /* replace , between services with & to send the request */
|
||||
asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
|
||||
(show_all==TRUE)?"ShowAll":"ShowFail",value_list);
|
||||
(show_all==TRUE)?_("ShowAll"):_("ShowFail"),value_list);
|
||||
result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
|
||||
if(result!=STATE_OK)
|
||||
return result;
|
||||
|
|
@ -251,7 +252,7 @@ int main(int argc, char **argv){
|
|||
asprintf(&output_message, "%s",temp_string);
|
||||
}
|
||||
else
|
||||
asprintf(&output_message,"No service/process specified");
|
||||
asprintf(&output_message,_("No service/process specified"));
|
||||
}
|
||||
|
||||
else if(vars_to_check==CHECK_MEMUSE) {
|
||||
|
|
@ -269,7 +270,7 @@ int main(int argc, char **argv){
|
|||
mem_commitLimit=atof(strtok(recv_buffer,"&"));
|
||||
mem_commitByte=atof(strtok(NULL,"&"));
|
||||
percent_used_space = (mem_commitByte / mem_commitLimit) * 100;
|
||||
asprintf(&output_message,"Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)",
|
||||
asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
|
||||
mem_commitLimit / 1048576, mem_commitByte / 1048567, percent_used_space,
|
||||
(mem_commitLimit - mem_commitByte) / 1048576, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
|
||||
|
||||
|
|
@ -325,7 +326,7 @@ int main(int argc, char **argv){
|
|||
|
||||
}
|
||||
else {
|
||||
asprintf(&output_message,"No counter specified");
|
||||
asprintf(&output_message,_("No counter specified"));
|
||||
result=STATE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
@ -368,7 +369,7 @@ int main(int argc, char **argv){
|
|||
|
||||
}
|
||||
else {
|
||||
asprintf(&output_message,"No file specified");
|
||||
asprintf(&output_message,_("No file specified"));
|
||||
result=STATE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
@ -382,6 +383,10 @@ int main(int argc, char **argv){
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int process_arguments(int argc, char **argv){
|
||||
int c;
|
||||
|
|
@ -448,7 +453,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 (seconds)\nType '%s -h' for additional help\n"),progname);
|
||||
break;
|
||||
case 'v':
|
||||
if(strlen(optarg)<4)
|
||||
|
|
@ -505,91 +510,17 @@ int process_arguments(int argc, char **argv){
|
|||
}
|
||||
|
||||
|
||||
void print_usage(void)
|
||||
{
|
||||
printf("Usage: %s -H host -v variable [-p port] [-w warning] [-c critical] [-l params] [-d SHOWALL] [-t timeout]\n",progname);
|
||||
}
|
||||
|
||||
|
||||
void print_help(void)
|
||||
{
|
||||
print_revision(progname,"$Revision$");
|
||||
printf ("\
|
||||
Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n\n\
|
||||
This plugin collects data from the NSClient service running on a\n\
|
||||
Windows NT/2000/XP server.\n\n");
|
||||
print_usage();
|
||||
printf ("\nOptions:\n\
|
||||
-H, --hostname=HOST\n\
|
||||
Name of the host to check\n\
|
||||
-p, --port=INTEGER\n\
|
||||
Optional port number (default: %d)\n\
|
||||
-s <password>\n\
|
||||
Password needed for the request\n\
|
||||
-w, --warning=INTEGER\n\
|
||||
Threshold which will result in a warning status\n\
|
||||
-c, --critical=INTEGER\n\
|
||||
Threshold which will result in a critical status\n\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before connection attempt times out (default: %d)\n\
|
||||
-h, --help\n\
|
||||
Print this help screen\n\
|
||||
-V, --version\n\
|
||||
Print version information\n",
|
||||
PORT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf ("\
|
||||
-v, --variable=STRING\n\
|
||||
Variable to check. Valid variables are:\n");
|
||||
printf ("\
|
||||
CLIENTVERSION = Get the NSClient version\n");
|
||||
printf ("\
|
||||
CPULOAD = Average CPU load on last x minutes.\n\
|
||||
Request a -l parameter with the following syntax:\n\
|
||||
-l <minutes range>,<warning threshold>,<critical threshold>.\n\
|
||||
<minute range> should be less than 24*60.\n\
|
||||
Thresholds are percentage and up to 10 requests can be done in one shot.\n\
|
||||
ie: -l 60,90,95,120,90,95\n");
|
||||
printf ("\
|
||||
UPTIME = Get the uptime of the machine.\n\
|
||||
No specific parameters. No warning or critical threshold\n");
|
||||
printf ("\
|
||||
USEDDISKSPACE = Size and percentage of disk use.\n\
|
||||
Request a -l parameter containing the drive letter only.\n\
|
||||
Warning and critical thresholds can be specified with -w and -c.\n");
|
||||
printf ("\
|
||||
MEMUSE = Memory use.\n\
|
||||
Warning and critical thresholds can be specified with -w and -c.\n");
|
||||
printf ("\
|
||||
SERVICESTATE = Check the state of one or several services.\n\
|
||||
Request a -l parameters with the following syntax:\n\
|
||||
-l <service1>,<service2>,<service3>,...\n\
|
||||
You can specify -d SHOWALL in case you want to see working services\n\
|
||||
in the returned string.\n");
|
||||
printf ("\
|
||||
PROCSTATE = Check if one or several process are running.\n\
|
||||
Same syntax as SERVICESTATE.\n");
|
||||
printf ("\
|
||||
COUNTER = Check any performance counter of Windows NT/2000.\n\
|
||||
Request a -l parameters with the following syntax:\n\
|
||||
-l \"\\\\<performance object>\\\\counter\",\"<description>\n\
|
||||
The <description> parameter is optional and \n\
|
||||
is given to a printf output command which require a float parameters.\n\
|
||||
Some examples:\n\
|
||||
\"Paging file usage is %%.2f %%%%\"\n\
|
||||
\"%%.f %%%% paging file used.\"\n");
|
||||
printf ("Notes:\n\
|
||||
- The NSClient service should be running on the server to get any information\n\
|
||||
(http://nsclient.ready2run.nl).\n\
|
||||
- Critical thresholds should be lower than warning thresholds\n");
|
||||
}
|
||||
|
||||
int strtolarray(unsigned long *array, char *string, char *delim) {
|
||||
|
||||
int strtoularray(unsigned long *array, char *string, char *delim) {
|
||||
/* split a <delim> delimited string into a long array */
|
||||
int idx=0;
|
||||
char *t1;
|
||||
|
||||
for (idx=0;idx<MAX_VALUE_LIST;idx++)
|
||||
array[idx]=-1;
|
||||
array[idx]=0;
|
||||
|
||||
idx=0;
|
||||
for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
|
||||
|
|
@ -612,3 +543,90 @@ void preparelist(char *string) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void print_help(void)
|
||||
{
|
||||
print_revision(progname,"$Revision$");
|
||||
printf (_("\
|
||||
Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n\n\
|
||||
This plugin collects data from the NSClient service running on a\n\
|
||||
Windows NT/2000/XP server.\n\n"));
|
||||
print_usage();
|
||||
printf (_("\nOptions:\n\
|
||||
-H, --hostname=HOST\n\
|
||||
Name of the host to check\n\
|
||||
-p, --port=INTEGER\n\
|
||||
Optional port number (default: %d)\n\
|
||||
-s <password>\n\
|
||||
Password needed for the request\n\
|
||||
-w, --warning=INTEGER\n\
|
||||
Threshold which will result in a warning status\n\
|
||||
-c, --critical=INTEGER\n\
|
||||
Threshold which will result in a critical status\n\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before connection attempt times out (default: %d)\n\
|
||||
-h, --help\n\
|
||||
Print this help screen\n\
|
||||
-V, --version\n\
|
||||
Print version information\n"),
|
||||
PORT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (_("\
|
||||
-v, --variable=STRING\n\
|
||||
Variable to check. Valid variables are:\n"));
|
||||
printf (_("\
|
||||
CLIENTVERSION = Get the NSClient version\n"));
|
||||
printf (_("\
|
||||
CPULOAD = Average CPU load on last x minutes.\n\
|
||||
Request a -l parameter with the following syntax:\n\
|
||||
-l <minutes range>,<warning threshold>,<critical threshold>.\n\
|
||||
<minute range> should be less than 24*60.\n\
|
||||
Thresholds are percentage and up to 10 requests can be done in one shot.\n\
|
||||
ie: -l 60,90,95,120,90,95\n"));
|
||||
printf (_("\
|
||||
UPTIME = Get the uptime of the machine.\n\
|
||||
No specific parameters. No warning or critical threshold\n"));
|
||||
printf (_("\
|
||||
USEDDISKSPACE = Size and percentage of disk use.\n\
|
||||
Request a -l parameter containing the drive letter only.\n\
|
||||
Warning and critical thresholds can be specified with -w and -c.\n"));
|
||||
printf (_("\
|
||||
MEMUSE = Memory use.\n\
|
||||
Warning and critical thresholds can be specified with -w and -c.\n"));
|
||||
printf (_("\
|
||||
SERVICESTATE = Check the state of one or several services.\n\
|
||||
Request a -l parameters with the following syntax:\n\
|
||||
-l <service1>,<service2>,<service3>,...\n\
|
||||
You can specify -d SHOWALL in case you want to see working services\n\
|
||||
in the returned string.\n"));
|
||||
printf (_("\
|
||||
PROCSTATE = Check if one or several process are running.\n\
|
||||
Same syntax as SERVICESTATE.\n"));
|
||||
printf (_("\
|
||||
COUNTER = Check any performance counter of Windows NT/2000.\n\
|
||||
Request a -l parameters with the following syntax:\n\
|
||||
-l \"\\\\<performance object>\\\\counter\",\"<description>\n\
|
||||
The <description> parameter is optional and \n\
|
||||
is given to a printf output command which require a float parameters.\n\
|
||||
Some examples:\n\
|
||||
\"Paging file usage is %%.2f %%%%\"\n\
|
||||
\"%%.f %%%% paging file used.\"\n"));
|
||||
printf (_("Notes:\n\
|
||||
- The NSClient service should be running on the server to get any information\n\
|
||||
(http://nsclient.ready2run.nl).\n\
|
||||
- Critical thresholds should be lower than warning thresholds\n"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void print_usage(void)
|
||||
{
|
||||
printf(_("\
|
||||
Usage: %s -H host -v variable [-p port] [-w warning] [-c critical]\n\
|
||||
[-l params] [-d SHOWALL] [-t timeout]\n"), progname);
|
||||
printf (_(UT_HLP_VRS), progname, progname);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,70 +1,29 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_smtp";
|
||||
const char *revision = "$Revision$";
|
||||
const char *copyright = "1999-2003";
|
||||
const char *authors = "Nagios Plugin Development Team";
|
||||
const char *copyright = "2000-2003";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
const char *summary = "\
|
||||
This plugin will attempt to open an SMTP connection with the host.\n";
|
||||
|
||||
const char *description = "\
|
||||
Successul connects return STATE_OK, refusals and timeouts return\n\
|
||||
STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful\n\
|
||||
connects, but incorrect reponse messages from the host result in\n\
|
||||
STATE_WARNING return values.\n";
|
||||
|
||||
const char *option_summary = "\
|
||||
-H host [-p port] [-e expect] [-C command] [-f from addr]\n\
|
||||
[-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]";
|
||||
|
||||
const char *options = "\
|
||||
-H, --hostname=STRING or IPADDRESS\n\
|
||||
Check server on the indicated host\n\
|
||||
-4, --use-ipv4\n\
|
||||
Use IPv4 protocol\n\
|
||||
-6, --use-ipv6\n\
|
||||
Use IPv6 protocol\n\
|
||||
-p, --port=INTEGER\n\
|
||||
Make connection on the indicated port (default: %d)\n\
|
||||
-e, --expect=STRING\n\
|
||||
String to expect in first line of server response (default: '%s')\n\
|
||||
-n, nocommand\n\
|
||||
Suppress SMTP command\n\
|
||||
-C, --command=STRING\n\
|
||||
SMTP command (default: '%s')\n\
|
||||
-f, --from=STRING\n\
|
||||
FROM-address to include in MAIL command, required by Exchange 2000\n\
|
||||
(default: '%s')\n\
|
||||
-w, --warning=INTEGER\n\
|
||||
Seconds necessary to result in a warning status\n\
|
||||
-c, --critical=INTEGER\n\
|
||||
Seconds necessary to result in a critical status\n\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before connection attempt times out (default: %d)\n\
|
||||
-v, --verbose\n\
|
||||
Print extra information (command-line use only)\n\
|
||||
-h, --help\n\
|
||||
Print detailed help screen\n\
|
||||
-V, --version\n\
|
||||
Print version information\n\n";
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
enum {
|
||||
SMTP_PORT = 25
|
||||
|
|
@ -73,11 +32,6 @@ const char *SMTP_EXPECT = "220";
|
|||
const char *SMTP_HELO = "HELO ";
|
||||
const char *SMTP_QUIT = "QUIT\r\n";
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
int process_arguments (int, char **);
|
||||
int validate_arguments (void);
|
||||
void print_help (void);
|
||||
|
|
@ -95,6 +49,11 @@ int critical_time = 0;
|
|||
int check_critical_time = FALSE;
|
||||
int verbose = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
|
@ -107,7 +66,7 @@ main (int argc, char **argv)
|
|||
struct timeval tv;
|
||||
|
||||
if (process_arguments (argc, argv) != OK)
|
||||
usage ("Invalid command arguments supplied\n");
|
||||
usage (_("Invalid command arguments supplied\n"));
|
||||
|
||||
/* initialize the HELO command with the localhostname */
|
||||
#ifndef HOST_MAX_BYTES
|
||||
|
|
@ -141,7 +100,7 @@ main (int argc, char **argv)
|
|||
/* watch for the SMTP connection string and */
|
||||
/* return a WARNING status if we couldn't read any data */
|
||||
if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) == -1) {
|
||||
printf ("recv() failed\n");
|
||||
printf (_("recv() failed\n"));
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
else {
|
||||
|
|
@ -150,9 +109,9 @@ main (int argc, char **argv)
|
|||
/* make sure we find the response we are looking for */
|
||||
if (!strstr (buffer, server_expect)) {
|
||||
if (server_port == SMTP_PORT)
|
||||
printf ("Invalid SMTP response received from host\n");
|
||||
printf (_("Invalid SMTP response received from host\n"));
|
||||
else
|
||||
printf ("Invalid SMTP response received from host on port %d\n",
|
||||
printf (_("Invalid SMTP response received from host on port %d\n"),
|
||||
server_port);
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
|
@ -182,7 +141,7 @@ main (int argc, char **argv)
|
|||
recv(sd, buffer, MAX_INPUT_BUFFER-1, 0);
|
||||
|
||||
if (verbose)
|
||||
printf("DUMMYCMD: %s\n%s\n",from_str,buffer);
|
||||
printf(_("DUMMYCMD: %s\n%s\n"),from_str,buffer);
|
||||
|
||||
} /* smtp_use_dummycmd */
|
||||
|
||||
|
|
@ -204,10 +163,10 @@ main (int argc, char **argv)
|
|||
result = STATE_WARNING;
|
||||
|
||||
if (verbose)
|
||||
printf ("SMTP %s - %.3f sec. response time, %s|time=%.3f\n",
|
||||
printf (_("SMTP %s - %.3f sec. response time, %s|time=%.3f\n"),
|
||||
state_text (result), elapsed_time, buffer, elapsed_time);
|
||||
else
|
||||
printf ("SMTP %s - %.3f second response time|time=%.3f\n",
|
||||
printf (_("SMTP %s - %.3f second response time|time=%.3f\n"),
|
||||
state_text (result), elapsed_time, elapsed_time);
|
||||
|
||||
return result;
|
||||
|
|
@ -217,7 +176,7 @@ main (int argc, char **argv)
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
|
|
@ -268,16 +227,14 @@ process_arguments (int argc, char **argv)
|
|||
server_address = optarg;
|
||||
}
|
||||
else {
|
||||
usage ("Invalid host name\n");
|
||||
usage (_("Invalid host name\n"));
|
||||
}
|
||||
break;
|
||||
case 'p': /* port */
|
||||
if (is_intpos (optarg)) {
|
||||
if (is_intpos (optarg))
|
||||
server_port = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage ("Server port must be a positive integer\n");
|
||||
}
|
||||
else
|
||||
usage (_("Server port must be a positive integer\n"));
|
||||
break;
|
||||
case 'f': /* from argument */
|
||||
from_arg = optarg;
|
||||
|
|
@ -298,7 +255,7 @@ process_arguments (int argc, char **argv)
|
|||
check_critical_time = TRUE;
|
||||
}
|
||||
else {
|
||||
usage ("Critical time must be a nonnegative integer\n");
|
||||
usage (_("Critical time must be a nonnegative integer\n"));
|
||||
}
|
||||
break;
|
||||
case 'w': /* warning time threshold */
|
||||
|
|
@ -307,7 +264,7 @@ process_arguments (int argc, char **argv)
|
|||
check_warning_time = TRUE;
|
||||
}
|
||||
else {
|
||||
usage ("Warning time must be a nonnegative integer\n");
|
||||
usage (_("Warning time must be a nonnegative integer\n"));
|
||||
}
|
||||
break;
|
||||
case 'v': /* verbose */
|
||||
|
|
@ -318,7 +275,7 @@ process_arguments (int argc, char **argv)
|
|||
socket_timeout = atoi (optarg);
|
||||
}
|
||||
else {
|
||||
usage ("Time interval must be a nonnegative integer\n");
|
||||
usage (_("Time interval must be a nonnegative integer\n"));
|
||||
}
|
||||
break;
|
||||
case '4':
|
||||
|
|
@ -328,7 +285,7 @@ process_arguments (int argc, char **argv)
|
|||
#ifdef USE_IPV6
|
||||
address_family = AF_INET6;
|
||||
#else
|
||||
usage ("IPv6 support not available\n");
|
||||
usage (_("IPv6 support not available\n"));
|
||||
#endif
|
||||
break;
|
||||
case 'V': /* version */
|
||||
|
|
@ -338,7 +295,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage ("Invalid argument\n");
|
||||
usage (_("Invalid argument\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +305,7 @@ process_arguments (int argc, char **argv)
|
|||
if (is_host (argv[c]))
|
||||
server_address = argv[c];
|
||||
else
|
||||
usage ("Invalid host name");
|
||||
usage (_("Invalid host name"));
|
||||
}
|
||||
else {
|
||||
asprintf (&server_address, "127.0.0.1");
|
||||
|
|
@ -375,17 +332,53 @@ validate_arguments (void)
|
|||
|
||||
|
||||
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
char *myport;
|
||||
asprintf (&myport, "%d", SMTP_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
printf ("Copyright (c) %s %s\n\t<%s>\n\n%s\n",
|
||||
copyright, authors, email, summary);
|
||||
|
||||
printf (_("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n"));
|
||||
printf (_(COPYRIGHT), copyright, email);
|
||||
|
||||
printf(_("\
|
||||
This plugin will attempt to open an SMTP connection with the host.\n\n"));
|
||||
|
||||
print_usage ();
|
||||
printf ("\nOptions:\n");
|
||||
printf (options, SMTP_PORT, SMTP_EXPECT, mail_command, from_arg,
|
||||
DEFAULT_SOCKET_TIMEOUT);
|
||||
support ();
|
||||
|
||||
printf (_(UT_HELP_VRSN));
|
||||
|
||||
printf (_(UT_HOST_PORT), 'p', myport);
|
||||
|
||||
printf (_(UT_IPv46));
|
||||
|
||||
printf (_("\
|
||||
-e, --expect=STRING\n\
|
||||
String to expect in first line of server response (default: '%s')\n\
|
||||
-n, nocommand\n\
|
||||
Suppress SMTP command\n\
|
||||
-C, --command=STRING\n\
|
||||
SMTP command (default: '%s')\n\
|
||||
-f, --from=STRING\n\
|
||||
FROM-address to include in MAIL command, required by Exchange 2000\n\
|
||||
(default: '%s')\n"), SMTP_EXPECT, mail_command, from_arg);
|
||||
|
||||
printf (_(UT_WARN_CRIT));
|
||||
|
||||
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (_(UT_VERBOSE));
|
||||
|
||||
printf(_("\n\
|
||||
Successul connects return STATE_OK, refusals and timeouts return\n\
|
||||
STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful\n\
|
||||
connects, but incorrect reponse messages from the host result in\n\
|
||||
STATE_WARNING return values.\n"));
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -395,8 +388,11 @@ print_help (void)
|
|||
void
|
||||
print_usage (void)
|
||||
{
|
||||
printf ("Usage: %s %s\n"
|
||||
" %s --help\n"
|
||||
" %s --version\n",
|
||||
progname, option_summary, progname, progname);
|
||||
printf ("\
|
||||
Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
|
||||
[-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname);
|
||||
printf (_(UT_HLP_VRS), progname, progname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue