Typo
[invirt/scripts/munin.git] / web / usage.cgi
index 073b34c..88d7552 100755 (executable)
@@ -3,9 +3,9 @@
 use diagnostics;
 use constant GRAPH_DIR => "/var/lib/munin/xvm-prod-hosts.mit.edu";
 use CGI;
-use CGI::Carp qw(fatalsToBrowser);
 use RRDs;
 use File::Spec::Functions;
+use subs 'die';
 
 our %graph_types = (cpu => "xen_cpu");
 our %formats = qw(svg image/svg+xml png image/png eps application/postscript pdf application/pdf);
@@ -73,3 +73,18 @@ $|=1;
     print STDERR "XVM usage: ", Dumper(\@args);
 }
 RRDs::graph (@args);
+
+sub die(@) {
+  use Image::Magick;
+
+  my $im = Image::Magick->new(background => "white",
+                             fill => "red",
+                             pointsize => 14,
+                             );
+  $im->Read('label:'.join('', @_));
+  $format = 'png' unless exists($formats{$format});
+  $mime_type = $formats{$format};
+  print $q->header(-type=>$mime_type);
+  $im->Write($format.':-');
+  CORE::die @_;
+}