Hi all,

On FreeBSD (9, 10 and 11 at least) nfsen graphes are truncated to 16384
bytes (as reported by ls), see attached graph for a sample…

I managed to workaround this applying attached patch (using a temp file
instead of stdout when generating graph).

It may be related to the default pipe buffer size (see
http://unix.stackexchange.com/questions/11946/how-big-is-the-pipe-buffer/11947
)

Hope this helps…

ps: I wanted to open a ticket, but no way to create one @SF …
-- 
*geoffroy desvernay*
C.R.I - Administration systèmes et réseaux
Ecole Centrale de Marseille
Tel: (+33|0)4 91 05 45 24
Fax: (+33|0)4 91 05 44 26

What to do if you find yourself stuck with no hope of rescue:
 Consider yourself lucky that life has been good to you so far.
 Alternatively, if life hasn't been good to you so far—which, given your
present circumstances, seems more likely—consider yourself lucky that it
won't be troubling you much longer
– Hitchhiker's Guide to the Galaxy
--- NfSenRRD.pm.orig	2017-03-17 13:19:22.194172000 +0100
+++ NfSenRRD.pm	2017-03-17 13:23:22.365788000 +0100
@@ -38,6 +38,7 @@
 use RRDs;
 use Log;
 use NfSen;
+use File::Temp qw/tempfile/;
 use strict;
 use warnings;
 
@@ -451,7 +452,8 @@
 	}
 
 	my @rrdargs = ();
-	push @rrdargs, "-";	# output graphics to stdout
+  my (undef,$tmpng) = tempfile('/tmp/NfProfilePNGXXXX',OPEN => 0) or die "Unable to create tempfile";
+	push @rrdargs, $tmpng;	# output graphics to temp file
 
 	foreach my $def ( @DEFS ) {
 		$$profileinfo{'channel'}{$def}{'scale'} = $$profileinfo{'channel'}{$def}{'sign'} eq "-" ? -1 : 1;
@@ -527,6 +529,8 @@
 		SendFile("$NfConf::HTMLDIR/icons/ErrorGraph.png");
 		return "$ERROR: Arg: '$profile', '$sources', '$proto', '$type', '$pstart', '$tstart', '$tend', '$tleft', '$tright', '$width', '$heigh', '$light', '$logscale', '$linegraph'";
 	} else {
+    SendFile($tmpng);
+    unlink($tmpng);
 		return "ok";
 	}
 
@@ -567,7 +571,8 @@
 	my @DEFS = split ':', $sources;
 	
 	my @rrdargs = ();
-	push @rrdargs, "-";	# output graphics to stdout
+  my (undef,$tmpng) = tempfile('/tmp/NfProfilePNGXXXX',OPEN => 0) or die "Unable to create tempfile";
+	push @rrdargs, $tmpng;	# output graphics to temp file
 
 	foreach my $def ( @DEFS ) {
 		push @rrdargs, "DEF:data${def}=$NfConf::PROFILESTATDIR/~$alertname/avg-$type.rrd:${def}:AVERAGE";
@@ -604,6 +609,8 @@
 		SendFile("$NfConf::HTMLDIR/icons/ErrorGraph.png");
 		return "ERR failed $ERROR";
 	} else {
+    SendFile($tmpng);
+    unlink($tmpng);
 		return "ok";
 	}
 

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nfsen-discuss mailing list
Nfsen-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfsen-discuss

Reply via email to