Same problem here.

Ideally it should return an image that shows the graph generation has failed. The real problem is that munin-cgi-graph exists on any error which is undesirable when used as fastcgi. The following patch replaces the die() statements with "return".

From 263c028f8e3dc00b022fe016239108bfd462eef8 Mon Sep 17 00:00:00 2001
From: Xiwen Cheng <[email protected]>
Date: Mon, 3 Sep 2012 17:57:06 +0200
Subject: [PATCH] bugfix: return instead of die()

---
 munin-cgi-graph |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/munin-cgi-graph b/munin-cgi-graph
index a3d274d..23fc3f1 100755
--- a/munin-cgi-graph
+++ b/munin-cgi-graph
@@ -222,7 +222,7 @@ while (new CGI::Fast) {
                }

                # Generic error
-               die $@;
+                return;
        }
     }

@@ -292,7 +292,7 @@ sub send_graph_data {

     if (! open (GRAPH_PNG_FILE, '<', $filename) ) {
ERROR "[FATAL] Could not open image file \"$filename\" for reading: $!\n"; - die "[FATAL] Could not open image file \"$filename\" for reading: $!\n";
+        return; # unable to read image
     }

     # No buffering wanted when sending the file
@@ -411,7 +411,7 @@ sub draw_graph {
     # remove old file if present
     if (-f $filename and !unlink($filename)) {
        ERROR "[FATAL] Could not remove \"$filename\": $!";
-       die("[FATAL] cannot remove old graph file \"$filename\": $!");
+        return;
     }

$serv =~ s{[^\w_\/"'\[\]\(\)+=-]}{_}g; $serv =~ /^(.+)$/; $serv = $1; #"
--
1.7.10.4


--
Xiwen Cheng - Cloud Infrastructure Engineer
+31 (0)10 2760434 | [email protected] | www.mendix.com


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to