[Nagiosplug-devel] added S4 S6 S7 S22 to check_nwstat.c

Dietmar Ruzicka druzicka at cube1.cubit.at
Wed Mar 26 09:04:20 CET 2003


Hi,
I added the following options to check_nwstat.c :

S4 : LRUS  : LRU sitting time in seconds
S6 : DCB   : dirty cache buffers as a percentage of the total
S7 : TCB   : total cache buffers as a percentage of the original
S22: TSYNC : timesync status (in sync to the network)

patch against: nagios-plugins-1.3.0.tar.gz:
(diff nagios-plugins-1.3.0/plugins/check_nwstat.c
nagios-plugins-1.3.0-patched/plugins/check_nwstat.c)

best regards

Dietmar


-------------- next part --------------
65a66,70
>      TSYNC    = timesync status \n\
>      LRUS     = LRU sitting time in seconds\n\
>      DCB      = dirty cache buffers as a percentage of the total\n\
>      TCB      = dirty cache buffers as a percentage of the original\n\
> 
116a122,125
> #define CHECK_TSYNC         23 /* check timesync status 0=no 1=yes in sync to the network */
> #define CHECK_LRUS          24 /* check LRU sitting time in seconds */
> #define CHECK_DCB           25 /* check dirty cache buffers as a percentage of the total */
> #define CHECK_TCB           26 /* check total cache buffers as a percentage of the original */
142a152,154
> 	int total_cache_buffers=0;
> 	int dirty_cache_buffers=0;
>         int time_sync_status=0;
604a617,680
> 	/* check # Timesync Status */
>         } else if (vars_to_check==CHECK_TSYNC) {
> 
> 	        asprintf(&send_buffer,"S22\r\n");
> 		result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
> 		if(result!=STATE_OK)
> 		        return result;
> 
> 		time_sync_status=atoi(recv_buffer);
> 
> 		if(time_sync_status==0) {
> 		        result=STATE_CRITICAL;
> 			asprintf(&output_message,"Critical: Time not in sync with network!");
> 		}
> 		else {
> 		        asprintf(&output_message,"OK! Time in sync with network!");
> 		}
> 
> 	/* check LRU sitting time in secondss */
> 	} else if (vars_to_check==CHECK_LRUS) {
> 
> 		send_buffer = strscpy(send_buffer,"S4\r\n");
> 		result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
> 		if(result!=STATE_OK)
> 			return result;
> 		lru_time=strtoul(recv_buffer,NULL,10);
> 
> 		if(check_critical_value==TRUE && lru_time <= critical_value)
> 			result=STATE_CRITICAL;
> 		else if(check_warning_value==TRUE && lru_time <= warning_value)
> 			result=STATE_WARNING;
> 		asprintf(&output_message,"LRU sitting time = %lu seconds",lru_time);
> 
> 
> 	/* check % dirty cache buffers as a percentage of the total*/
> 	} else if (vars_to_check==CHECK_DCB) {
> 
> 		send_buffer = strscpy(send_buffer,"S6\r\n");
> 		result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
> 		if(result!=STATE_OK)
> 			return result;
> 		dirty_cache_buffers=atoi(recv_buffer);
> 
> 		if(check_critical_value==TRUE && dirty_cache_buffers <= critical_value)
> 			result=STATE_CRITICAL;
> 		else if(check_warning_value==TRUE && dirty_cache_buffers <= warning_value)
> 			result=STATE_WARNING;
> 		asprintf(&output_message,"dirty cache buffers = %d%% of the total",dirty_cache_buffers);
> 
> 	/* check % total cache buffers as a percentage of the original*/
> 	} else if (vars_to_check==CHECK_TCB) {
> 
> 		send_buffer = strscpy(send_buffer,"S7\r\n");
> 		result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
> 		if(result!=STATE_OK)
> 			return result;
> 		total_cache_buffers=atoi(recv_buffer);
> 
> 		if(check_critical_value==TRUE && total_cache_buffers <= critical_value)
> 			result=STATE_CRITICAL;
> 		else if(check_warning_value==TRUE && total_cache_buffers <= warning_value)
> 			result=STATE_WARNING;
> 		asprintf(&output_message,"total cache buffers = %d%% of the original",total_cache_buffers);
> 		
708a785,788
> 				else if(!strcmp(optarg,"DCB"))
> 					vars_to_check=CHECK_DCB;
> 				else if(!strcmp(optarg,"TCB"))
> 					vars_to_check=CHECK_TCB;
714a795,796
> 				else if(!strcmp(optarg,"LRUS"))
> 					vars_to_check=CHECK_LRUS;
771a854,855
> 				else if(!strcmp(optarg,"TSYNC"))
> 					vars_to_check=CHECK_TSYNC;


More information about the Devel mailing list