[Nagiosplug-checkins] CVS: nagiosplug/plugins check_nwstat.c,1.7,1.8

Ton Voon tonvoon at users.sourceforge.net
Sat Jun 28 19:19:05 CEST 2003


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

Modified Files:
	check_nwstat.c 
Log Message:
Added NLM test (Phil Randal)


Index: check_nwstat.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nwstat.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_nwstat.c	14 May 2003 21:51:10 -0000	1.7
--- check_nwstat.c	29 Jun 2003 02:18:28 -0000	1.8
***************
*** 70,73 ****
--- 70,74 ----
       TCB      = dirty cache buffers as a percentage of the original\n\
       UPTIME   = server uptime\n\
+      NLM:<nlm> = check if NLM is loaded and report version (e.g. \"NLM:TSANDS.NLM\")\n\
  -w, --warning=INTEGER\n\
    Threshold which will result in a warning status\n\
***************
*** 128,131 ****
--- 129,133 ----
  #define CHECK_DSVER         27 /* check NDS version */
  #define CHECK_UPTIME        28 /* check server uptime */
+ #define CHECK_NLM           29 /* check NLM loaded */
  
  #define PORT 9999
***************
*** 133,136 ****
--- 135,139 ----
  char *server_address=NULL;
  char *volume_name=NULL;
+ char *nlm_name=NULL;
  int server_port=PORT;
  unsigned long warning_value=0L;
***************
*** 703,706 ****
--- 706,723 ----
  	  	asprintf(&output_message,"Up %s",recv_buffer);
  
+         } else if (vars_to_check==CHECK_NLM) {
+  	        asprintf(&send_buffer,"S24:%s\r\n",nlm_name);
+                 result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
+                 if(result!=STATE_OK)
+ 		        return result;
+ 
+                 recv_buffer[strlen(recv_buffer)-1]=0;
+                 if(strcmp(recv_buffer,"-1")) {
+                         asprintf(&output_message,"Module %s version %s is loaded",nlm_name,recv_buffer);
+                 } else {
+ 		        result=STATE_CRITICAL;
+                         asprintf(&output_message,"Module %s is not loaded",nlm_name);
+ 		}
+ 
  	} else {
  
***************
*** 876,879 ****
--- 893,900 ----
  				else if(!strcmp(optarg,"UPTIME"))
  					vars_to_check=CHECK_UPTIME;
+ 				else if(strncmp(optarg,"NLM:",4)==0) {
+ 				        vars_to_check=CHECK_NLM;
+ 					nlm_name=strscpy(nlm_name,optarg+4);
+                                 }
  				else
  					return ERROR;





More information about the Commits mailing list