Linux HOWTOs

About | Home | Search

HOWTO: mrtg
Description: Multi Router Traffic Grapher
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# MRTG 2.17.4
# ===========
# Prerequisites:
# Perl
# groff
# GD
# zlib

# MRTG uses GD for the graphics parts.  The GD web site (
# is down as I write this, the original GD web site (
# mentions it as well, but does not offer tarball downloads.  If you
# have Mercurial from here:
# Probably easier to just let MRTG to use Slackware's GD, but it does
# include Mercurial too...

test -f installed/mrtg/mrtg-2.17.4.tar.gz &&
 mv installed/mrtg/mrtg-2.17.4.tar.gz .
test ! -f mrtg-2.17.4.tar.gz &&

# Verify tarball w/ md5sum:
echo "197565e97f97212eef7b414463c8d40c  mrtg-2.17.4.tar.gz" | md5sum -c

mkdir -p -m 0700 src/mrtg
find src src/mrtg -maxdepth 1 -type d -name "mrtg-*" -exec rm -r {} \;
cd src/mrtg
tar xzvf ~/mrtg-2.17.4.tar.gz
cd mrtg-2.17.4
test $UID = 0 && chown -R root:root .

# Read this:
# doc/mrtg-unix-guide.txt


# Become root to back up files and to install it

# I run this to back up my existing mrtg files.  I use rrdtool with mrtg
# and have a lot of .rrd files in a 'data' subdirectory that I created. 
test -d /usr/local/mrtg-2 && 
 mkdir -p -m 0700 ~/backup/mrtg && 
 find /usr/local/mrtg-2 -maxdepth 1 -type f -exec cp {} ~/backup/mrtg/ \; &&
 chown -R root:root ~/backup/mrtg &&
 chmod 700 ~/backup/mrtg &&
 chmod 600 ~/backup/mrtg/*
test -d /usr/local/mrtg-2/data &&
 ( find /usr/local/mrtg-2/data -type f -name "*.png" -exec rm {} \;
 tar cjvf ~/backup/mrtg/data-`date +%Y%m%d`.tar.bz2 /usr/local/mrtg-2/data
 chmod 600 ~/backup/mrtg/data-`date +%Y%m%d`.tar.bz2 )

# Remove old docs, then install it
test -d /usr/local/mrtg-2/doc && rm -r /usr/local/mrtg-2/doc
test -d /usr/local/mrtg-2/man && rm -r /usr/local/mrtg-2/man
make install

# Become yourself again

mkdir -p -m 0700 installed/mrtg
rm -f installed/mrtg-*.tar.gz installed/mrtg/mrtg-*.tar.gz
mv mrtg-2.17.4.tar.gz installed/mrtg/

# Now read this:
lynx /usr/local/mrtg-2/share/doc/mrtg2/unix-guide.html

Back to the list

Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>