[Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.5,1.6

Karl DeBisschop kdebisschop at users.sourceforge.net
Sun Oct 20 11:50:02 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv6419

Modified Files:
	check_snmp.c 
Log Message:
change ssprintf to asprintf
back out change at line 225 in r1.4
  (values were mismatched to format string, so output was nonsense)
  (I left a comment showing a construct that should work, but it fails for PHBs:
    if my disk gets nearly full, they want 'CRITICAL - 99%' not 'CRITICAL - Gauge32: 99')
  (If someine has a rationale for the change, maybe it could be done as an option? - it seems 
    fairly clear that the Web display should be sensible to PHBs so long as there's no real loss)


Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** check_snmp.c	1 Aug 2002 05:06:53 -0000	1.5
--- check_snmp.c	20 Oct 2002 18:49:00 -0000	1.6
***************
*** 145,150 ****
  
  	/* create the command line to execute */
! 	command_line = ssprintf
! 		(command_line,
  		 "%s -p %s -m ALL -v 1 %s -c %s %s",
  		 PATH_TO_SNMPGET, port, server_address, community, oid);
--- 145,150 ----
  
  	/* create the command line to execute */
! 	asprintf
! 		(&command_line,
  		 "%s -p %s -m ALL -v 1 %s -c %s %s",
  		 PATH_TO_SNMPGET, port, server_address, community, oid);
***************
*** 222,227 ****
  			response_value[i] = strtoul (p2, NULL, 10);
  			iresult = check_num (i);
! 			/*For consistency- full SNMP response every time */
! 			show = ssprintf (show, "%d", response);
  		}
  
--- 222,227 ----
  			response_value[i] = strtoul (p2, NULL, 10);
  			iresult = check_num (i);
! 			asprintf (&show, "%lu", response_value[i]);
! 			/*asprintf (&show, "%s", response); */
  		}
  
***************
*** 265,270 ****
  
  		if (nlabels > 1 && i < nlabels && labels[i] != NULL)
! 			outbuff = ssprintf
! 				(outbuff,
  				 "%s%s%s %s%s%s",
  				 outbuff,
--- 265,270 ----
  
  		if (nlabels > 1 && i < nlabels && labels[i] != NULL)
! 			asprintf
! 				(&outbuff,
  				 "%s%s%s %s%s%s",
  				 outbuff,
***************
*** 272,283 ****
  				 labels[i], mark (iresult), show, mark (iresult));
  		else
! 			outbuff = ssprintf
! 				(outbuff,
! 				 "%s%s%s%s%s",
! 				 outbuff,
  				 (i == 0) ? " " : output_delim, mark (iresult), show, mark (iresult));
  
  		if (nunits > 0 && i < nunits)
! 			outbuff = ssprintf (outbuff, "%s %s", outbuff, unitv[i]);
  
  		i++;
--- 272,280 ----
  				 labels[i], mark (iresult), show, mark (iresult));
  		else
! 			asprintf (&outbuff, "%s%s%s%s%s", outbuff,
  				 (i == 0) ? " " : output_delim, mark (iresult), show, mark (iresult));
  
  		if (nunits > 0 && i < nunits)
! 			asprintf (&outbuff, "%s %s", outbuff, unitv[i]);
  
  		i++;





More information about the Commits mailing list