MRTG Automated Script for Ubuntu


#!/bin/bash

clear

Updating System
sudo apt-get update

MRTG Installation
sudo apt-get install gcc
sudo apt-get install perl

Library Compilation
sudo apt-get install zlib1g zlib1g-devel
sudo apt-get install libpng12-0 libpng12-dev
sudo apt-get install libgd2-xpm
sudo apt-get install libgd2-noxpm

cd /usr/local/src
gunzip -c mrtg-2.17.4.tar.gz | tar xvf –
cd mrtg-2.17.4

Configuring MRTG
./configure –prefix=/usr/local/mrtg-2
./configure –prefix=/usr/local/mrtg-2 \
make
make install

Web Server Installation
sudo apt-get install apache2
sudo service mrtg start

Creating Dir /var/www/mrtg     
mkdir /var/www/mrtg

MRTG Configuration
cfgmaker –global ‘WorkDir: /var/www/mrtg’ \ –output /etc/mrtg/mrtg.cfg \
Indexmaker /etc/mrtg/mrtg.cfg –output=/var/www/mrtg/index.html
/usr/local/mrtg-2/bin/mrtg /etc/mrtg/mrtg.cfg

Setting Cron Job
echo -e “*/5 * * * * /usr/local/mrtg-2/bin/mrtg /etc/mrtg/mrtg.cfg –logging /var/log/mrtg.log” >> crontrab -e

Installation is Completed
echo -e “Please Check the MRTG http://IP-address/mrtg

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s