[Nagiosplug-checkins] CVS: nagiosplug/plugins check_mrtgtraf.c,1.9,1.10

Karl DeBisschop kdebisschop at users.sourceforge.net
Tue Nov 11 21:31:03 CET 2003


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

Modified Files:
	check_mrtgtraf.c 
Log Message:
add perfdata

Index: check_mrtgtraf.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_mrtgtraf.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** check_mrtgtraf.c	10 Aug 2003 06:53:21 -0000	1.9
--- check_mrtgtraf.c	12 Nov 2003 05:29:55 -0000	1.10
***************
*** 116,125 ****
  	/* make sure the MRTG data isn't too old */
  	time (&current_time);
! 	if (expire_minutes > 0
! 			&& (current_time - timestamp) >
! 			(expire_minutes * 60)) die (STATE_WARNING,
! 																				_("MRTG data has expired (%d minutes old)\n"),
! 																				(int) ((current_time - timestamp) /
! 																							 60));
  
  	/* else check the incoming/outgoing rates */
--- 116,123 ----
  	/* make sure the MRTG data isn't too old */
  	time (&current_time);
! 	if ((expire_minutes > 0) &&
! 	    (current_time - timestamp) > (expire_minutes * 60))
! 		die (STATE_WARNING,	_("MRTG data has expired (%d minutes old)\n"),
! 		     (int) ((current_time - timestamp) / 60));
  
  	/* else check the incoming/outgoing rates */
***************
*** 172,195 ****
  			|| outgoing_rate > outgoing_critical_threshold) {
  		result = STATE_CRITICAL;
- 		asprintf (&error_message, _("Traffic CRITICAL %s. In = %0.1f %s, %s. Out = %0.1f %s"),
- 							(use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
- 							incoming_speed_rating, (use_average == TRUE) ? "Avg" : "Max",
- 							adjusted_outgoing_rate, outgoing_speed_rating);
  	}
  	else if (incoming_rate > incoming_warning_threshold
  					 || outgoing_rate > outgoing_warning_threshold) {
  		result = STATE_WARNING;
! 		asprintf (&error_message, _("Traffic WARNING %s. In = %0.1f %s, %s. Out = %0.1f %s"),
! 							(use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
! 							incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"),
! 							adjusted_outgoing_rate, outgoing_speed_rating);
! 	}
! 	else if (result == STATE_OK)
! 		printf (_("Traffic OK - %s. In = %0.1f %s, %s. Out = %0.1f %s\n"),
! 						(use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
! 						incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"),
! 						adjusted_outgoing_rate, outgoing_speed_rating);
! 	else
! 		printf (_("UNKNOWN %s\n"), error_message);
  
  	return result;
--- 170,193 ----
  			|| outgoing_rate > outgoing_critical_threshold) {
  		result = STATE_CRITICAL;
  	}
  	else if (incoming_rate > incoming_warning_threshold
  					 || outgoing_rate > outgoing_warning_threshold) {
  		result = STATE_WARNING;
! 	}
! 
! 	asprintf (&error_message, _("%s. In = %0.1f %s, %s. Out = %0.1f %s\n"),
! 	          (use_average == TRUE) ? _("Avg") : _("Max"), adjusted_incoming_rate,
! 	          incoming_speed_rating, (use_average == TRUE) ? _("Avg") : _("Max"),
! 	          adjusted_outgoing_rate, outgoing_speed_rating,
! 	          perfdata("in", adjusted_incoming_rate, incoming_speed_rating,
! 	                   incoming_warning_threshold, incoming_warning_threshold,
! 	                   incoming_critical_threshold, incoming_critical_threshold,
! 	                   TRUE, 0, TRUE, incoming_speed_rating),
! 	          perfdata("in", adjusted_outgoing_rate, outgoing_speed_rating,
! 	                   outgoing_warning_threshold, outgoing_warning_threshold,
! 	                   outgoing_critical_threshold, outgoing_critical_threshold,
! 	                   TRUE, 0, TRUE, outgoing_speed_rating));
! 
! 	printf (_("Traffic %s - %s\n"), state_text(result), error_message);
  
  	return result;





More information about the Commits mailing list