PDA

View Full Version : HOWTO: Compile, configure and run MRTG


ProWebUK
09-26-2003, 04:42 PM
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/webtools/mrtg/pub/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 :p

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

l0rdphi1
09-26-2003, 06:49 PM
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 /usr/local/mrtg-2/bin/mrtg /home/.............../mrtg.cfg

l0rdphi1
09-26-2003, 06:59 PM
Ok, typing LANG="en_US" on the command line fixed that error. :)

Now I get:ERROR: "WorkDir" not specified in mrtg config file :D

l0rdphi1
09-26-2003, 07:11 PM
I chmodded 0755 mrtg.sh and prepended 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 :)

ProWebUK
09-27-2003, 04:51 AM
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

thoroughfare
09-27-2003, 04:31 PM
What is MRTG?

Cheers,
Matt :)

l0rdphi1
09-27-2003, 10:25 PM
Does graphs based on imputted data.

Check out www.liquenox.net/mrtg

thoroughfare
09-28-2003, 03:42 AM
Ahhhh, handy :D

Thanks!
Matt

joker
10-06-2003, 03:58 PM
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 :)

ProWebUK
10-06-2003, 04:02 PM
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

joker
10-06-2003, 04:03 PM
ok - ill give it a try :)

interfasys
11-12-2003, 08:37 PM
Did anybody succesfully create a full graph config for DA?

ProWebUK
11-12-2003, 08:39 PM
full graph config?

interfasys
11-12-2003, 09:43 PM
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

The Prohacker
11-12-2003, 10:35 PM
Originally posted by interfasys
Did anybody succesfully create a full graph config for DA?



http://download.cheetaweb.com/mrtg-2.9.17-1cpanel.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 :)

interfasys
11-12-2003, 10:59 PM
Since I already have mrtg installed, I guess I'll be better off finding a .cfg from the web, no?

The Prohacker
11-12-2003, 11:46 PM
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...

interfasys
11-13-2003, 12:03 AM
.cfg and .sh of course =)

I installed from source, so I guess rpm -e would not work...

interfasys
11-18-2003, 03:34 AM
*/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
?

ProWebUK
11-18-2003, 07:36 AM
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?

interfasys
11-18-2003, 01:58 PM
Yes, you may :)

I followed your instructions:
# pico -w /etc/crontab

The Prohacker
11-18-2003, 11:34 PM
Originally posted by interfasys
Yes, you may :)

I followed your instructions:
# pico -w /etc/crontab


Best bet would be to remove the line from /etc/crontab

And add it via:

crontab -e

interfasys
11-18-2003, 11:58 PM
I guess I should not have a MAILTO entry in that user crontab, right? Otherwise I'll get emails every five minutes.

DirectAdmin Support
11-19-2003, 09:55 AM
I find it usefull to pipe all output to /dev/null so nothing is outputted, an no emails are sent:

/some/cron/command 1> /dev/null 2> /dev/null

This will send all data on stdout (1) and stderr (2) to a blackhole. Or you could just disable sending emails completely :)

John

interfasys
11-19-2003, 10:43 AM
Aaah! Nice! That way I can choose which cron jobs sends me emails.

interfasys
12-22-2003, 12:21 AM
# cd /home/groovy

# wget http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/mrtg.tar.gz

# tar -zxvf mrtg.tar.gz

# cd mrtg*

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

# make

# make install

----------------

# cd /var/www/html/mrtg

# wget http://www.l0rdphi1.com/junk/mrtg.tgz

# tar -zxvf mrtg.tgz

# chmod 755 system

# /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/mrtg.cfg


This will give you the graphs of the rpm version, but with the latest MRTG.

The major change from the original howto is the added configuration switch.

ProWebUK
12-22-2003, 07:30 AM
Originally posted by interfasys
# cd /var/www/html/mrtg

# wget http://www.l0rdphi1.com/junk/mrtg.tgz

# tar -zxvf mrtg.tgz

# chmod 755 system

# /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/mrtg.cfg


This will give you the graphs of the rpm version, but with the latest MRTG.

The major change from the original howto is the added configuration switch.

that way you have your cfg open to all users, probably not the worst thing you could do but do you really want your cfg publically accessable?

i always have my cfg in the mrtg directory and set the WorkDir value to /var/www/html/mrtg :)

will update the main thread also

Chris

interfasys
12-22-2003, 09:33 AM
You're right, it might be a better idea to keep the cfg file elsewhere ;) but I don't really care if someone wants to get my cfg file, unless this represents a security risk.

FarCry
12-22-2003, 04:30 PM
i find i pretty much always have to add 1> /dev/null 2> /dev/null to a crontab or i have at least 1000 emails every time i check the mail email account :D

ProWebUK
12-22-2003, 04:52 PM
set your cron email address to an address that is set to forward all mail into the blackhole :)

Chris

XenoHosting
01-01-2004, 09:20 PM
Originally posted by l0rdphi1
Ok, typing LANG="en_US" on the command line fixed that error. :)

Now I get: :D



Where do i put LANG="en_US" at im lost

ProWebUK
01-02-2004, 04:12 AM
Originally posted by XenoHosting
Where do i put LANG="en_US" at im lost

# pico -w /etc/sysconfig/i18n

You need to modify the 'LANG' line there the show the above suggestion.

Chris

XenoHosting
01-03-2004, 12:10 AM
Originally posted by ProWebUK
# pico -w /etc/sysconfig/i18n

You need to modify the 'LANG' line there the show the above suggestion.

Chris

LANG="en_US"
SUPPORTED="en_US:en_US:en"
SYSFONT="latarcyrheb-sun16"

like that ?

ProWebUK
01-03-2004, 12:17 AM
You only need the 1 en_US in supported, apart from that it looks fine :)

SUPPORTED="en_US:en"

Chris

XenoHosting
01-03-2004, 12:25 AM
Originally posted by ProWebUK
You only need the 1 en_US in supported, apart from that it looks fine :)

SUPPORTED="en_US:en"

Chris
chris i still get the same error


UW PICO(tm) 4.2 File: /etc/sysconfig/i18n

LANG="en_US"
SUPPORTED="en_US"
SYSFONT="latarcyrheb-sun16"

ProWebUK
01-03-2004, 12:32 AM
Could you paste the exact error your getting when starting mrtg...

Chris

XenoHosting
01-03-2004, 12:36 AM
Originally posted by ProWebUK
Could you paste the exact error your getting when starting mrtg...

Chris

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 ...
-----------------------------------------------------------------------

ProWebUK
01-03-2004, 12:47 AM
Adding LANG=C to /etc/sysconfig/i18n may work..

Ive done a search on the mailing list and that seems to be the only fix.

Chris

l0rdphi1
01-03-2004, 01:15 AM
can't you type (in shell):export LANG=C then simply re-run whatever command you tried? I think that's what I did.

XenoHosting
01-03-2004, 01:32 AM
Originally posted by l0rdphi1
can't you type (in shell):export LANG=C then simply re-run whatever command you tried? I think that's what I did.

thank you i got it werking but i get theses error now


root@web1 mrtg]# /usr/local/mrtg-2/bin/mrtg /home/xenosite/domains/xeno-hosting.net/public_html/mrtg/mrtg.cfg
ERROR: Target[index][_IN_] ''/home/xenosite/domains/xeno-hosting.net/public_html/mrtg`' (kill): Can't find string terminator "'" anywhere before EOF at (eval 6) line 1.
ERROR: Target[index][_OUT_] ''/home/xenosite/domains/xeno-hosting.net/public_html/mrtg`' (kill): Can't find string terminator "'" anywhere before EOF at (eval 7) line 1.
Use of uninitialized value in numeric lt (<) at /usr/local/mrtg-2/bin/mrtg line 371.
Use of uninitialized value in numeric lt (<) at /usr/local/mrtg-2/bin/mrtg line 375.

ProWebUK
01-03-2004, 01:35 AM
Are you using a modified cfg... it certainly appears you havnt followed the howto guide exactly either way...

Chris

XenoHosting
01-03-2004, 01:39 AM
Originally posted by ProWebUK
Are you using a modified cfg... it certainly appears you havnt followed the howto guide exactly either way...

Chris



i followed the howto guide exactly

ProWebUK
01-03-2004, 01:47 AM
Ok my mistake :D

Could you paste your exact current mrtg.cfg.

Thanks,
Chris (who needs to get some sleep! :p)

l0rdphi1
01-03-2004, 01:50 AM
Feel free to use my .cfg too, if ya want. Should work.

http://www.l0rdphi1.com/junk/mrtg.tgz

l0rdphi1
01-03-2004, 01:54 AM
Forgot - if you do use my cfg, make sure you put the system file in that tarball in /var/www/html/mrtg/ and chmod it runable. (And of course, you can put it anywhere you want, but you'll have modify the cfg.)

Good luck :)

Icheb
01-03-2004, 03:43 PM
I've been using MRTG for ages, figured out most of the configs myself, but i now have a bit of a problem which i am unable to solve.
I've taken a look at the howto, and the sh scripts, but the methods described here are methods i already tried. I need to see the traffic per IP instead of per networkcard (NIC).
Is this possible with MRTG ?
And if so, can anyone give me a cfg for that ?

To illustrate what i mean, here's a part of my ifconfig :
eth0 Link encap:Ethernet HWaddr 00:20:55:14:AF:73
inet addr:<ip1>
RX bytes:821403724 (783.3 Mb) TX bytes:1564562115 (1492.0 Mb)
eth0:0 Link encap:Ethernet HWaddr 00:20:55:14:AF:73
inet addr:<ip2>
eth0:1 Link encap:Ethernet HWaddr 00:20:55:14:AF:73
inet addr:<ip3>

I need to find out the exact traffic for <ip3>...

XenoHosting
01-07-2004, 09:27 AM
Thank you ProWebUK & interfasys This Is Sweet

Sorry Had to Leave town Saturday Night




http://www.xeno-hosting.net/mrtg/

uk_joker2003
01-09-2004, 02:00 AM
I have done everything upto this point without any problems, but i dont have a /html/mrtg folder.

in /home/my domain i have a mrtg-2.10.12
is this the correct folder? This is where i ran the install from.



// 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 :p

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 * * * * /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

ProWebUK
01-09-2004, 04:58 AM
Im going to re-write this guide in a day or two with totally new downloadbales etc etc...... regarding the html directory

just replace

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

with

cd /var/www/html
mkdir mrtg
cd mrtg


As I said... new guide coming soon to clean everything up!

(that will leave a total of 3 mrtg installations / guides.. all posted by me! :eek: )

Chris

andrewk
01-17-2004, 03:18 PM
Anybody ever get it compiled on FreeBSD 4.8 with DA?

I get:

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.

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

No matter which gd.h I specify it to use (even ones in locations without the shared .so files) I still get it...clues?

etegration
02-06-2004, 06:57 AM
I have error when i 'make install':

[root@gandalf mrtg-2.10.13]# pwd
/root/MRTG/mrtg-2.10.13
[root@gandalf mrtg-2.10.13]# make install
/bin/sh ./mkinstalldirs /usr/local/mrtg-2/bin
for x in ./bin/mrtg ./bin/cfgmaker ./bin/indexmaker; do \
/usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
for x in bin/rateup; do \
/usr/bin/install -c -m 755 $x /usr/local/mrtg-2/bin; done
/usr/bin/install: cannot stat `bin/rateup': No such file or directory
make: *** [install] Error 1

cannot stat ? what's that?

YouCMe
02-25-2004, 08:23 PM
I've running mrtg but does somebody know how to make graphs for each ip adress on your server?

Icheb
02-26-2004, 01:25 AM
Originally posted by YouCMe
I've running mrtg but does somebody know how to make graphs for each ip adress on your server?

Good luck, I've been trying this for ages...
You could use a iptables counter, but so far I don't have an idea how to start one up, furthermore, in (i thought it was) Debian there is a program to count this, but it's not compatible with redhat (as i can't find the source code).
What you could try is: Install IPFM and configure it so it outputs the traffic for the IP's you want, parse these configs with a program that can output 4 values (look at MRTG howto's for which values exactly) and use that.
I tried this, but on my test server it didn't work, since it's kinda counting the wrong things...

YouCMe
02-26-2004, 02:27 AM
Hmm on the server of a friend of me a other hosting company installed his MRTG and he has it for each IP!
I have his .pl files and his configuration file for MRTG to make the graphs, the only thing i miss is his IP Table.
I don't know anything about IP Tables but if he has it running.. is there some way to *see* his IP tables so i can get the code for counting the traffic?
Then i only have to get the ip table rules on my own server =)

Icheb
02-26-2004, 02:55 AM
Can you perhaps post these cfg's, configs and perl script ?

If there are any iptables persent, you can view them by :
iptables --list
while logged in as root...

YouCMe
02-26-2004, 03:26 AM
Offcourse i can post them :)

*Files* (http://www.youcme.nl/mrtg.zip)

Icheb
02-26-2004, 03:36 AM
DOn't have very much time at the moment, but i'd say you would need to adept iptraffic-rules to match your own ip's
and :
$basedir= "/home/httpd/vhosts/kene.nl/httpdocs/mrtg/"; # This directory where mrtg saves its .log and .html files
$snapshots="/home/httpd/vhosts/kene.nl/httpdocs/mrtg/snapshots"; # Where 95.pl will save a daily copy of the .log files

in the .pl.


Target[81.173.116.153]: `/home/boot/iptraffic --ip=81.173.116.153`
Target[81.173.116.154]: `/home/boot/iptraffic --ip=81.173.116.154`
Target[81.173.116.155]: `/home/boot/iptraffic --ip=81.173.116.155`
In the .cfg file will also need to be adapted to match your config...


I'll try them at a testserver tonight.

YouCMe
02-26-2004, 05:25 AM
hmm those files i had allready changed for my own system
but when i run the command that mrtg calls i get a iptable message

i'll show you:

[root@hercules mrtg]# /home/boot/iptraffic --ip=81.173.116.157
iptables: Table does not exist (do you need to insmod?)
Use of uninitialized value in concatenation (.) or string at /home/boot/iptraffic line 51.
Use of uninitialized value in concatenation (.) or string at /home/boot/iptraffic line 51.


a very long time :)
81.173.116.157


that's the output when i run it, so i think it's something with the ip tables that doesn exist.
but the guy is online who has it working i'll let him do the iptables command to see if he has any iptable rules for it :)

YouCMe
02-26-2004, 05:30 AM
My ip table --list output:
[root@hercules mrtg]# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


His ip table --list output:

[root@cleopatra root]# iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
iptraffic all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
iptraffic all -- anywhere anywhere

Chain iptraffic (2 references)
target prot opt source destination
all -- 81.173.116.110 !81.173.116.110
all -- !81.173.116.110 81.173.116.110
all -- 81.173.116.109 !81.173.116.109
all -- !81.173.116.109 81.173.116.109
all -- 81.173.116.108 !81.173.116.108
all -- !81.173.116.108 81.173.116.108
all -- 81.173.116.107 !81.173.116.107
all -- !81.173.116.107 81.173.116.107
all -- 81.173.116.106 !81.173.116.106
all -- !81.173.116.106 81.173.116.106
all -- 81.173.116.105 !81.173.116.105
all -- !81.173.116.105 81.173.116.105
all -- 81.173.116.104 !81.173.116.104
all -- !81.173.116.104 81.173.116.104
all -- 81.173.116.103 !81.173.116.103
all -- !81.173.116.103 81.173.116.103
all -- 81.173.116.102 !81.173.116.102
all -- !81.173.116.102 81.173.116.102
all -- kene.nl !kene.nl
all -- !kene.nl kene.nl

so i really mis the tables :rolleyes:

YouCMe
02-26-2004, 05:43 AM
he has nothing in his /etc/sysconfig/iptables file :(
and the init.d/iptables points to that so i don't know where his iptables are stored :(

Icheb
02-27-2004, 03:40 AM
I got it running nicely here, thank you for those files :)

Let's see, now you ofcourse would like to know how i did it.
Quity easy; You have to edit the iptraffic-rules file.
Then you must chmod +x it and run it as root.
There you have your iptables entry's :)

Note: Don't forget to edit the mrtg config files :D

YouCMe
02-27-2004, 04:23 PM
JAAAAAAAAAAAAAAAAY!! IT WORKS!! FINALY! :D
and so easy..! i only forgot to chmod :) many thanks! have fun with it because it's very handy! :D

GreetZ & Thanks,
YouCMe

sander815
03-17-2004, 07:53 AM
i am getting this at 1st command:

[root@server1 mrtg-2.10.13]# ./configure --with-gd=/usr/local/lib
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

is there no compiler installed or so?

ProWebUK
03-17-2004, 07:59 AM
rpm -qa | grep gcc

Do you have gcc listed there..?

If you do, try a configure without the --with-gd=/usr/local/lib

Chris

sander815
03-17-2004, 08:01 AM
[root@server1 tmp]# rpm -qa | grep gcc
libgcc-3.2.2-5
[root@server1 tmp]#

ProWebUK
03-17-2004, 08:06 AM
Originally posted by sander815
[root@server1 tmp]# rpm -qa | grep gcc
libgcc-3.2.2-5

If you have a default redhat install it should be listed in the rpms list.. therefore it appears you do not have it, if you are on a desktop you can use the redhat tool and get it from your disks also.

edit: try gcc -v just to confirm its not there..

grab and install the gcc package, all information you need is at: http://gcc.gnu.org/install/

(or you could grab the rpms http://rpmfind.net/linux/rpm2html/search.php?query=gcc)

Chris

sander815
03-17-2004, 09:45 AM
k, i reinstalled them, now i get this:
checking for gd.h...no

gd lib is installed: gd-1.8.4-11

ProWebUK
03-17-2004, 10:04 AM
locate gd.h

Chris

sander815
03-18-2004, 02:25 AM
seem slike there is more gd stuff missing:
i get this when i do ./configure

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... no
checking gd.h presence... no
checking for gd.h... no
checking for gd.h... no

** 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.



[root@server1 mrtg-2.10.13]# rpm -qa | grep gd
gd-1.8.4-11

so it is there
do i have to recomiple it? or reinstall teh rpm?

ProWebUK
03-18-2004, 08:39 AM
run the command:

locate gd.h

There should be one in the DA templates and one actually being used there somewhere, you could try recompiling apache and make sure you select the rebuild gd option...

Chris

sander815
03-18-2004, 08:45 AM
some libs were missing, got it installed now..

now i get this:
/usr/local/mrtg-2/bin/mrtg /mypath/to/mrtg/mrtg.cfg
-----------------------------------------------------------------------
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 ...
-----------------------------------------------------------------------

ProWebUK
03-18-2004, 09:09 AM
export LANG=C

Chris

thoroughfare
04-04-2004, 10:49 AM
Run:

# env LANG=C /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/mrtg.cfg

Originally posted by sander815
some libs were missing, got it installed now..

now i get this:
/usr/local/mrtg-2/bin/mrtg /mypath/to/mrtg/mrtg.cfg
-----------------------------------------------------------------------
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 ...
-----------------------------------------------------------------------

thoroughfare
04-04-2004, 10:50 AM
Hey guys,

Nearly done installing MRTG... it shows up in my browser etc, but when I run it from the command line, I get:

WARNING: Problem with External get '/var/www/html/mrtg/mrtg.sh':
Expected a Number for 'in' but got ''

WARNING: Problem with Externale get '/var/www/html/mrtg/mrtg.sh':
Expected a Number for 'out' but got ''

ERROR: Target[index][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
ERROR: Target[index][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data


How to fix?

Thanks,
Matt :)

ProWebUK
04-04-2004, 11:26 AM
contents of mrtg.sh?

Chris

thoroughfare
04-04-2004, 11:59 AM
Ah sorry ignore that, I'd missed off the 'I' from 'INFO' in the mrtg.sh file ;)

Thanks!
Matt :D

thoroughfare
04-04-2004, 12:37 PM
Hi,

The perl files for doing per-IP MRTG are no longer on that site... can someone do a quick how-to and post the files so I can set this up?

Much appreciated,
Matt :)

trexif
04-07-2004, 02:41 PM
Thankx, it's great :)

But now I want that MRTG show the traffic of all the switch ports.
How do I do that?
Does somebody know it?:D

neorder
04-08-2004, 09:09 PM
i also got my mrtg work now, but i recieved some warning msg at command line:


[root@apple mrtg]# LANG="en_US"
[root@apple mrtg]# /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/mrtg.cfg
Rateup WARNING: /usr/local/mrtg-2/bin/rateup could not read the primary log file
for index
Rateup WARNING: /usr/local/mrtg-2/bin/rateup The backup log file for index was i
nvalid as well
Rateup WARNING: /usr/local/mrtg-2/bin/rateup Can't remove index.old updating log
file
Rateup WARNING: /usr/local/mrtg-2/bin/rateup Can't rename index.log to index.old
updating log file
[root@apple mrtg]# cd /var/www/html
[root@apple html]# ls

what's wrong?

Icheb
04-10-2004, 01:04 AM
That's normal first (two) runs, after that all files do exist etc...

edit: if it keeps this way, your chownes or chmods for that directory may be wrong...

sander815
05-14-2004, 12:31 AM
any1 got some nice configs?

ProWebUK
05-14-2004, 08:09 AM
Originally posted by sander815
any1 got some nice configs?

Most configs are nice if they are what you want...

What are you trying to get a graph of and possibly someone/myself could create it... or may even have it.. :)

Chris

sander815
05-15-2004, 08:19 AM
i only have the default, and like some others, that i might be able to edit myselkf to my needs, but a few good examples would be nice

deltaned
05-20-2004, 10:39 PM
What do I add where to get the trafic on ALL switch ports?
Now it is counting of 1 domain, but I wich to view the traffic of all the servers on my switch ports
- overview of every switchport

sander815
05-24-2004, 02:35 AM
odd, mrtg used to work ok, and now all of a sudden i get this:

ERROR: Line 3 (INFO=`grep eth0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2`) in CFG file (/home/httpd/....../httpdocs/mrtg/mrtg.sh) does not make sense

what does it mean? nothings really changed

neorder
06-03-2004, 03:45 PM
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)

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
?

is this resolved? my cron job also don't work at all.

shoud we add root or not?

edit: it worked after adding root.

Plz update this how to and add "root" in that crontab.

ret
06-25-2004, 08:17 AM
i installed mrtg, but the results are by far not ok:

Max In: 7766.0 B/s (0.0%) Average In: 3059.0 B/s (0.0%) Current In: 2864.0 B/s (0.0%)
Max Out: 33.6 kB/s (0.1%) Average Out: 15.2 kB/s (0.1%) Current Out: 15.3 kB/s (0.1%)

that should be like this
Max In: 333.2 kb/s (0.3%) Average In: 108.1 kb/s (0.1%) Current In: 97.5 kb/s (0.1%)
Max Out: 138.7 kb/s (0.1%) Average Out: 61.1 kb/s (0.1%) Current Out: 53.0 kb/s (0.1%)


whats wrong? i used the standard cfg posted here

ret
06-25-2004, 08:32 AM
Originally posted by deltaned
What do I add where to get the trafic on ALL switch ports?
Now it is counting of 1 domain, but I wich to view the traffic of all the servers on my switch ports
- overview of every switchport

what do you mean? i think its not measuring 1 domain, but total traffic over eth0, or you must have 1 site

ret
06-25-2004, 11:43 AM
Originally posted by ret
i installed mrtg, but the results are by far not ok:

Max In: 7766.0 B/s (0.0%) Average In: 3059.0 B/s (0.0%) Current In: 2864.0 B/s (0.0%)
Max Out: 33.6 kB/s (0.1%) Average Out: 15.2 kB/s (0.1%) Current Out: 15.3 kB/s (0.1%)

that should be like this
Max In: 333.2 kb/s (0.3%) Average In: 108.1 kb/s (0.1%) Current In: 97.5 kb/s (0.1%)
Max Out: 138.7 kb/s (0.1%) Average Out: 61.1 kb/s (0.1%) Current Out: 53.0 kb/s (0.1%)


whats wrong? i used the standard cfg posted here

woops, the difference between bits and bytes :)

how can i chage my cfg to display bits per second?

ret
06-26-2004, 03:45 AM
is it also possible to plot the total data traffic in mb/gb per month?
see image
http://traffic.pcextreme.nl/gb.php?host=total&month=6&year=2004

FarCry
07-01-2004, 02:26 AM
Well, i just got this all setup:
www.clandns.com

The domain is just for name servers really but i figured i could put mrtg on there :D

jmstacey
07-30-2004, 11:24 PM
Anyone tried converting the nice mrtg.cfg for FreeBSD commands?

dannygoh
09-07-2004, 10:29 AM
can i limit my "traffic analysis for eth0" graph? i want to limit to 200Kb!

my average traffic is 100Kb but due to my offline back, every midnight my traffic is hitting to 1000Kb.

my graph is not very nice due to i barely can see my traffic because of my nightly backup that hit so high traffic.

Turbo M
09-09-2004, 08:05 PM
i had an error right at the beginning when I typed this.

tar -zxvh mrtg.tar.gz


I got

tar (child): /dev/sa0: Cannot open: Device not configured
tar (child): Error is not recoverable: exiting now

gzip: stdin: unexpected end of file
tar: Child returned status 2
tar: mrtg.tar.gz: Not found in archive
tar: Error exit delayed from previous errors

what is the problem?

jlasman
09-10-2004, 08:23 PM
I'm not sure what the "h" stands for, but the letter immediately before the file name needs to be an "f".

Jeff

Turbo M
09-10-2004, 08:24 PM
Thank you I figured that out a little while ago but ran into more problems.


** 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

jmstacey
09-10-2004, 09:08 PM
I ran into a similar problem.

First run through step b and make sure thats good to go then when your run the configure command again you basically have to tell it where everything is. For example you might have to use

./configue -with-gd=DIR -with-gd-inc=DIR

Right before it compiles, while its checking for these should give you an idea of which one its messing up on.

Tip: If I recall correctly, the include directory is not where you'd think it would be. just search for the gd include file and use that directory instead.

intelliot
09-12-2004, 12:26 AM
Nothing happens after I type

tar -zxvh mrtg.tar.gz

and press Enter. It just goes to the next line. (I'm no Linux/SSH expert so I apologize if this is a dumb question.)

Pressing more keys does make the characters appear, and I have to press CTRL+C to get back to the command prompt.

Any ideas?

jmstacey
09-12-2004, 03:25 AM
Use

tar -zxf mrtg.tar.gz

intelliot
09-12-2004, 11:19 PM
Looking good:

http://www.sizzly.com/mrtg/

Thanks ProWebUK and jmstacey:)

intelliot
09-14-2004, 07:51 PM
How do I configure this to also graph my load average at various times of the day?

Currently it is doing only:
Incoming Traffic in Bytes per Second
Outgoing Traffic in Bytes per Second

lnguyen
10-28-2004, 11:14 AM
I've done this before w/o problems, but that was on redhat. I'm using CentOS now, and I get this when i try to run mrtg w/ the mrtg.sh file.

I get:
ERROR: Line 3 (INFO=`grep eth0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2`) in CFG file (/mydirectoy/mrtg.sh) does not make sense


Any ideas?

jlasman
10-28-2004, 06:20 PM
post the output of

proc/net/dev

and I'll compare it with /proc/net/dev output from a working RHL 9 distribution and we'll figure out the differences.

Jeff

lnguyen
10-28-2004, 08:24 PM
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 13205 148 0 0 0 0 0 0 13205 148 0 0 0 0 0 0
eth0:23271904 479545 0 0 0 0 0 0 1033672704 703351 0 0 0 226 0 0




What's what it looks like

Thafusion
11-15-2004, 01:12 PM
If you look @ my stats then the are a bit strange.

http://zeus.hosting4life.nl/mrtg/

like Swap Memory, Uptime , ect the are not correct :( the output a complete different stats.

http://zeus.hosting4life.nl/phpsysinfo/

Schaap
11-16-2004, 12:26 PM
No errors, no nothing, but no MRTG either!

http://everexhosting.com/mrtg/
(No index.html .. )

Have I missed something? :)

xgeek
12-11-2004, 09:46 AM
Hi Guys,

I have a fresh install of Fedora 2 and yesterdays update of DA. The only other apps I have installed are afp, bfd, mod_dosevasive and webmin.

Okay so far so good :)

I used the method below to install mrtg and it installed okay. But some of the stats are wrong :confused:
The config & system file I am using is from this archive that is in the tutorial below:- http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/mrtg.tar.gz

Here is a link to my mrtg on my server:-
http://sirius.xplic8.com/mrtg/

As an example:-
In the system file there is this block of code:-
if [ "$TYPE" = "swap" ]; then
INDATA=`cat /proc/meminfo | grep "Swap:" | sed 's/ * / /g' | cut -d ' ' -f2`
OUTDATA=`cat /proc/meminfo | grep "Swap:" | sed 's/ * / /g' | cut -d ' ' -f3`
fi
Now I am a noob but I think this is piping the output of cat /proc/meminfo where it finds the word Swap:. But if I type cat /proc/meminfo at the command line I get this:-
MemTotal: 1033928 kB
MemFree: 24420 kB
Buffers: 55640 kB
Cached: 765996 kB
SwapCached: 11144 kB
Active: 470176 kB
Inactive: 481332 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 1033928 kB
LowFree: 24420 kB
SwapTotal: 2048276 kB
SwapFree: 2021236 kB
Dirty: 196 kB
Writeback: 0 kB
Mapped: 142748 kB
Slab: 46216 kB
Committed_AS: 379580 kB
PageTables: 4432 kB
VmallocTotal: 3088376 kB
VmallocUsed: 4388 kB
VmallocChunk: 3082432 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 2048 kB


But there is not a line that starts with Swap:?

I also have this problem with the memory part and cpu use.
Are there any updated files that will provide stats like this tutorial but on a Fedora 2 system?

Many thanks for any help.

Regards
Stephen



Originally posted by interfasys
# cd /home/groovy

# wget http://people.ee.ethz.ch/~oetiker/webtools/mrtg/pub/mrtg.tar.gz

# tar -zxvf mrtg.tar.gz

# cd mrtg*

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

# make

# make install

----------------

# cd /var/www/html/mrtg

# wget http://www.l0rdphi1.com/junk/mrtg.tgz

# tar -zxvf mrtg.tgz

# chmod 755 system

# /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/mrtg.cfg


This will give you the graphs of the rpm version, but with the latest MRTG.

The major change from the original howto is the added configuration switch. :confused:

snaaps
02-05-2005, 07:20 AM
how do I delete mrtg 2.1.11 from my server?
I want to install a new version, but first I most delete the old one.

I have mrtg installed by help on this forum.

noose
04-14-2005, 03:18 AM
mysql mrtg stats :) http://www.elektrondata.se/~hj/mysqlmrtg.html

l0rdphi1 can you add that one to Your package? it's very usesful :]

PeterB
04-16-2005, 07:31 AM
Originally posted by noose
mysql mrtg stats :) http://www.elektrondata.se/~hj/mysqlmrtg.html

l0rdphi1 can you add that one to Your package? it's very usesful :]

I don't think that one works correctly, I've got a busy MySQL-based website, and it only shows 1 query/sec.

Thanks all, it's working great on my server! :cool:

noose
04-16-2005, 10:29 AM
in my server it's working great :]

Max Questions: 100.0 q/s Average Questions: 62.0 q/s Current Questions: 91.0 q/s
Max Cache hits: 100.0 q/s Average Cache hits: 50.0 q/s Current Cache hits: 60.0 q/s
:)

koliber2
08-18-2005, 07:11 AM
hi, how can i update mrtg? I just add a new stick of 5412 MR ram, but when mrtg refreshing i still see 512 mb ram, not 1Gb help

jlasman
08-19-2005, 07:16 PM
That's either a lot of RAM or a typo :) .

Have you checked your RAM from the command line?

Run:

cat /proc/meminfo

Perhaps your system isn't recognizing the RAM.

If it is, then have you tried restarting MRTG?

Jeff

Icheb
08-20-2005, 07:42 AM
The current script maintainer has kinda not been here for about a month.
I've got a few new configs lined up for new versions (already pm'ed him about it more than a month ago or something).
If/when I get time, I'll set up a new howto with updated stuff on my wiki, if anyone is interested.

That MySQL monitor looks nice ;).
Furthermore I have scripts lined up for:
1. Exiscan
2. SpamBlocker
3. CPU temp (mbmon & sensors :))
4. Apache usage in hits/hour

However I need time to script an installation interface for it, as the sysadmin now has to do a few things and choose a few things.

If you guys are interested, I can try to make a script for it, but I can't say when it's done, got a lot to do here...

intelliot
08-20-2005, 04:31 PM
Do you mean a new version of mrtg? I'm interested.

Icheb
08-21-2005, 08:18 AM
Originally posted by intelliot
Do you mean a new version of mrtg? I'm interested.

Posted in the wrong thread, however, I meant an automated installer in the style of this thread:
http://www.directadmin.com/forum/showthread.php?threadid=7843

So not a new MRTG version, but a new set of config files :)