summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c48edf)
raw | patch | inline | side by side (parent: 3c48edf)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 2 Aug 2003 22:06:06 +0000 (22:06 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Sat, 2 Aug 2003 22:06:06 +0000 (22:06 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@634 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/plugins/check_fping.c b/plugins/check_fping.c
index 86170d57900bb866d6fd206407b7dfa163f19d68..16e177cec2cdf2efe80dcf72768614927a213a3c 100644 (file)
--- a/plugins/check_fping.c
+++ b/plugins/check_fping.c
percentage of packet loss to trigger an alarm state.\n"));
}
-
+\f
int textscan (char *buf);
int process_arguments (int, char **);
int get_threshold (char *arg, char *rv[2]);
input_buffer = malloc (MAX_INPUT_BUFFER);
if (process_arguments (argc, argv) == ERROR)
- usage ("Could not parse arguments\n");
+ usage (_("Could not parse arguments\n"));
server = strscpy (server, server_name);
/* run the command */
child_process = spopen (command_line);
if (child_process == NULL) {
- printf ("Unable to open pipe: %s\n", command_line);
+ printf (_("Unable to open pipe: %s\n"), command_line);
return STATE_UNKNOWN;
}
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
if (child_stderr == NULL) {
- printf ("Could not open stderr for %s\n", command_line);
+ printf (_("Could not open stderr for %s\n"), command_line);
}
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
int status = STATE_UNKNOWN;
if (strstr (buf, "not found")) {
- terminate (STATE_CRITICAL, "FPING unknown - %s not found\n", server_name);
+ terminate (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
}
else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
- terminate (STATE_CRITICAL, "FPING critical - %s is unreachable\n",
+ terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
"host");
}
else if (strstr (buf, "is down")) {
- terminate (STATE_CRITICAL, "FPING critical - %s is down\n", server_name);
+ terminate (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
}
else if (strstr (buf, "is alive")) {
status = STATE_WARNING;
else
status = STATE_OK;
- terminate (status, "FPING %s - %s (loss=%f%%, rta=%f ms)\n",
+ terminate (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
state_text (status), server_name, loss, rta);
}
else
status = STATE_OK;
- terminate (status, "FPING %s - %s (loss=%f%% )\n",
+ terminate (status, _("FPING %s - %s (loss=%f%% )\n"),
state_text (status), server_name, loss );
}
return status;
}
-
+\f
switch (c) {
case '?': /* print short usage statement if args not parsable */
- printf ("%s: Unknown argument: %s\n\n", progname, optarg);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
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;
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE) {
- printf ("Invalid host name/address\n\n");
+ printf (_("Invalid host name/address\n\n"));
print_usage ();
exit (STATE_UNKNOWN);
}
if (is_intpos (optarg))
packet_size = atoi (optarg);
else
- usage ("Packet size must be a positive integer");
+ usage (_("Packet size must be a positive integer"));
break;
case 'n': /* number of packets */
if (is_intpos (optarg))
packet_count = atoi (optarg);
else
- usage ("Packet count must be a positive integer");
+ usage (_("Packet count must be a positive integer"));
break;
}
}
if (server_name == NULL)
- usage ("Host name was not supplied\n\n");
+ usage (_("Host name was not supplied\n\n"));
return OK;
}
arg1[strcspn (arg1, ",:")] = 0;
if (strstr (arg1, "%") && strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
- "%s: Only one threshold may be packet loss (%s)\n", progname,
+ _("%s: Only one threshold may be packet loss (%s)\n"), progname,
arg);
if (!strstr (arg1, "%") && !strstr (arg2, "%"))
terminate (STATE_UNKNOWN,
- "%s: Only one threshold must be packet loss (%s)\n",
+ _("%s: Only one threshold must be packet loss (%s)\n"),
progname, arg);
}
diff --git a/plugins/check_game.c b/plugins/check_game.c
index db28dfdfc9e81fd0e3cde87cc5e1b6b5c6640db1..811da2706e78572a636e6b71b262c451967b9bb5 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
const char *progname = "check_game";
const char *revision = "$Revision$";
const char *copyright = "2002-2003";
-const char *authors = "Nagios Plugin Development Team";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
-const char *summary = "\
-This plugin tests %s connections with the specified host.\n";
+#include "common.h"
+#include "popen.h"
+#include "utils.h"
-const char *option_summary = "\
-%s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n";
+void
+print_usage (void)
+{
+ printf (_("\
+Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
+ [-pf ping_field]\n"), progname);
+ printf (_(UT_HLP_VRS), progname, progname);
+}
-const char *options = "\
+void
+print_help (void)
+{
+ print_revision (progname, revision);
+
+ printf (_(COPYRIGHT), copyright, email);
+
+ printf (_("This plugin tests %s connections with the specified host."), progname);
+
+ print_usage ();
+
+ printf (_(UT_HELP_VRSN));
+
+ printf (_("\
<game> = Game type that is recognised by qstat (without the leading dash)\n\
<ip_address> = The IP address of the device you wish to query\n\
[port] = Optional port of which to connect\n\
[game_field] = Field number in raw qstat output that contains game name\n\
[map_field] = Field number in raw qstat output that contains map name\n\
- [ping_field] = Field number in raw qstat output that contains ping time\n\
-\n\
+ [ping_field] = Field number in raw qstat output that contains ping time\n"),
+ DEFAULT_SOCKET_TIMEOUT);
+
+ printf (_("\n\
Notes:\n\
- This plugin uses the 'qstat' command, the popular game server status query tool .\n\
If you don't have the package installed, you will need to download it from\n\
- http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n";
+ http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"));
-#include "common.h"
-#include "popen.h"
-#include "utils.h"
-
-void print_usage (void);
-void print_help (void);
+ printf (_(UT_SUPPORT));
+}
+\f
int process_arguments (int, char **);
int validate_arguments (void);
result = process_arguments (argc, argv);
if (result != OK) {
- printf ("Incorrect arguments supplied\n");
+ printf (_("Incorrect arguments supplied\n"));
printf ("\n");
- print_revision (argv[0], "$Revision$");
- printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
- printf ("License: GPL\n");
+ print_revision (progname, revision);
+ printf (_("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"));
+ printf (_("License: GPL\n"));
printf ("\n");
return STATE_UNKNOWN;
}
/* run the command */
fp = spopen (command_line);
if (fp == NULL) {
- printf ("Error - Could not open pipe: %s\n", command_line);
+ printf (_("Error - Could not open pipe: %s\n"), command_line);
return STATE_UNKNOWN;
}
*/
if (!strncmp (input_buffer, "unknown option", 14)) {
- printf ("ERROR: Host type parameter incorrect!\n");
+ printf (_("ERROR: Host type parameter incorrect!\n"));
result = STATE_CRITICAL;
return result;
}
switch (c) {
case '?': /* args not parsable */
- printf ("%s: Unknown argument: %s\n\n", progname, optarg);
+ printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
print_usage ();
exit (STATE_UNKNOWN);
case 'h': /* help */
break;
case 'H': /* hostname */
if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
- terminate (STATE_UNKNOWN, "Input buffer overflow\n");
+ terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
server_ip = strdup (optarg);
break;
case 'P': /* port */
break;
case 'G': /* hostname */
if (strlen (optarg) >= MAX_INPUT_BUFFER)
- terminate (STATE_UNKNOWN, "Input buffer overflow\n");
+ terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
game_type = strdup (optarg);
break;
case 'p': /* index of ping field */
{
return OK;
}
-
-
-void
-print_help (void)
-{
- print_revision (progname, revision);
- printf ("Copyright (c) %s %s\n\t<%s>\n\n",
- copyright, authors, email);
- printf (summary, progname);
- print_usage ();
- printf ("\nOptions:\n");
- printf (options, DEFAULT_SOCKET_TIMEOUT);
- support ();
-}
-
-void
-print_usage (void)
-{
- printf
- ("Usage: %s %s\n"
- " %s (-h|--help)\n"
- " %s (-V|--version)\n", progname, option_summary, progname, progname);
-}
-
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 307481463371417e8f3cb36bf0294726008d7880..a18397d81adfe9d43a9d9e96c61f8fd99b517fd1 100644 (file)
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
******************************************************************************/
const char *progname = "check_mysql";
-#define REVISION "$Revision$"
-#define COPYRIGHT "1999-2002"
+const char *revision = "$Revision$";
+const char *copyright = "1999-2002";
+const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
#include "utils.h"
-
+#include "netutils.h"
#include <mysql/mysql.h>
#include <mysql/errmsg.h>
+unsigned int db_port = MYSQL_PORT;
+
+void
+print_usage (void)
+{
+ printf (_("\
+Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"),
+ progname);
+ printf (_(UT_HLP_VRS), progname, progname);
+}
+
+void
+print_help (void)
+{
+ print_revision (progname, revision);
+
+ printf (_(COPYRIGHT), copyright, email);
+
+ printf (_("This program tests connections to a mysql server\n"));
+
+ print_usage ();
+
+ printf (_(UT_HELP_VRSN));
+
+ printf (_(UT_HOST_PORT), 'P', atoi(MYSQL_PORT));
+
+ printf (_("\
+ -d, --database=STRING\n\
+ Check database with indicated name\n\
+ -u, --username=STRING\n\
+ Connect using the indicated username\n\
+ -p, --password=STRING\n\
+ Use the indicated password to authenticate the connection\n\
+ ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\
+ Your clear-text password will be visible as a process table entry\n"));
+
+ printf (_("\n\
+There are no required arguments. By default, the local database with\n\
+a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
+
+ printf (_(UT_SUPPORT));
+}
+\f
char *db_user = "";
char *db_host = "";
char *db_pass = "";
char *db = "";
-unsigned int db_port = MYSQL_PORT;
int process_arguments (int, char **);
int validate_arguments (void);
-void print_help (void);
-void print_usage (void);
int
main (int argc, char **argv)
char result[1024];
if (process_arguments (argc, argv) != OK)
- usage ("Invalid command arguments supplied\n");
+ usage (_("Invalid command arguments supplied\n"));
/* initialize mysql */
mysql_init (&mysql);
db_host = optarg;
}
else {
- usage ("Invalid host name\n");
+ usage (_("Invalid host name\n"));
}
break;
case 'd': /* hostname */
db_port = atoi (optarg);
break;
case 'V': /* version */
- print_revision (progname, REVISION);
+ print_revision (progname, revision);
exit (STATE_OK);
case 'h': /* help */
print_help ();
exit (STATE_OK);
case '?': /* help */
- usage ("Invalid argument\n");
+ usage (_("Invalid argument\n"));
}
}
{
return OK;
}
-
-
-
-
-
-void
-print_help (void)
-{
- print_revision (progname, REVISION);
- printf
- ("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n"
- "This plugin is for testing a mysql server.\n");
- print_usage ();
- printf
- ("\nThere are no required arguments. By default, the local database with\n"
- "a server listening on MySQL standard port %d will be checked\n\n"
- "Options:\n"
- " -d, --database=STRING\n"
- " Check database with indicated name\n"
- " -H, --hostname=STRING or IPADDRESS\n"
- " Check server on the indicated host\n"
- " -P, --port=INTEGER\n"
- " Make connection on the indicated port\n"
- " -u, --username=STRING\n"
- " Connect using the indicated username\n"
- " -p, --password=STRING\n"
- " Use the indicated password to authenticate the connection\n"
- " ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n"
- " Your clear-text password will be visible as a process table entry\n"
- " -h, --help\n"
- " Print detailed help screen\n"
- " -V, --version\n" " Print version information\n\n", MYSQL_PORT);
- support ();
-}
-
-
-
-
-
-void
-print_usage (void)
-{
- printf
- ("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
- " %s --help\n"
- " %s --version\n", progname, progname, progname);
-}
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 821f10ecb0f2c4b24c1df1ccdbeda4f0ff23f841..68ffaf55c4e37a19ff4669eff869d75b13ab55c1 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
void
print_usage (void)
{
- printf ("\
+ printf (_("\
Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
[-l label] [-u units] [-p port-number] [-d delimiter]\n\
[-D output-delimiter] [-m miblist] [-P snmp version]\n\
[-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
- [-X privpasswd]\n",
- progname);
- printf ("\
- %s (-h | --help) for detailed help\n\
- %s (-V | --version) for version information\n",
- progname, progname);
+ [-X privpasswd]\n"), progname);
+ printf (_(UT_HLP_VRS), progname, progname);
}
void
- All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\
returned from the SNMP query is an unsigned integer.\n"));
- support ();
+ printf (_(UT_SUPPORT));
}
\f
i = 0;
if (process_arguments (argc, argv) == ERROR)
- usage ("Incorrect arguments supplied\n");
+ usage (_("Incorrect arguments supplied\n"));
/* create the command line to execute */
asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
/* run the command */
child_process = spopen (command_line);
if (child_process == NULL) {
- printf ("Could not open pipe: %s\n", command_line);
+ printf (_("Could not open pipe: %s\n"), command_line);
exit (STATE_UNKNOWN);
}
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
if (child_stderr == NULL) {
- printf ("Could not open stderr for %s\n", command_line);
+ printf (_("Could not open stderr for %s\n"), command_line);
}
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
}
else if (excode != REG_NOMATCH) {
regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER);
- printf ("Execute Error: %s\n", errbuf);
+ printf (_("Execute Error: %s\n"), errbuf);
exit (STATE_CRITICAL);
}
else {
iresult = STATE_CRITICAL;
}
#else
- printf ("%s UNKNOWN: call for regex which was not a compiled option", label);
+ printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
exit (STATE_UNKNOWN);
#endif
}
if (found == 0)
terminate
(STATE_UNKNOWN,
- "%s problem - No data recieved from host\nCMD: %s\n",
+ _("%s problem - No data recieved from host\nCMD: %s\n"),
label, command_line);
/* WARNING if output found on stderr */
break;
case 't': /* timeout period */
if (!is_integer (optarg))
- usage2 ("Timeout Interval must be an integer", optarg);
+ usage2 (_("Timeout Interval must be an integer"), optarg);
timeout_interval = atoi (optarg);
break;
/* Test parameters */
case 'c': /* critical time threshold */
if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
- printf ("Invalid critical threshold: %s\n", optarg);
+ printf (_("Invalid critical threshold: %s\n"), optarg);
print_usage ();
exit (STATE_UNKNOWN);
}
break;
case 'w': /* warning time threshold */
if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
- printf ("Invalid warning threshold: %s\n", optarg);
+ printf (_("Invalid warning threshold: %s\n"), optarg);
print_usage ();
exit (STATE_UNKNOWN);
}
errcode = regcomp (&preg, regex_expect, cflags);
if (errcode != 0) {
regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
- printf ("Could Not Compile Regular Expression");
+ printf (_("Could Not Compile Regular Expression"));
return ERROR;
}
eval_method[jj++] = CRIT_REGEX;
ii++;
#else
- printf ("%s UNKNOWN: call for regex which was not a compiled option", label);
+ printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
exit (STATE_UNKNOWN);
#endif
break;
labels = realloc (labels, labels_size);
if (labels == NULL)
terminate (STATE_UNKNOWN,
- "Could not realloc() labels[%d]", nlabels);
+ _("Could not realloc() labels[%d]"), nlabels);
}
labels[nlabels - 1] = optarg;
ptr = thisarg (optarg);
labels_size += 8;
labels = realloc (labels, labels_size);
if (labels == NULL)
- terminate (STATE_UNKNOWN, "Could not realloc() labels\n");
+ terminate (STATE_UNKNOWN, _("Could not realloc() labels\n"));
}
labels++;
ptr = thisarg (ptr);
unitv = realloc (unitv, unitv_size);
if (unitv == NULL)
terminate (STATE_UNKNOWN,
- "Could not realloc() units [%d]\n", nunits);
+ _("Could not realloc() units [%d]\n"), nunits);
}
unitv[nunits - 1] = optarg;
ptr = thisarg (optarg);
unitv_size += 8;
unitv = realloc (unitv, unitv_size);
if (units == NULL)
- terminate (STATE_UNKNOWN, "Could not realloc() units\n");
+ terminate (STATE_UNKNOWN, _("Could not realloc() units\n"));
}
nunits++;
ptr = thisarg (ptr);
}
else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
if ( secname == NULL || authpasswd == NULL) {
- printf ("Missing secname (%s) or authpassword (%s) ! \n",secname, authpasswd );
+ printf (_("Missing secname (%s) or authpassword (%s) ! \n)"),secname, authpasswd );
print_usage ();
exit (STATE_UNKNOWN);
}
}
else if ( strcmp(seclevel, "authPriv") == 0 ) {
if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
- printf ("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n",secname, authpasswd,privpasswd );
+ printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
print_usage ();
exit (STATE_UNKNOWN);
}
}
else {
- printf ("Invalid SNMP version: %s\n", proto);
+ printf (_("Invalid SNMP version: %s\n"), proto);
print_usage ();
exit (STATE_UNKNOWN);
}
diff --git a/plugins/utils.h b/plugins/utils.h
index e581afaa5e6ff5fcbec89a4662d791f91ec4f037..83793e4650ab5891d57f1abcccb3b30f93fb56eb 100644 (file)
--- a/plugins/utils.h
+++ b/plugins/utils.h
#define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
\t<%s>\n\n"
+#define UT_HLP_VRS "\
+ %s (-h | --help) for detailed help\n\
+ %s (-V | --version) for version information\n"
+
#define UT_HELP_VRSN "\
\nOptions:\n\
-h, --help\n\