[Nagiosplug-checkins] CVS: nagiosplug/plugins check_game.c,1.8,1.9

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Aug 28 04:57:04 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv15554

Modified Files:
	check_game.c 
Log Message:
add perf data

Index: check_game.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_game.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** check_game.c	22 Aug 2003 06:22:37 -0000	1.8
--- check_game.c	28 Aug 2003 11:56:15 -0000	1.9
***************
*** 44,52 ****
  int verbose;
  
! int qstat_game_players_max = 4;
! int qstat_game_players = 5;
! int qstat_game_field = 2;
! int qstat_map_field = 3;
! int qstat_ping_field = 5;
  
  
--- 44,52 ----
  int verbose;
  
! int qstat_game_players_max = -1;
! int qstat_game_players = -1;
! int qstat_game_field = -1;
! int qstat_map_field = -1;
! int qstat_ping_field = -1;
  
  
***************
*** 144,153 ****
  	}
  	else {
! 		printf ("OK: %s/%s %s (%s), Ping: %s ms\n", 
  		        ret[qstat_game_players],
  		        ret[qstat_game_players_max],
  		        ret[qstat_game_field], 
  		        ret[qstat_map_field],
! 		        ret[qstat_ping_field]);
  	}
  
--- 144,159 ----
  	}
  	else {
! 		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_map_field],
! 		        ret[qstat_ping_field],
! 						perfdata ("players", atol(ret[qstat_game_players]), "",
! 		                  FALSE, 0, FALSE, 0,
! 		                  TRUE, 0, TRUE, atol(ret[qstat_game_players_max])),
! 						perfdata ("ping", atol(ret[qstat_ping_field]), "",
! 		                  FALSE, 0, FALSE, 0,
! 		                  TRUE, 0, FALSE, 0));
  	}
  
***************
*** 247,250 ****
--- 253,258 ----
  		case 129: /* index of player count field */
  			qstat_game_players = atoi (optarg);
+ 			if (qstat_game_players_max == 0)
+ 				qstat_game_players_max = qstat_game_players - 1;
  			if (qstat_game_players < 0 || qstat_game_players > QSTAT_MAX_RETURN_ARGS)
  				return ERROR;
***************
*** 273,277 ****
  validate_arguments (void)
  {
! 		return OK;
  }
  
--- 281,300 ----
  validate_arguments (void)
  {
! 	if (qstat_game_players_max < 0)
! 		qstat_game_players_max = 4;
! 
! 	if (qstat_game_players < 0)
! 		qstat_game_players = 5;
! 
! 	if (qstat_game_field < 0)
! 		qstat_game_field = 2;
! 
! 	if (qstat_map_field < 0)
! 		qstat_map_field = 3;
! 
! 	if (qstat_ping_field < 0)
! 		qstat_ping_field = 5;
! 
! 	return OK;
  }
  
***************
*** 324,325 ****
--- 347,363 ----
  	printf (_(UT_HLP_VRS), progname, progname);
  }
+ 
+ /******************************************************************************
+  *
+  * 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
+  *
+  * qstat -qs 67.20.190.61
+  *  ==> ADDRESS           PLAYERS      MAP   RESPONSE TIME    NAME
+  *  ==> 67.20.190.61            0/ 6     e2m1     79 / 0   Nightmare.fintek.ca
+  *
+  ******************************************************************************/





More information about the Commits mailing list