Monday, April 11, 2011

How To: MRTG 2.17.2 + RRD Tool 1.4.5 on CentOS 5.5

Open Terminal & run each command below:


[root]# yum install -y gcc gd gd-devel perl libpng
[root]# wget http://oss.oetiker.ch/mrtg/pub/mrtg.tar.gz
[root]# tar zfx mrtg.tar.gz
[root]# cd mrtg-2.17.2
[root]# ./configure --prefix=/usr/local/mrtg2
[root]# make
[root]# make install
[root]# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz
[root]# tar zfx rrdtool.tar.gz
[root]# cd rrdtool-1.4.5
[root]# ./configure --prefix=/usr/local/rrdtool
[root]# yum install libxml2-devel cairo-devel glib2-devel pango-devel
[root]# make
[root]# make install
[root]# mkdir /var/www/mrtg /home/mrtg
[root]# /usr/local/mrtg2/bin/cfgmaker --global "WorkDir: /var/www/mrtg" --global "Options[_]: growright, bits" --global "RunAsDaemon: Yes" --global "LogFormat: rrdtool" --global "PathAdd: /usr/local/rrdtool/bin" --global "LibAdd: /usr/local/rrdtool/lib/perl/5.8.8" -ifref=ip --output /home/mrtg/mrtg.cfg PublicASA@192.168.255.36
[root]# env LANG=C /usr/local/mrtg2/bin/mrtg /home/mrtg/mrtg.cfg
[root]# gedit /etc/cron.d/mrtg


##Add/Edit as below##
*/5 * * * * root env LANG=C /usr/local/mrtg2/bin/mrtg /home/mrtg/mrtg.cfg --logging /var/log/mrtg.log
##Save & Close##


[root]# chkconfig crond on
[root]# /usr/local/mrtg2/bin/indexmaker --output=/var/www/mrtg/index.html /home/mrtg/mrtg.cfg
[root]# gedit /etc/httpd/conf.d/mrtg.conf


##Add/Edit as below##
Alias /mrtg /var/www/mrtg

    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 172.26.20.0/24
    Allow from ::1

##Save & Close##


[root]# chkconfig --add httpd
[root]# chkconfig httpd on
[root]# service httpd restart
[root]# wget http://nchc.dl.sourceforge.net/project/my14all/14all/1.1p25/14all-1.1p25.tar.gz
[root]# tar zfx 14all-1.1p25.tar.gz
[root]# cd 14all
[root]# cp 14all.cgi /var/www/cgi-bin
[root]# gedit /var/www/cgi-bin/14all.cgi


##Add/Edit as below##
use lib qw(/usr/local/mrtg2/lib/mrtg2);
$cfgfile = 'mrtg.cfg';
$cfgfiledir = '/home/mrtg';
##Save & Close##


##DONE##


Open browser & go to http://localhost/mrtg/


##Add/Edit /var/www/mrtg/index.html as you need##


#END#

7 comments:

  1. wonderful submit, very informative. I ponder why the opposite specialists of this sector don't realize this. You should continue your writing. I am confident, you've a great readers' base already!

    pure Garcinia Cambogia

    ReplyDelete
  2. I have some problems ,when i typed
    /usr/local/mrtg2/bin/indexmaker --output=/var/www/mrtg/index.html /home/mrtg/mrtg.cfg,
    i am getting following error:
    ERROR: did not find any matching data in cfg file

    Your valuable Helps are appreciated

    Thanks in Advanced ...

    ReplyDelete
  3. when running mrtg its not releasing html files,any one can help

    ReplyDelete
  4. Am getting an error when i run this..
    #env LANG=C /usr/bin/mrtg /var/www/html/rrdmrtg/
    Use of uninitialized value $first in pattern match (m//) at /usr/bin/../lib/mrtg2/MRTG_lib.pm line 611.
    Use of uninitialized value $dir in concatenation (.) or string at /usr/bin/mrtg line 2531.
    Use of uninitialized value $dir in concatenation (.) or string at /usr/bin/mrtg line 2549.
    Use of uninitialized value $dir in concatenation (.) or string at /usr/bin/mrtg line 2565.

    ReplyDelete
  5. I Have a error ERROR: I Quit! Another copy of mrtg seems to be running. Check /etc/mrtg/mrtg.pid

    Thanks

    ReplyDelete