X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_game.c;h=bcde103888fcaa9b468a665d78ae461b52e3ce4c;hb=25d1ee331dbe4977a4a1a756c67f32bd51d9b070;hp=0e4120dda41516db54238c55af7cddc49c74d7f2;hpb=ed62784a0b68959fd13fe5bc53a5aef4f17fbffa;p=nagiosplug.git
diff --git a/plugins/check_game.c b/plugins/check_game.c
index 0e4120d..bcde103 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -5,8 +5,6 @@
* License: GPL
* Copyright (c) 2002-2007 Nagios Plugins Development Team
*
-* Last Modified: $Date$
-*
* Description:
*
* This file contains the check_game plugin
@@ -28,12 +26,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
-* $Id$
*
*****************************************************************************/
const char *progname = "check_game";
-const char *revision = "$Revision$";
const char *copyright = "2002-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
@@ -79,6 +75,9 @@ main (int argc, char **argv)
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"));
@@ -102,7 +101,7 @@ main (int argc, char **argv)
/* 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
@@ -136,10 +135,10 @@ main (int argc, char **argv)
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]), "",
@@ -199,7 +198,7 @@ process_arguments (int argc, char **argv)
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;
@@ -290,7 +289,7 @@ validate_arguments (void)
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);
@@ -301,7 +300,8 @@ print_help (void)
print_usage ();
- printf (_(UT_HELP_VRSN));
+ printf (UT_HELP_VRSN);
+ printf (UT_EXTRA_OPTS);
printf (" %s\n", "-p");
printf (" %s\n", _("Optional port of which to connect"));
@@ -312,15 +312,19 @@ print_help (void)
printf (" %s\n", "-pf");
printf (" %s\n", _("Field number in raw qstat output that contains ping time"));
- printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ 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."));
+#ifdef NP_EXTRA_OPTS
+ printf ("\n");
+ printf (UT_EXTRA_OPTS_NOTES);
+#endif
- printf (_(UT_SUPPORT));
+ printf (UT_SUPPORT);
}
@@ -329,7 +333,7 @@ void
print_usage (void)
{
printf (_("Usage:"));
- printf (" %s [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n", progname);
+ printf (" %s [-hvV] [-P port] [-t timeout] [-g game_field] [-m map_field] [-p ping_field] [-G game-time] [-H hostname] \n", progname);
}
/******************************************************************************
@@ -337,7 +341,7 @@ print_usage (void)
* 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
*