summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_game.c b/plugins/check_game.c
index dd16777..3ebf6af 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -43,11 +43,11 @@ int port = 0;
43 43
44int verbose; 44int verbose;
45 45
46int qstat_game_players_max = 4; 46int qstat_game_players_max = -1;
47int qstat_game_players = 5; 47int qstat_game_players = -1;
48int qstat_game_field = 2; 48int qstat_game_field = -1;
49int qstat_map_field = 3; 49int qstat_map_field = -1;
50int qstat_ping_field = 5; 50int qstat_ping_field = -1;
51 51
52 52
53int 53int
@@ -143,12 +143,18 @@ main (int argc, char **argv)
143 result = STATE_CRITICAL; 143 result = STATE_CRITICAL;
144 } 144 }
145 else { 145 else {
146 printf ("OK: %s/%s %s (%s), Ping: %s ms\n", 146 printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
147 ret[qstat_game_players], 147 ret[qstat_game_players],
148 ret[qstat_game_players_max], 148 ret[qstat_game_players_max],
149 ret[qstat_game_field], 149 ret[qstat_game_field],
150 ret[qstat_map_field], 150 ret[qstat_map_field],
151 ret[qstat_ping_field]); 151 ret[qstat_ping_field],
152 perfdata ("players", atol(ret[qstat_game_players]), "",
153 FALSE, 0, FALSE, 0,
154 TRUE, 0, TRUE, atol(ret[qstat_game_players_max])),
155 perfdata ("ping", atol(ret[qstat_ping_field]), "",
156 FALSE, 0, FALSE, 0,
157 TRUE, 0, FALSE, 0));
152 } 158 }
153 159
154 /* close the pipe */ 160 /* close the pipe */
@@ -246,6 +252,8 @@ process_arguments (int argc, char **argv)
246 break; 252 break;
247 case 129: /* index of player count field */ 253 case 129: /* index of player count field */
248 qstat_game_players = atoi (optarg); 254 qstat_game_players = atoi (optarg);
255 if (qstat_game_players_max == 0)
256 qstat_game_players_max = qstat_game_players - 1;
249 if (qstat_game_players < 0 || qstat_game_players > QSTAT_MAX_RETURN_ARGS) 257 if (qstat_game_players < 0 || qstat_game_players > QSTAT_MAX_RETURN_ARGS)
250 return ERROR; 258 return ERROR;
251 break; 259 break;
@@ -272,7 +280,22 @@ process_arguments (int argc, char **argv)
272int 280int
273validate_arguments (void) 281validate_arguments (void)
274{ 282{
275 return OK; 283 if (qstat_game_players_max < 0)
284 qstat_game_players_max = 4;
285
286 if (qstat_game_players < 0)
287 qstat_game_players = 5;
288
289 if (qstat_game_field < 0)
290 qstat_game_field = 2;
291
292 if (qstat_map_field < 0)
293 qstat_map_field = 3;
294
295 if (qstat_ping_field < 0)
296 qstat_ping_field = 5;
297
298 return OK;
276} 299}
277 300
278 301
@@ -323,3 +346,18 @@ Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
323 [-pf ping_field]\n"), progname); 346 [-pf ping_field]\n"), progname);
324 printf (_(UT_HLP_VRS), progname, progname); 347 printf (_(UT_HLP_VRS), progname, progname);
325} 348}
349
350/******************************************************************************
351 *
352 * Test Cases:
353 *
354 * ./check_game --players 7 -p 8 --map 5 qs 67.20.190.61 26000
355 *
356 * qstat -raw , -qs 67.20.190.61
357 * ==> QS,67.20.190.61,Nightmare.fintek.ca,67.20.190.61:26000,3,e2m1,6,0,83,0
358 *
359 * qstat -qs 67.20.190.61
360 * ==> ADDRESS PLAYERS MAP RESPONSE TIME NAME
361 * ==> 67.20.190.61 0/ 6 e2m1 79 / 0 Nightmare.fintek.ca
362 *
363 ******************************************************************************/