Page 1 of 6 123 ... LastLast
Results 1 to 20 of 116

Thread: HOWTO: Compile, configure and run MRTG

  1. #1
    Join Date
    Jun 2003
    Location
    UK
    Posts
    2,326

    HOWTO: Compile, configure and run MRTG

    As usual, i take no responsibility if anything goes wrong, the how-to assumes everything required is installed (GD, and a few perl modules - you will be notified if anything required is missing and provided with directions to help files by MRTG itself.

    # lines starting with a '#' like this are to be used from command line

    // text lines like these (starting with '//') are comments

    =========

    # wget http://people.ee.ethz.ch/~oetiker/we...ub/mrtg.tar.gz

    # tar -zxvh mrtg.tar.gz

    # cd mrtg*

    # ./configure --with-gd=/usr/local/lib

    # make

    # make install

    // now, if you did not recieve any error messages and everything went ok its time to get your cfg sorted and everything else setup.

    // Please replace the /path/to/html/folder/ with the actual path to the html folder of the site which you wish to display the mrtg graphs at.

    # cd /path/to/html/folder/mrtg/



    # pico -w mrtg.sh

    // paste the following code in the file:
    // (Thanks to ryanz on the plesk forums for this)

    #!/bin/sh

    INFO=`grep eth0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2`
    RECEIVE=`echo $INFO | cut -d" " -f1`
    TRANSMIT=`echo $INFO | cut -d" " -f9`
    UPTIME=`uptime | tr -s ' ' ' ' | cut -d" " -f4-`
    echo $RECEIVE
    echo $TRANSMIT
    echo $UPTIME
    echo "yourdomain.com"

    // CTRL and X to exit, press y to confirm the file save.

    # chmod 755 mrtg.sh

    // Now to create the CFG

    # pico -w mrtg.cfg

    WorkDir: /path/to/html/folder/mrtg/

    Target[index]: `/path/to/html/folder/mrtg/mrtg.sh`
    MaxBytes[index]: 25000000
    Title[index]: Traffic and Load Analysis
    PageTop[index]: <H1>Traffic and Load Analysis</H1>
    Xsize[index]: 400
    YSize[index]: 200


    // nearly done!!
    // now you can start it to see if its worked
    // Check where mrtg is installed... it should be /usr/local/mrtg-2/
    // if it is different replace the following paths appropiately

    # /usr/local/mrtg-2/bin/mrtg /path/to/html/folder/mrtg/mrtg.cfg

    // now depending what domain you used as the /path/to/html/folder go to the domain with a trailing mrtg, for example, if you used the path to the html folder of myfavdomain.com you would now go to:

    http://myfavdomain.com/mrtg/index.html

    you should see some pretty empty graphs

    if thats the case, you can now add mrtg to cron to have it run every 5 minutes (or any other lengh you wish to use) to keep them graphs up2date.

    # pico -w /etc/crontab

    // after all the other lines enter this:

    */5 * * * * root /usr/local/mrtg-2/bin/mrtg /path/to/html/folder/mrtg/mrtg.cfg

    // Please note the above line contains the same line used to start mrtg above, you can paste the line you used to start to speed things up slighly if you wish.

    Now give it a few hours to notice the graphs in any detail. After just 1 hour you should start seeing data on your daily graph

    Hope you enjoy this HOWTO guide any problems please feel free to post here.

    Chris
    Last edited by ProWebUK; 10-06-2003 at 03:06 PM.
    OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
    ProWebUK - Quality Web Services
    DirectAdmin Server Checklist

  2. #2
    Join Date
    Jun 2003
    Posts
    1,471
    I'm getting:
    -----------------------------------------------------------------------
    ERROR: Mrtg will most likely not work propperly when the environment
    variable LANG is set to UTF-8. Please run mrtg in an environment
    where this is not the case:

    env LANG=C /usr/local/mrtg-2/bin/mrtg ...
    -----------------------------------------------------------------------
    when I run
    Code:
    /usr/local/mrtg-2/bin/mrtg /home/.............../mrtg.cfg
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  3. #3
    Join Date
    Jun 2003
    Posts
    1,471
    Ok, typing
    Code:
    LANG="en_US"
    on the command line fixed that error.

    Now I get:
    ERROR: "WorkDir" not specified in mrtg config file
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  4. #4
    Join Date
    Jun 2003
    Posts
    1,471
    I chmodded 0755 mrtg.sh and prepended
    Code:
    WorkDir: /path/to/html/folder/mrtg
    to mrtg.cfg and all appears to be working.

    Thanks Chris!


    Edit: MRTG is really cool :P www.liquenox.net/mrtg
    Last edited by l0rdphi1; 09-26-2003 at 07:39 PM.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  5. #5
    Join Date
    Jun 2003
    Location
    UK
    Posts
    2,326
    check your mrtg.cfg, it should be:


    ##################################
    WorkDir: /path/to/html/folder/mrtg/

    Target[index]: `/path/to/html/folder/mrtg/mrtg.sh`
    MaxBytes[index]: 25000000
    Title[index]: Traffic and Load Analysis
    PageTop[index]: <H1>Traffic and Load Analysis</H1>
    Xsize[index]: 400
    YSize[index]: 200
    #################################

    (without the # )

    Tell us how that goes, or if its already in your cfg.

    Chris
    OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
    ProWebUK - Quality Web Services
    DirectAdmin Server Checklist

  6. #6
    Join Date
    Aug 2003
    Posts
    575
    What is MRTG?

    Cheers,
    Matt

  7. #7
    Join Date
    Jun 2003
    Posts
    1,471
    Does graphs based on imputted data.

    Check out www.liquenox.net/mrtg
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  8. #8
    Join Date
    Aug 2003
    Posts
    575
    Ahhhh, handy

    Thanks!
    Matt

  9. #9
    Join Date
    Oct 2003
    Posts
    8
    worked just perfect, i also had to chmod the mrgt.sh file, but after that no problemo...
    On my cpanel and ensim boxes i have a "full" mrtg with all the graphs, and i miss a few of them here - anyone with a howto on the full setup?

    thanks

  10. #10
    Join Date
    Jun 2003
    Location
    UK
    Posts
    2,326
    dont currently have them for DA, you may want to check the CFG's being used on your Cpanel / Ensim systems and try to convert them to work with DA.

    If you get them to work it would be brilliant if you could post them here for the other DA users

    Chris
    OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
    ProWebUK - Quality Web Services
    DirectAdmin Server Checklist

  11. #11
    Join Date
    Oct 2003
    Posts
    8
    ok - ill give it a try

  12. #12
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    Did anybody succesfully create a full graph config for DA?

  13. #13
    Join Date
    Jun 2003
    Location
    UK
    Posts
    2,326
    full graph config?
    OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
    ProWebUK - Quality Web Services
    DirectAdmin Server Checklist

  14. #14
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    I was referring to joker's sentence : "On my cpanel and ensim boxes i have a "full" mrtg with all the graphs, and i miss a few of them here - anyone with a howto on the full setup?"
    To which you answered that it needed to be converted

  15. #15
    Join Date
    May 2003
    Posts
    142
    Originally posted by interfasys
    Did anybody succesfully create a full graph config for DA?


    http://download.cheetaweb.com/mrtg-2...panel.i386.rpm


    Install that.. Then alter /etc/mrtg/mrtg.cfg

    Change the WorkDir to: /var/www/html/mrtg

    Save and exit.. Then mkdir /var/www/html/mrtg


    You can then setup an alias to the graphs the same way webmail and phpmyadmin works...


    I've never built an RPM so I'm not gonna bother trying to

  16. #16
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    Since I already have mrtg installed, I guess I'll be better off finding a .cfg from the web, no?

  17. #17
    Join Date
    May 2003
    Posts
    142
    Originally posted by interfasys
    Since I already have mrtg installed, I guess I'll be better off finding a .cfg from the web, no?

    You could.. But you need the scripts that get the stats from the server

    Easies would be to just remove the current RPM and install the new one... Its a stock MRTG binary...

  18. #18
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    .cfg and .sh of course =)

    I installed from source, so I guess rpm -e would not work...
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  19. #19
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    2,097
    */5 * * * * /usr/local/mrtg-2/bin/mrtg /path/to/html/folder/mrtg/mrtg.cfg

    does not work for me (command works from console though)

    Any idea on how to run the script every 5 minutes?

    I mean should I use this one instead :
    */5 * * * * root /usr/local/mrtg-2/bin/mrtg /path/to/html/folder/mrtg/mrtg.cfg
    ?
    Olivier
    interfaCentre - We design custom hosting solutions

    Custom apps, scripts and configurations for easy and secure access to all hosting services
    Full Personal Information Management suite with mobile synchronisation
    PHP, Ruby, Node.js and Python hosting with 1-click app install

  20. #20
    Join Date
    Jun 2003
    Location
    UK
    Posts
    2,326
    Originally posted by interfasys
    */5 * * * * /usr/local/mrtg-2/bin/mrtg /path/to/html/folder/mrtg/mrtg.cfg

    does not work for me (command works from console though)
    Can i ask where you added the line?
    OptimumServers » Managed Dedicated Servers & General Systems Management » Coming Soon!
    ProWebUK - Quality Web Services
    DirectAdmin Server Checklist

Page 1 of 6 123 ... LastLast

Similar Threads

  1. HOWTO : MRTG for Mailscanner
    By interfasys in forum How-To Guides
    Replies: 9
    Last Post: 09-05-2008, 08:43 PM
  2. Configure and compile php4 with CustomBuild
    By Mich in forum Installation / System Requirements
    Replies: 2
    Last Post: 01-31-2008, 07:37 AM
  3. HOWTO: Install MRTG (FULLY AUTOMATED) 2.12.2
    By @how@ in forum How-To Guides
    Replies: 73
    Last Post: 05-12-2007, 12:10 AM
  4. HOWTO: Very easy RPM based MRTG installation
    By ProWebUK in forum How-To Guides
    Replies: 60
    Last Post: 03-12-2005, 08:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •