* MRTG hackery All of this dreck is stored in my MRTG installation directory. That dir is /user/fritchie/src/mrtg/PRODUCTION. Anywhere you see that string, replace it with whatever your MRTG installation directory happens to be. Cisco_675_config Just a dump of my 675's config (OS version 2.1.0) Crontab Shows the "crontab" entry I use (using an account other that "root"!) to run MRTG and then the followup script "summarize.pl". Edit paths accordingly. getrawdata.pl You'll need to install the "Net::Telnet" Perl module. You can fetch it from www.cpan.org. (Hints for the Perl novice: or from the same dir you're getting this other stuff from. To install it: tar zxvf Net-Telnet-version#.tar.gz cd Net-Telnet-version# perl Makefile.pl make install ) Change lines 6 & 7 to reflect your 675's IP address and password. getval.pl There are a couple of hardcoded paths at the top. Edit accordingly. mrtg.cfg This is the MRTG config file. There are several things being monitored, each with its own little section that begins with a Target[] line and ends with the next Target[] line (or EOF). Usually the Target[] line specifies the MIB info required to retrieve the relevant data. Since we can't rely on the 675's SNMP agent to tell us anything useful (at least under v2.1.0), MRTG must use an external program. The path to that program is found in the Target[] line. Edit *all* of them accordingly. Ah, also, the first line specifies where MRTG ought to put the HTML and image files it generates (WorkDir). Edit accordingly. summarize.pl This script isn't strictly necessary. I wrote it because I wanted something that MRTG doesn't normally do: create the "Statistics by Time" stuff you see at http://www.snookles.com/mrtg/. The summarize.pl script does a minimal parsing job of the HTML files generated by MRTG and creates some new HTML files. The $dir definition at the top should match mrtg.cfg's "WorkDir" definition. Edit the HTML blather to your heart's content. Newer releases of MRTG may have changed the way it outputs HTML code, which would break this minimal parser. I'm using MRTG v2.7.0, and it works. YMMV. Oh, that's right. Duh. This script automatically creates a "index.html" file to keep Apache (as configured here) from automatically generating an index of directory. If you like it, keep it. * ICECAST hackery I don't have a lot of advice in getting the ICECAST source code to compile cleanly. Find someone to help you. If that someone turns out to be me, prepare to feed me pizza or suitable starch/protein/fat substitute. :-) I'd be happy to help out, as long as it isn't on a Tuesday night. I've created a non-root user called "ice" which is used to run the icecast servers. /etc/passwd contains: # grep ice /etc/passwd ice:*:73:73:Icecast User:/user/ice: All of the icecast-related stuff is stored in the "ice" user's home directory, /user/ice. The icecast server executable is stored in the "bin" subdir. The config file for the server I've got running on port 8000 is in the "etc" subdir. # cd ~ice # ls -lR total 7 -rwxr-xr-x 1 root wheel 777 Nov 8 15:14 Cron.check.sh -rwxr-xr-x 1 root wheel 423 Nov 8 15:20 Cron.dircheck.sh -rwxr-xr-x 1 root wheel 608 Aug 1 13:12 RC.sh drwxr-xr-x 2 root wheel 512 Jul 27 15:16 bin drwxr-xr-x 3 root wheel 512 Jul 23 04:58 etc drwxr-xr-x 2 ice wheel 512 Nov 8 04:01 logs.8000 drwxr-xr-x 2 ice wheel 512 Nov 8 04:01 logs.8001 ./bin: total 1200 lrwxrwxrwx 1 root wheel 16 Jul 26 02:36 icecast -> icecast.afterslf -rwxr-xr-x 1 root wheel 567324 Jul 27 15:17 icecast.afterslf -rwxr-xr-x 1 root wheel 638590 Jul 16 22:59 icecast.b4slf ./etc: total 48 lrwxrwxrwx 1 root wheel 18 Jul 26 02:36 8000.conf -> 8000.conf.afterslf -rw-r--r-- 1 root wheel 15453 Aug 5 00:15 8000.conf.afterslf -rw-r--r-- 1 root bin 15033 Jul 20 22:53 8000.conf.b4slf -rw-r--r-- 1 root wheel 15033 Jul 21 11:51 8001.conf ./logs.8000: total 2923 -rw-r--r-- 1 ice wheel 2546993 Nov 8 15:27 access.log -rw------- 1 ice wheel 13 Nov 8 04:00 access.log.offset -rw-r--r-- 1 ice wheel 382132 Nov 8 15:28 icecast.log -rw------- 1 root wheel 12 Nov 8 15:14 icecast.log.offset -rw-r--r-- 1 ice wheel 3386 Nov 8 15:27 stats.log -rw-r--r-- 1 ice wheel 37231 Nov 8 15:26 usage.log ./logs.8001: total 39 -rw-r--r-- 1 ice wheel 0 Aug 26 04:01 access.log -rw------- 1 ice wheel 7 Nov 8 04:01 access.log.offset -rw-r--r-- 1 ice wheel 476 Nov 8 04:01 icecast.log -rw-r--r-- 1 ice wheel 353 Nov 8 15:28 stats.log -rw-r--r-- 1 ice wheel 36715 Nov 8 15:27 usage.log I'll include a copy of my port 8000's config file. There's a lot of stuff buried in there you'll want to edit. See the Icecast docs for most of that. The stuff I added is the "portalias" command: hopefully its syntax is obvious. I've got a few other goodies that I'll include because they're pretty darn useful. Cron.check.sh This script is run by "cron" every 5 minutes to check to see if the icecast server has spazzed out, hogging all available CPU time. If so, it kills it and restarts it via the RC.sh script. The crontab entry looks like: 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /user/ice/Cron.check.sh Edit the LASTMINFILE, EMAIL, and STARTSTOP lines accordingly. You'll also have to edit the MINUTES line, changing the pattern of the first "grep": edit the path to the icecast executable and the icecast config file. In the event that this script doesn't work, it's probably because it isn't properly calculating how long the silly thing has run. When you type the following command when the icecast server is running, this is what you should see (with different paths, of course). # ps axww | grep '/user/ice/bin/icecast -c /user/ice/etc/8000.conf' 47535 ?? I 0:00.10 su -c cd /user/ice/logs.8000 ; /user/ice/bin/icecast -c /user/ice/etc/8000.conf 2>&1 > /dev/null (sh) 47542 ?? S 66:16.34 /user/ice/bin/icecast -c /user/ice/etc/8000.conf (icecast.afterslf) Cron.dircheck.sh This is another script that I found I needed to write. Occasionally the icecast server stops advertising itself to yp.shoutcast.com, yp.icecast.org, and whatever other streaming server directories you may have had configured. This script is run twice/hour, checking the log files for the telltale signs of successful directory updates. If they didn't happen in the last 1/2 hour, the server is stopped & restarted. The crontab entry I use is: 14,44 * * * * /user/ice/Cron.dircheck.sh Edit the LOG, EMAIL, and STARTSTOP lines accordingly. Note also that this script relies on a very handy little utility called "logtail". I've included the C source code. It spits out the tail of the file that has been appended since the last time "logtail" was run on that file. Very handy for processing only the new stuff added to a log file. Compile via "gcc -o logtail logtail.c". Then place the "logtail" executable in /usr/local/bin, i.e. "mv logtail /usr/local/bin". RC.sh This is the script I use to start and stop the icecast server. You'll have to do some editing to change paths. In its current form, it starts two servers, one for port 8000 and one for port 8001. Feel free to remove the junk wrt port 8001. In /etc/rc.local, which is executed at boot time, I have: ## ## Start icecast daemon(s) ## if [ -f /user/ice/RC.sh ]; then /user/ice/RC.sh start fi Shout.mc I have a separate machine, behind my firewall, perform the actual MP3 streaming to the icecast server, which runs on the firewall. It's not the world's greatest firewall design to do things that way, but I don't have the spare machines available to get things closer to The Right Way(tm) (or at least A Way That Sucks Less(tm)). This script runs on that separate machine, starting the streaming to the proper "portalias" port on the firewall's icecast daemon.