How to remove spikes from your MRTG graphs

published on 2006-11-15 in computing

All my geek friends know that I am a graph addict. I manage about 100 Linux servers that have every single mildly interesting property graphed 6 ways from Tuesday. I'd graph how often I go to the can if it wasn't such a manual process to record it. (FOR NOW!!) Personally, I rarely use MRTG anymore and have ditched it in favor of RRDTool...except for network gear. MRTG was designed for that and is still a good application in that respect.

Anyway, as part of an ongoing series (har) on core UNIX tools (sed, awk, grep etc) I present a small shell script that will smooth out spikes on your MRTG graphs. Run it from the directory that contains your MRTG log files. To edit the threshold cap, change 1000000 to whatever you need.

#! /bin/sh

LIST=`ls *.log`
mkdir -p old/
cp *.log old/
for i in $LIST
    do awk '!(NF==5 && ($4+$5) > 1000000)'  old/$i > $i 
done

Download here: http://www.mybrainhurts.com/software/smooth_mrtg.txt

P.S. Thanks to Jason for the del.icio.us link that inspired me to be more interesting by blogging daily.

Tags: mrtg linux