HOWTO: Install MRTG (FULLY AUTOMATED)

Hello,

I've tried to install MRTG on my FreeBSD machine. It isn't working. While trying to install I'll get the following:

*********
checking for gdImageGif in -lgd... no
checking for gdImagePng in -lgd... no
checking for gdImagePng_jpg in -lgd... no
checking for gdImagePng_jpg_ft in -lgd... no
checking for gdImageGd in -lgd... no
checking gd.h usability... yes
checking gd.h presence... yes
checking for gd.h... yes

** Ooops, one of many bad things happened:

a) You don't have the GD library installed.
Get it from http://www.boutell.com, compile it and
use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify
its location. You might also have to use --with-z-inc,
--with-z-lib and --with-png-inc, --with-png-lib for gd
versions 1.6 and higher. Check config.log for more
information on the problem.

b) You have the GD library installed, but not the gd.h
header file. Download the source (see above) and use
--with-gd-inc=DIR to specify where the file can be found.

c) You have the library and the header file installed, but
you also have a shared GD library in the same directory.
Remove the shared library files and/or links (e.g.
libgd.so.2.0.0, libgd.so and libgd.so.2). This is especially
likely if you're using a recent (post 1.8.4) version of GD
and didn't configure it with --disable-shared.

d) You have gd library installed and also it's headers, but you are
missing libpng (and headers) or freetype (and headers)
(mrtg does not use freetype, but if your copy of gd is precompiled
against it, you have to install it ...

Consider following the instructions in doc/mrtg-unix-guide.txt
*********

When I take a look at my phpinfo() all these libraries are installed. Someone knows how to fix this?
 
if you edit his script to download the current MRTG tar file it should work for you.
 
I've download the script and execute it, but it's not ok
Below my log of installation.




[root@auberge-vps ~]# ./install.mrtg.sh
MRTG Installer 1.0 ---------------------
By: Matt Savona (www.serveio.com)
----------------------------------------


Checking for previous MRTG installation...
The directory /var/www/html/mrtg does not exist. I will create it...
Creating necessary directories and preparing for installation...
Preparations complete...
Downloading the most recent MRTG and installing it...
--15:50:11-- http://oss.oetiker.ch/mrtg/pub/mrtg.tar.gz
=> `mrtg.tar.gz'
Resolving oss.oetiker.ch... 213.144.137.220
Connecting to oss.oetiker.ch|213.144.137.220|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,069,188 (1.0M) [application/x-tar]

100%[====================================>] 1,069,188 981.29K/s

15:50:12 (978.24 KB/s) - `mrtg.tar.gz' saved [1069188/1069188]

checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
MRTG has been installed...
Updating MRTG config and template...
--15:50:16-- http://www.serveio.com/da/mrtgcfg.tar.gz
=> `mrtgcfg.tar.gz'
Resolving www.serveio.com... 69.9.34.242
Connecting to www.serveio.com|69.9.34.242|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,056 (2.0K) [application/x-gzip]

100%[====================================>] 2,056 --.--K/s

15:50:16 (34.40 MB/s) - `mrtgcfg.tar.gz' saved [2056/2056]

Update complete!
Adding MRTG to /etc/crontab...
Executing MRTG for the first time (you may see some warnings)...
./install.mrtg.sh: line 64: /usr/local/mrtg-2/bin/mrtg: No such file or directory
If you see warnings above, it is generally safe to ignore.
Cleaning up installation...
Installation of MRTG complete!
 
Last edited:
Anyone a idee how to complie the status on MRTG.
MRTG show the load on (10E-2), I want the real valus as shows in top....

Same for traffic, cpu...

Thanks.
 
Last edited:
Thanks, it works on Centos 5.

Someone mentioned that this doesn't use snmp? if that's the case, is there any big difference?
 
You will need to change the URL of the MRTG file in your script to :

Code:
http://oss.oetiker.ch/mrtg/pub/mrtg.tar.gz

The guy had to move his website, since he's no longer in the staff of ETHZ (as I understood).
 
Is there anyway to make the "Traffic" script, scroll from left to right, instead of right to left?
 
Okay guys.

http://sv03.aklmedia.nl/filedump/system
http://sv03.aklmedia.nl/filedump/mrtg.cfg

Don't forget to post your own extensions!
(Actualy, these are not mine. Thanks Imtek!)
Additional stats:

mrtg.cfg:
Code:
PageTop[^]: <table cellspacing="0" cellpadding="10" border="0" width="100%" align="center"><tr><td width="185" valign="top" class="small"><table cellspacing="0" cellpadding="5" border="0" width="100%"><tr><td class="tableh">Network</td></tr><tr><td class="tablesh"><a href="index.html">- Traffic</a><br><a href="tcp.html">- Open Connections</a></td></tr><tr><td> </td></tr><tr><td class="tableh">System Stats</td></tr><tr><td class="tablesh"><a href="load.html">- Load Averages</a><br><a href="swap.html">- Swap Memory</a><br><a href="processes.html">- Processes</a><br><a href="uptime.html">- Uptime and Idle Time</a><br><a href="cpu.html">- CPU</a><br><a href="memory.html">- Memory Usage</a><br><a href="pop3.html">- Email POP3 Logins</a><br><a href="imap.html">- Email IMAP Logins</a><br><a href="mail.html">- Email Delivered</a><br><a href="spam.html">- Email Spam Blocked</a><br><a href="sa.html">- SpamAssassin Scans</a></td></tr><tr><td> </td></tr></table></td><td>

mrtg.cfg:
Code:
#----------------------------
# Email Delivered
#----------------------------
Target[mail]: `/var/www/html/mrtg/core/system mail`

Title[mail]: Email Delivered

PageTop[mail]: <h3>Email Delivered</h3>

YLegend[mail]: Email Delivered

ShortLegend[mail]:    

LegendI[mail]:

LegendO[mail]: Email Delivered  

#----------------------------
# SpamAssassin Scans
#----------------------------
Target[sa]: `/var/www/html/mrtg/core/system sa`

Title[sa]: SpamAssassin Email Scans

PageTop[sa]: <h3>SpamAssassin Email Scans</h3>

YLegend[sa]: SpamAssassin Email Scans

ShortLegend[sa]:    

LegendI[sa]:

LegendO[sa]: SpamAssassin Email Scans  

system:
Code:
if [ "$TYPE" = "mail" ]; then
    INDATA=`cat /var/log/exim/mainlog | grep Completed | wc -l`
    OUTDATA=$INDATA
fi

if [ "$TYPE" = "sa" ]; then
    INDATA=`cat /var/log/mail.log | grep "spamd: connection" | wc -l`
    OUTDATA=$INDATA
fi

These stats give the amount of email that is delivered to the local mailboxes, and the amount of email that is scanned by spamassassin (don't add these stats if you don't use it!).
 
Nice work guys... I've added the changes to mine... even learnt a few commands in the process... but not getting any data appear for the extra sections.

99.9% sure I've entered them correctly.

Could it be some firewall ports i need to open in APF at all?

I'll post a link once i have this sorted :)

Cheers
Nath.
 
New stats for the exim mailqueue

system:
Code:
if [ "$TYPE" = "queue" ]; then
    INDATA=`exim -bpc`
    OUTDATA=$INDATA
fi

mrtg.cfg:
Code:
PageTop[^]: <table cellspacing="0" cellpadding="10" border="0" width="100%" align="center"><tr><td width="185" valign="top" class="small"><table cellspacing="0" cellpadding="5" border="0" width="100%"><tr><td class="tableh">Network</td></tr><tr><td class="tablesh"><a href="index.html">- Traffic</a><br><a href="tcp.html">- Open Connections</a></td></tr><tr><td> </td></tr><tr><td class="tableh">System Stats</td></tr><tr><td class="tablesh"><a href="load.html">- Load Averages</a><br><a href="swap.html">- Swap Memory</a><br><a href="processes.html">- Processes</a><br><a href="uptime.html">- Uptime and Idle Time</a><br><a href="cpu.html">- CPU</a><br><a href="memory.html">- Memory Usage</a><br><a href="pop3.html">- Email POP3 Logins</a><br><a href="imap.html">- Email IMAP Logins</a><br><a href="mail.html">- Email Delivered</a><br><a href="queue.html">- Email Queued</a><br><a href="spam.html">- Email Spam Blocked</a><br><a href="sa.html">- SpamAssassin Scans</a></td></tr><tr><td> </td></tr></table></td><td>

mrtg.cfg:
Code:
#----------------------------
# Email Queue
#----------------------------
Target[queue]: `/var/www/html/mrtg/core/system queue`

Title[queue]: Email Queued

PageTop[queue]: <h3>Email Queued</h3>

YLegend[queue]: Email Queued

ShortLegend[queue]:    

LegendI[queue]:

LegendO[queue]: Email Queued  
 
Back
Top