[ previous ] [ next ] [ threads ]
 
 From:  Dennis Karlsson <dennis at denniskarlsson dot com>
 To:  John Voigt <megeek at jvoigt dot com>
 Cc:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] Config.xml magic - the results
 Date:  Thu, 24 Jun 2004 16:16:26 +0200
That didn't work for me. I needed to unescape the < again.

This worked for me like a charm;

mkdir /usr/local/www/cgi

echo "#!/usr/local/bin/php" > /usr/local/www/cgi/dump.php

echo "<?php echo \"<pre>\";" >> /usr/local/www/cgi/dump.php

echo "\$ph = popen( \"/usr/bin/uptime; /sbin/ipfw show\", \"r\" );" >> 
/usr/local/www/cgi/dump.php

echo "while (\$line = fgets( \$ph )) echo \$line; pclose( \$ph );" >> 
/usr/local/www/cgi/dump.php

echo "echo \"</pre>\"; ?>" >> /usr/local/www/cgi/dump.php

chmod 755 /usr/local/www/cgi/dump.php

/Dennis

John Voigt wrote:

>In case anyone is interested here is the finished script (in shellcmd
>format):
>
>                <shellcmd>mkdir /usr/local/www/cgi</shellcmd>
>                <shellcmd>echo "#!/usr/local/bin/php" >
>/usr/local/www/cgi/dump.php</shellcmd>
>                <shellcmd>echo "&lt;?php echo \"&lt;pre>\";" >>
>/usr/local/www/cgi/dump.php</shellcmd>
>                <shellcmd>echo "\$ph = popen( \"/usr/bin/uptime; /sbin/ipfw
>show\", \"r\" );" >> /usr/local/www/cgi/dump.php</shellcmd>
>                <shellcmd>echo "while (\$line = fgets( \$ph )) echo \$line;
>pclose( \$ph );" >> /usr/local/www/cgi/dump.php</shellcmd>
>                <shellcmd>echo "echo \"&lt;/pre>\"; ?>" >>
>/usr/local/www/cgi/dump.php</shellcmd>
>                <shellcmd>chmod 755 /usr/local/www/cgi/dump.php</shellcmd>
>
>This creates a new web page called
>http://whatever.your.monowall.is.called/cgi/dump.php which will return your
>ipfw rules (and also the counters associated with each one.)  This allows
>another script (not on the monowall box) to feed MRTG with individual counts
>based on queues, internal ip addresses or whatever else you feel like making
>a rule for.
>
>I hope someone else finds this useful.
>
>John Voigt, President
>
>Reston Wireless, LLC
>High speed internet service
>no smoke, no mirrors, no wires (tm)
>http://www.reston-wireless.net/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
>For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
>
>  
>