[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netsaint-devel
Subject:    [netsaint-devel] Performace data patches for plugins
From:       <clameter () lameter ! com>
Date:       2001-04-19 17:44:42
[Download RAW message or body]

Attached a patch against netsaint plugins 1.2.8-4 implementing performance
data in some plugins. We have used them widely in the last 4 months.

I will be leaving my job tomorrow. The address christoph@lameter.com will
remain to be valid and I expect to be able to do much more in terms of
development in the future.

["netsaint-plugins.patch" (TEXT/PLAIN)]

--- netsaint-plugins-1.2.8.orig/plugins/Makefile.in
+++ netsaint-plugins-1.2.8/plugins/Makefile.in
@@ -29,7 +29,9 @@
 		check_netsaint check_nntp check_nwstat check_overcr \
 		check_ping check_pop check_procs check_real check_reply \
 		check_smtp check_ssh check_tcp check_time check_udp \
-		check_ups check_users check_vsz check_by_ssh urlize
+		check_ups check_users check_vsz check_by_ssh urlize \
+		check_ide-smart
+
 EXTRAS=@EXTRAS@
 
 PLUGINHDRS=	$(CFG)/common.h $(CFG)/config.h
--- netsaint-plugins-1.2.8.orig/plugins/check_disk.c
+++ netsaint-plugins-1.2.8/plugins/check_disk.c
@@ -119,13 +119,13 @@
 		result=STATE_OK;
 	
 	if(result==STATE_OK)
-		terminate(STATE_OK,"Disk ok - %d kB (%d%%) free on \
%s\n",free_disk,100-usp,file_system); +		terminate(STATE_OK,"Disk ok - %d kB (%d%%) \
free on %s|diskuse=%d\n",free_disk,100-usp,file_system,used_disk);  else if(usp<0)
 		printf("Disk %s not mounted or nonexistant\n",argv[3]);
 	else if(result==STATE_UNKNOWN)
 		printf("Unable to read output\n%s\n%s\n",command_line,input_buffer);
 	else /* STATE_WARNING or STATE_CRITICAL */
-		printf("Only %d kB (%d%%) free on %s\n",free_disk,100-usp,file_system);
+		printf("Only %d kB (%d%%) free on \
%s|diskuse=%d\n",free_disk,100-usp,file_system,used_disk);  
 	return result;
         }
--- netsaint-plugins-1.2.8.orig/plugins/check_load.c
+++ netsaint-plugins-1.2.8/plugins/check_load.c
@@ -28,6 +28,8 @@
 #include "../common/common.h"
 #include "utils.h"
 
+#undef HAVE_GETLOADAVG
+
 #ifdef HAVE_SYS_LOADAVG_H
 #include <sys/loadavg.h>
 #endif
@@ -147,7 +149,7 @@
       printf("Error processing %s\n",PROC_LOADAVG);
       return STATE_UNKNOWN;
     }
-  printf("load average: %.2f, %.2f, %.2f", la1,la5,la15);
+  printf("load average: load1min=%.2f , load5min=%.2f , load15min=%.2f", \
la1,la5,la15);  if((la1 >= cload1)||(la5 >= cload5)||(la15 >= cload15))
     {
       printf(" CRITICAL\n");
--- netsaint-plugins-1.2.8.orig/plugins/check_netsaint.c
+++ netsaint-plugins-1.2.8/plugins/check_netsaint.c
@@ -121,7 +121,7 @@
 
 	/* cound the number of matching NetSaint processes... */
 	while(fgets(input_buffer,MAX_INPUT_BUFFER-1,child_process)){
-		if(strstr(input_buffer,process_string))
+		if(strstr(input_buffer,process_string) && !strstr(input_buffer,"check_netsaint"))
 			proc_entries++;
 	        }
 	/* If we get anything on stderr, at least set warning */
--- netsaint-plugins-1.2.8.orig/plugins/check_smtp.c
+++ netsaint-plugins-1.2.8/plugins/check_smtp.c
@@ -138,9 +138,9 @@
 					result=STATE_WARNING;
 
 				if(verbose==TRUE)
-					printf("SMTP %s - %d sec. response time, \
%s\n",(result==STATE_OK)?"ok":"problem",(int)(end_time-start_time),buffer); \
+					printf("SMTP %s - %d sec. response time, \
%s|ptime=%d\n",(result==STATE_OK)?"ok":"problem",(int)(end_time-start_time),buffer,(int)(end_time-start_time));
  else
-					printf("SMTP %s - %d second response \
time\n",(result==STATE_OK)?"ok":"problem",(int)(end_time-start_time)); \
+					printf("SMTP %s - %d second response \
time|ptime=%d\n",(result==STATE_OK)?"ok":"problem",(int)(end_time-start_time),(int)(end_time-start_time));
  }
 		        }
 
--- netsaint-plugins-1.2.8.orig/plugins/check_snmp.c
+++ netsaint-plugins-1.2.8/plugins/check_snmp.c
@@ -247,7 +247,7 @@
 	if(spclose(child_process))
 		result=max(result,STATE_WARNING);
 
-	printf("%s %s -%s %s\n",(!strcmp(label,""))?"SNMP":label,state_text(result),outbuff,(nunits>0?"":units));
 +	printf("%s %s -%s \
%s\n|vvalue=%s",(!strcmp(label,""))?"SNMP":label,state_text(result),outbuff,(nunits>0?"":units,outbuff),(nunits>0?"":units,outbuff));
  return result;
 }
 
--- netsaint-plugins-1.2.8.orig/plugins/check_tcp.c
+++ netsaint-plugins-1.2.8/plugins/check_tcp.c
@@ -110,10 +110,10 @@
 				strcpy(buffer,"");
 			else
 				strip(buffer);
-			printf("Connection %s on port %d - %d sec. response time, \
%s\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time),buffer);
 +			printf("Connection %s on port %d - %d sec. response time, %s \
|ptime=%d\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time),buffer,(int)(end_time-start_time));
  }
 		else
-			printf("Connection %s on port %d - %d second response \
time\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time));
 +			printf("Connection %s on port %d - %d second response \
time|ptime=%d\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time),(int)(end_time-start_time));
  
 		/* close the connection */
 		close(sd);
--- netsaint-plugins-1.2.8.orig/plugins/check_time.c
+++ netsaint-plugins-1.2.8/plugins/check_time.c
@@ -139,7 +139,7 @@
 				else if(check_warning_diff==TRUE && diff_time>warning_diff)
 					result=STATE_WARNING;
 
-				printf("Time server %s - %lu sec. time \
difference\n",(result==STATE_OK)?"ok":"problem",diff_time); +				printf("Time server \
%s - %lu sec. time difference|ptime=%lu\n",(result==STATE_OK)?"ok":"problem",diff_time,diff_time);
  }
 
 		        }
--- netsaint-plugins-1.2.8.orig/plugins/check_udp.c
+++ netsaint-plugins-1.2.8/plugins/check_udp.c
@@ -120,7 +120,7 @@
 		else if(check_warning_time==TRUE && (end_time-start_time)>warning_time)
 			result=STATE_WARNING;
 
-		printf("Connection %s on port %d - %d second response \
time\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time));
 +		printf("Connection %s on port %d - %d second response \
time|ptime=%d\n",(result==STATE_OK)?"accepted":"problem",server_port,(int)(end_time-start_time),(int)(end_time-start_time));
  }
 
 	/* reset the alarm */
--- netsaint-plugins-1.2.8.orig/plugins/check_users.c
+++ netsaint-plugins-1.2.8/plugins/check_users.c
@@ -125,11 +125,11 @@
 		result=STATE_OK;
 	
 	if(result==STATE_OK)
-		printf("Users ok - %d users logged in\n",users);
+		printf("Users ok - users=%d logged in\n",users);
 	else if(result==STATE_UNKNOWN)
 		printf("Unable to read output\n");
 	else
-		printf("%d users currently logged in\n",users);
+		printf("users=%d currently logged in\n",users);
 
 	return result;
         }
--- netsaint-plugins-1.2.8.orig/plugins/check_procs.c
+++ netsaint-plugins-1.2.8/plugins/check_procs.c
@@ -377,10 +377,10 @@
 
 	if (options==0) {
     options=1;
-    snprintf(format,MAX_INPUT_BUFFER,"%%s - %%d processes running\n");
+    snprintf(format,MAX_INPUT_BUFFER,"%%s - running processes=%%d\n");
   }else{
     strcpy(tmp,format);
-    snprintf(format,MAX_INPUT_BUFFER,"%%s - %%d processes running with %s\n",tmp);
+    snprintf(format,MAX_INPUT_BUFFER,"%%s - with %s running processes=%%d\n",tmp);
   }
 
   return options;
--- netsaint-plugins-1.2.8.orig/plugins/check_ide-smart.c
+++ netsaint-plugins-1.2.8/plugins/check_ide-smart.c
@@ -430,7 +430,7 @@
        int fd = open (device, O_RDONLY);
       
       if (fd < 0) {
-	 printf ("Critical: Couldn't open device: %s\n", strerror(errno));
+	 printf ("Critical: Couldn't open %s device: %s\n", device,strerror(errno));
 	 return 2;
       }
       
@@ -465,9 +465,10 @@
 	 print_values (&values, &thresholds);
 	 break;
       }	     
-   
       close (fd);
+     }
    }
    
    return retval;
-}
+};
+


_______________________________________________
Netsaint-devel mailing list
Netsaint-devel@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/netsaint-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic