Hi

here at OSSIM we use ntop3 with the developer version of RRD in order to
use the option HAVE_RRD_ABERRANT_BEHAVIOR, It's working well but we
found some errors.

On linux systems for some reason this crashes the web thread, we
resolved this setting the flag O_NONBLOCK to the sock.

In the sendStringLen function from the http.c file, while checking for
EAGAIN error, the lines:
 
       len -= rc;
       bytesSent += rc;

shouldn't be there, because nothing is being written to the sock. Again
on linux systems the rrd graphics don't are being drawn well, we
resolved this using an usleep.

Find the patch attached, please if you've got other solutions /
questions, send them to us. 

Thanks

-- 
Fabio Ospitia Trujillo <[EMAIL PROTECTED]>
OSSIM
diff -urNb configure.in configure.in
--- configure.in	2004-03-22 00:45:04.000000000 +0100
+++ configure.in	2004-04-12 16:58:55.000000000 +0200
@@ -128,7 +128,7 @@
 AC_PREFIX_DEFAULT(${NTOPDIR:-/usr/local})
 
 # Set constants and defaults
-MYRRD=`pwd`/myrrd
+MYRRD=/usr/lib
 SO_VERSION_PATCH=
 MAKE_SHARED_LIBRARY_PARM="-bundle -flat_namespace -undefined suppress"
 
@@ -2800,7 +2800,7 @@
 fi
 
 dnl> Append RRD finally
-NTOP_APPENDS([${MYRRD}], [${MYRRD}], [myrrd])
+NTOP_APPENDS([${MYRRD}], [${MYRRD}], [rrd_th])
 
 echo
 echo "-------------------------------------------------------------------"
@@ -2975,7 +2975,6 @@
 AC_SUBST(SO_VERSION_PATCH)
 
 AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([myrrd/Makefile])
 
 if test ".${ac_disable_plugins}" != ".yes"; then
     AC_CONFIG_FILES([plugins/Makefile])
diff -urNb Makefile.am Makefile.am
--- Makefile.am	2004-03-22 00:16:42.000000000 +0100
+++ Makefile.am	2004-04-12 16:58:55.000000000 +0200
@@ -61,7 +61,7 @@
                        stamp-h.in
 
 
-SUBDIRS = myrrd . @PLUGINS@
+SUBDIRS = . @PLUGINS@
 
 ETTER_PASSIVE_FILE = etter.passive.os.fp
 ETTER_PASSIVE = $(ETTER_PASSIVE_FILE).gz
@@ -160,7 +160,7 @@
                      traffic.c    vendor.c      version.c      \
                      ntop_darwin.c
 
-libntop_la_DEPENDENCIES = myrrd/libmyrrd.a config.h
+libntop_la_DEPENDENCIES = config.h
 libntop_la_LIBADD       = 
 libntop_la_LDFLAGS      = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic @DYN_FLAGS@
 
@@ -171,15 +171,12 @@
                            webInterface.c
 
 
-libntopreport_la_DEPENDENCIES = myrrd/libmyrrd.a config.h
+libntopreport_la_DEPENDENCIES = config.h
 libntopreport_la_LIBADD       = 
 libntopreport_la_LDFLAGS      = $(AM_LDFLAGS) -release $(VERSION) -export-dynamic @DYN_FLAGS@
 
 man_MANS = ntop.8
 
-myrrd/libmyrrd.a:
-	cd myrrd; make
-
 .PHONY: snapshot
 
 
diff -urNb plugins/Makefile.am plugins/Makefile.am
--- plugins/Makefile.am	2004-01-16 19:26:44.000000000 +0100
+++ plugins/Makefile.am	2004-04-12 16:58:55.000000000 +0200
@@ -37,7 +37,7 @@
 # 
 plugindir = $(libdir)/ntop/plugins
 
-INCLUDES = -I.. @INCS@
+INCLUDES = -DHAVE_RRD_ABERRANT_BEHAVIOR -I.. @INCS@
 
 #
 # The meat for ntop
@@ -81,7 +81,7 @@
 
 librrdPlugin_la_SOURCES = rrdPlugin.c
 librrdPlugin_la_LDFLAGS = -shared -release @PACKAGE_VERSION@ @DYN_FLAGS@
-librrdPlugin_la_LIBADD = -L../myrrd -lmyrrd
+librrdPlugin_la_LIBADD = -lrrd_th
 
 libsflowPlugin_la_SOURCES = sflowPlugin.c
 libsflowPlugin_la_LDFLAGS = -shared -release @PACKAGE_VERSION@ @DYN_FLAGS@
diff -urNb plugins/rrdPlugin.c plugins/rrdPlugin.c
--- plugins/rrdPlugin.c	2004-03-17 21:05:40.000000000 +0100
+++ plugins/rrdPlugin.c	2004-04-12 16:58:55.000000000 +0200
@@ -476,7 +476,7 @@
 		  char *startTime, char* endTime, char *rrdPrefix) {
   char path[512], *argv[32], buf[384], buf1[384], fname[384], *label;
 #ifdef HAVE_RRD_ABERRANT_BEHAVIOR
-  char buf2[384], buf3[384], buf4[384];
+  char buf2[384], buf3[384], buf4[384], buf5[384];
 #endif
   struct stat statbuf;
   int argc = 0, rc, x, y;
@@ -545,7 +545,9 @@
     if(snprintf(buf4, sizeof(buf4), "DEF:fail=%s:counter:FAILURES", path) < 0)
       BufferTooShort();
     argv[argc++] = buf4;
-    argv[argc++] = "TICK:fail#ffffa0:1.0:Anomalia";
+    if(snprintf(buf5, sizeof(buf5), "TICK:fail#ffffa0:%.1f:Anomaly", 0.2) < 0)
+      BufferTooShort();
+    argv[argc++] = buf5;
     argv[argc++] = "CDEF:upper=pred,dev,2,*,+";
     argv[argc++] = "CDEF:lower=pred,dev,2,*,-";
     argv[argc++] = "LINE1:upper#ff0000:Upper";
@@ -560,7 +562,7 @@
 
     fillupArgv(argc, sizeof(argv)/sizeof(char*), argv);
     rrd_clear_error();
-    rc = rrd_graph(argc, argv, &calcpr, &x, &y);
+    rc = rrd_graph(argc, argv, &calcpr, &x, &y, NULL);
 
     calfree();
 
@@ -693,7 +695,7 @@
     }
 
 #ifdef HAVE_RRD_ABERRANT_BEHAVIOR
-    if(snprintf(tempStr, sizeof(tempStr), "RRA:HWPREDICT:1440:0.1:0.0035:20") < 0)
+    if(snprintf(tempStr, sizeof(tempStr), "RRA:HWPREDICT:1440:%.1f:%.4f:20", 0.1, 0.0035) < 0)
       BufferTooShort();
     argv[argc++] = tempStr;
 #endif
--- webInterface.c.orig	2004-06-15 10:08:42.780905104 +0200
+++ webInterface.c	2004-06-15 09:58:26.671567960 +0200
@@ -8208,6 +8208,9 @@
 #else
     addrput(AF_INET, &remote_ipaddr, &(((struct sockaddr_in *)&from)->sin_addr));
 #endif
+#ifdef LINUX
+    fcntl(myGlobals.newSock, F_SETFL, O_NONBLOCK);
+#endif /* LINUX */
   }
   
 #ifdef DEBUG
--- http.c.orig	2004-06-14 17:54:36.506089424 +0200
+++ http.c	2004-06-15 10:24:07.705295224 +0200
@@ -532,8 +532,9 @@
       traceEvent(CONST_TRACE_INFO, "DEBUG: Socket write returned %d (errno=%d)", rc, errno);
 #endif
       if((errno == EAGAIN /* Resource temporarily unavailable */) && (retries<3)) {
-	len -= rc;
-	bytesSent += rc;
+#ifdef LINUX
+	usleep (1000);
+#endif /* LINUX */
 	retries++;
 	goto RESEND;
       } else if(errno == EPIPE /* Broken pipe: the  client has disconnected */) {
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev

Reply via email to