
|
View Full Version : mrtg & graph output
DuncanMcLord 12-07-2001, 08:00 AM hi there,
i just managed to get mrtg working, thanks to some threads in this forum,
but now i ran into some different problem,
cause mrtg runs well, without any error, but the graphs dont show any traffic.
I allready started mrtg several times and the html and png files are updated, but without showing any trafic.
I used the script explained in another thread, where you let mrtg recieve its data from /proc/net/dev
...
any help more than welcome ;)
so long,
Duncan McLord
RutRow 12-07-2001, 09:31 AM Have you tried running the script from the command line to see if you are getting the desired output? That script will almost certainly need some modification depending on your system.
You should get 4 lines of data from the script:
Bytes received
Bytes transmitted
Uptime
Server name
DuncanMcLord 12-07-2001, 11:51 AM the script i use, to get my mrtg-stats:
#!/bin/bash
# Get transmit and receive bytes.
#
INFO='grep eth0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2'
RECEIVE='echo $INFO | cut -d" " -f1'
TRANSMIT='echo $INFO | cut -d" " -f9'
# Get uptim.
#
UPTIME='uptime | tr -s ' ' ' ' | cut -d" " -f4-'
# Final output to MRTG
#
echo $RECEIVE
echo $TRANSMIT
echo $UPTIME
echo "MY_SERVER"
inside my dev-file:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 6009182 42732 0 0 0 0 0 0 6009182 42732 0 0 0 0 0 0
eth0:271383065 1709381 0 0 0 0 0 0 53128503 273612 0 0 0 0 0 0
...when i start the script from command-line, no output appears!
thx,
Duncan McLord
RutRow 12-07-2001, 02:20 PM No output at all? No error messages?
When I wrote that script, I didn't make it very portable. I know it works for RH 7.0, 7.1, and 7.2. If you are running something else, you may need to provide explicit paths to grep, etc..
Try running the individual commands...
grep eth0 /proc/net/dev | tr -s ' ' ' ' | cut -d: -f2
uptime | tr -s ' ' ' ' | cut -d" " -f4-
Mabye try:
cat /proc/net/dev | grep eth0 | tr -s ' ' ' ' | cut -d: -f2
What OS are you using?
DuncanMcLord 12-07-2001, 04:57 PM i am using RH 7.2 ... so it should work, right?
...maybe there is a different problem?
so long,
Duncan McLord
PS: ...will try the above right now..
DuncanMcLord 12-07-2001, 05:43 PM k, finally made it,
i mean, i made the script work, so that a proper output appears (if i run JUST the script!)
i can also see, that the numbers change, so the script should be ok, but
...but when i start mrtg, i get an error "unknown option: logging"
and again, the diagrams are empty...
k, i also managed the logging-error, but now i compared the .log and .old files and they both allways contain the same info:
one long number followed by several "0"s
so, it seems, that mrtg doesnt receive any traffic at all... what might be my problem?
thx so far,
Duncan McLord
RutRow 12-07-2001, 06:39 PM Post your config file so we can see it.
DuncanMcLord 12-07-2001, 07:17 PM k, heres the config file:
# Created by
# /usr/bin/cfgmaker --global 'WorkDir: /home/mrtg/httpd' --output /home/mrtg/conf/mrtg.cfg public@ns1.voxtreme.com
WorkDir: /home/mrtg/httpd
Target[mrtg]: '/home/mrtg/getstats.sh'
MaxBytes[mrtg]: 96000
Title[mrtg]: Traffic Analysis for my computer
PageTop[mrtg]: <H1>Traffic Analysis for my computer</H1>
XSize[mrtg]: 400
YSize[mrtg]: 200
Options[mrtg]: growright, bits
...hope this helps :)
so long,
Duncan McLord
RutRow 12-07-2001, 07:37 PM Ahah!
Look at your Target line.
Target[mrtg]: '/home/mrtg/getstats.sh'
It should be
Target[mrtg]: `/home/mrtg/getstats.sh`
See the difference?
Note the type of single quotes used.
DuncanMcLord 12-07-2001, 09:13 PM DOH!
sry, didnt know that...
well, but still no output...
might it be due to the fact, that i record any traffic made by "user"?
or does "user" include everyone on server?
so long,
Duncan McLord
RutRow 12-07-2001, 09:35 PM I am not sure what you mean by "user". If you are pulling bytes in/out from /proc/net/dev, that has nothing to do with ANY user. That is traffic on the device itself.
When you say there is still no output, are you waiting until MTRG runs for at least 15 min, at 5 min intervals?
DuncanMcLord 12-09-2001, 06:47 AM ...well, so far i allways started mrtg 5-10x in a row... now i started it the way u said...
and ...
IT WORKS!
thx a lot, wouldnt have made it myself :)
so long,
Duncan McHappy
RutRow 12-09-2001, 09:56 AM How are you running mrtg? You should add it to your crontab, like
*/5 * * * * /usr/local/mrtg/bin/mrtg /home/mrtg/mrtg.conf
Be sure to modify the above paths.
DuncanMcLord 12-09-2001, 07:20 PM yup,
thx... allready did so and it runs perfect :)
...now i have to figure a way, to keep track of the bandwidth of every single IP on my server... but thats a different story ;)
thx a lot,
so long,
Duncan McLord
|