diff --git a/plugins/check_game.c b/plugins/check_game.c
index 32f2e6a91f414a9269e9f7583f7489cc1e18771d..235be65ca6125b9ddb97ad93f9e53d81e35fc757 100644 (file)
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
-/******************************************************************************
-*
-* This program is free software; you can redistribute it and/or modify
+/*****************************************************************************
+*
+* Nagios check_game plugin
+*
+* License: GPL
+* Copyright (c) 2002-2007 Nagios Plugins Development Team
+*
+* Description:
+*
+* This file contains the check_game plugin
+*
+* This plugin tests game server connections with the specified host.
+* using the qstat program
+*
+*
+* 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
+* the Free Software Foundation, either version 3 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.
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
*
-* $Id$
*****************************************************************************/
const char *progname = "check_game";
-const char *revision = "$Revision$";
-const char *copyright = "2002-2005";
+const char *copyright = "2002-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
-
+
+ /* Parse extra opts if any */
+ argv=np_extra_opts (&argc, argv, progname);
+
if (process_arguments (argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
/* create the command line to execute */
asprintf (&command_line, "%s -raw %s -%s %s",
PATH_TO_QSTAT, QSTAT_DATA_DELIMITER, game_type, server_ip);
-
+
if (port)
asprintf (&command_line, "%s:%-d", command_line, port);
/* was thinking about running qstat without any options, capturing the
-default line, parsing it & making an array of all know server types
but thought this would be too much hassle considering this is a tool
- for intelligent sysadmins (ha). Could put a static array of known
+ for intelligent sysadmins (ha). Could put a static array of known
server types in a header file but then we'd be limiting ourselves
In the end, I figured I'd simply let an error occur & then trap it
result = STATE_CRITICAL;
}
else {
- printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
+ printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
ret[qstat_game_players],
ret[qstat_game_players_max],
- ret[qstat_game_field],
+ ret[qstat_game_field],
ret[qstat_map_field],
ret[qstat_ping_field],
perfdata ("players", atol(ret[qstat_game_players]), "",
print_help ();
exit (STATE_OK);
case 'V': /* version */
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'v': /* version */
verbose = TRUE;
return ERROR;
break;
default: /* args not parsable */
- usage_va(_("Unknown argument - %s"), optarg);
+ usage5();
}
}
void
print_help (void)
{
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
printf (COPYRIGHT, copyright, email);
printf (_("This plugin tests game server connections with the specified host."));
printf ("\n\n");
-
+
print_usage ();
printf (_(UT_HELP_VRSN));
-
+ printf (_(UT_EXTRA_OPTS));
+
printf (" %s\n", "-p");
printf (" %s\n", _("Optional port of which to connect"));
printf (" %s\n", "gf");
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ printf ("\n");
printf ("%s\n", _("Notes:"));
-
- printf ("%s\n", _("This plugin uses the 'qstat' command, the popular game server status query tool ."));
-
- printf ("%s\n", _("If you don't have the package installed, you will need to download it from"));
-
- printf ("%s\n", _("http://www.activesw.com/people/steve/qstat.html before you can use this plugin."));
+ printf (" %s\n", _("This plugin uses the 'qstat' command, the popular game server status query tool."));
+ printf (" %s\n", _("If you don't have the package installed, you will need to download it from"));
+ printf (" %s\n", _("http://www.activesw.com/people/steve/qstat.html before you can use this plugin."));
+#ifdef NP_EXTRA_OPTS
+ printf ("\n");
+ printf (_(UT_EXTRA_OPTS_NOTES));
+#endif
printf (_(UT_SUPPORT));
}
* Test Cases:
*
* ./check_game --players 7 -p 8 --map 5 qs 67.20.190.61 26000
- *
+ *
* qstat -raw , -qs 67.20.190.61
* ==> QS,67.20.190.61,Nightmare.fintek.ca,67.20.190.61:26000,3,e2m1,6,0,83,0
*