[rrd-users] Re: CGI optimization

Tobias Oetiker oetiker at ee.ethz.ch
Wed Aug 15 00:34:24 MEST 2001


Yesterday J. Michael Lipsey wrote:

 | I'm a bit of a novice on web server optimization  and was wondering if
 | anyone had some tips.
 |
 | I just moved all of my MRTG/RRDtool stuff from a low end Ultra 5 to an E450.
 | I've noticed some small difference but not as much as I was hoping.  I have
 | mod_perl installed but that's about all I've done. My configs have a rather
 | large number of interfaces in them - so - I was planning on splitting them
 | out into small groups to attach to the 14all.cgi script so that the script
 | would not have to parse as much to build the graphs but that is all I have
 | come up with to make things faster.
 |
 | Any help is appreciated.
 |
 | J. Michael Lipsey
 | Network Engineer
 | RoadRunner Western Region
 | mlipsey at va.rr.com
 |
 | This message sent with 100% recycled electrons...

the best you can do for 14all is to convert it to speedycgi
http://daemoninc.com/speedycgi/

Here is a quick and DIRTY patch for 14all-1.1.cgi


--- 14all-1.1.cgi	Wed Nov 22 11:02:45 2000
+++ mrtg_switch.cgi	Sat Jan 27 12:27:45 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/speedy -w
 #
 # 14all.cgi
 #
@@ -10,7 +10,6 @@

 # if RRDs (rrdtool perl module) is not in the module search path (@INC)
 # uncomment the following line and change the path appropriatly:
-use lib qw(/usr/local/mrtg290/lib/mrtg2);

 # RCS History - removed as it's available on the web

@@ -67,7 +68,8 @@
 $q = new CGI;

 # change for mrtg-2.9.*
-my (@sorted, %config, %targets);
+use vars qw(@sorted %config %targets); #make the vars persistent for speedy
+
 my %myrules = (
 	'14all*errorpic' =>
 		[sub{$_[0] && (-r $_[0] )}, sub{"14all*ErrorPic '$_[0]' not found/readable"}],
@@ -110,9 +112,13 @@

 # read the config file

-readcfg($cfgfile, \@sorted, \%config, \%targets, "14all", \%myrules);
-my @processed_targets;
-cfgcheck(\@sorted, \%config, \%targets, \@processed_targets);
+if (not defined @sorted){ # make sure we skip this with speedy the second time we run
+
+  readcfg($cfgfile, \@sorted, \%config, \%targets, "14all", \%myrules);
+  my @processed_targets;
+  cfgcheck(\@sorted, \%config, \%targets, \@processed_targets);
+
+}

 # set some defaults
 if (exists $config{refresh} && yesorno($config{refresh})
@@ -127,14 +133,14 @@
 <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
   <TR>
     <TD WIDTH=63><A ALT="MRTG"
-    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"><IMG
-    BORDER=0 SRC="$config{icondir}mrtg-l.gif"></A></TD>
+    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/><IMG
+    BORDER=0 SRC="$config{icondir}mrtg-l.png"></A></TD>
     <TD WIDTH=25><A ALT=""
-    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"><IMG
-    BORDER=0 SRC="$config{icondir}mrtg-m.gif"></A></TD>
+    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/"><IMG
+    BORDER=0 SRC="$config{icondir}mrtg-m.png"></A></TD>
     <TD WIDTH=388><A ALT=""
-    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"><IMG
-    BORDER=0 SRC="$config{icondir}mrtg-r.gif"></A></TD>
+    HREF="http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/"><IMG
+    BORDER=0 SRC="$config{icondir}mrtg-r.png"></A></TD>
   </TR>
 </TABLE>
 <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
I have attached my slightly hacked version of 14all for your
enjoyment

tobi

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, ETZ J97, ETH, 8092 Zurich, Switzerland
 / // _ \/ _ \/ / phoneto:+41(0)1-632-5286  faxto:+41(0)1-632-1517
/_/ \.__/_.__/_/ mailto:oetiker at ee.ethz.ch http://people.ee.ethz.ch/~oetiker


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list