OpenWrt Forum Archive

Topic: Graph network traffic

The content of this topic has been archived between 30 Apr 2018 and 2 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi va1210,

no, I think you did it correct. When I look at the installed packages I see:

haserl - 0.8.0-1 - a CGI wrapper to embed shell scripts in HTML documents
svggraph-webif - 0.3 -
webif - 0.01-1 - A modular, extensible web interface for OpenWrt.
webif-patch - 0.01 -

Did you changed the /etc/httpd.conf file and restarted httpd?

I'm trying this myself. I can get data.sh to spit text out

I'm using the latest version of firefox. I'm given a download file prompt everytime i try to view the graphs and IE doesn't do anything...

What am i doing wrong

My httpd.conf looks as follows

/cgi-bin/webif:root:*****
.svg:image/svg+xml

I also booted my router, but that didn't seem to help.

I'm a bit unclear on how the time series for the graph is stored. Should a cron job be running that writes data to a file at certain time intervalls, or? As far as I can tell there is no cron job/daemon running that does something like this..

Hi va1210,

I think you have to wait for an answer from arantius.

*falls asleep*

my CPU load is always at 100% even when there is no traffic

CPU load is just that, activity on the processor.  Independent of traffic.  Perhaps something is using all your cpu?  If you SSH in, what does top say about CPU usage?  What does uptime say?

(In truth, my CPU always hovers around 15-20%, which doesn't seem right to me either, but not 100!)

va1210:

Does the CPU graph work?  Please PM me this might get more detailed smile

Whoops, didn't see page 2! 

I'm given a download file prompt everytime i try to view the graphs

Yes, you'll have to re-start httpd to get it to deliver the right mime type to firefox.  Just reboot the box if you don't know how.

I'm a bit unclear on how the time series for the graph is stored.

It's all client side.  The stuff data.sh spits out are the current values, the client accepts and processes those for difference from the last value.

This means that a) no server resources are used unless you're watching it but b) no historical data, only current (and the past 120 seconds, stored client side).

arantius wrote:

Does the CPU graph work?  Please PM me this might get more detailed smile

No, they all say the same thing. Anything in particular I can do to help debug this problem?

First off, thanks for creating this (whomever you are). I was looking for this exact same thing.

Anyway, onto my problem wink

konqueror shows the graph dimensions just fine, but no output (i honestly don't know about svg & konqueror off the top of my head... but i'll research). And with firefox, all the other graphs work fine... EXCEPT for cpu, which has the problem of wanting to download the svg file. (yes i did update httpd.conf). And when calling data.sh?=cpu all i get is:

Sun Feb 12 19:39:48 PST 2006

I thougth i would post that in hopes that it might help someone with this.

OH, BTW, i am using .3 as well. wink

thanks in advance

I have rebooted or i'd wouldn't be asking smile

Still doing it

(Last edited by thetron on 13 Feb 2006, 06:56)

arantius wrote:

my CPU load is always at 100% even when there is no traffic

CPU load is just that, activity on the processor.  Independent of traffic.  Perhaps something is using all your cpu?  If you SSH in, what does top say about CPU usage?  What does uptime say?

arantius you were right: something IS using all cpu! It's the gpio used by the module "cisco-button".

Thanks for your answer

Andreas

ALuedtke wrote:

arantius you were right: something IS using all cpu! It's the gpio used by the module "cisco-button".

Hehe, just goes to show how useful this application really is smile

va1210 wrote:

I'm getting a message "Cannot get data about interface" on all graphs, any suggestions on what I might be doing wrong? Running data.sh?if=eth0 for instance gives me

Sun Feb 12 11:19:16 WET 2006
  eth0:  162847     340    0    0    0     0          0         0    47344     436    0    0    0     0       0          0

I'm running White Russian RC4 on a WRT54G v2.2..

Great package btw, really looking forward to getting this to work! I've been waiting for something like this for a really long time!

I'm using v3 and get the same data and the same result

"cannot get data about interface"

a data.sh?if=eth0 or data.sh?if=vlan0 gives me the data

Sat Jan  1 01:03:53 CET 2000
  eth0:  103630     863    0    0    0     0          0         0   268820     854    0    0    0     0       0          0

Any idea?

Then there is still one problem.
I've added the extra line in the httpd.conf file and I can see the svg now for eth0 (without data)

but if I look to the grafich of the cpu firefox still try's to download the image.

Okay, here we go, how to debug svggraph-webif:

First, your browser has to be able to do SVG images!  Here's a page with some samples, if you don't see something like the little icons when you click the links your browser probably doesn't support SVG:

http://www.croczilla.com/svg/samples/

If those do show up, then let's see if you can load these svg documents!  From here on, replace "http://openwrt/" with the correct value to be pointing at your openwrt box.

http://openwrt/svggraph/graph_cpu.svg
http://openwrt/svggraph/graph_if.svg

Neither of these will "work" now, but if you get an empty graph that says it can't load data, then your browser loads the svg images for this package properly.  If you get a download prompt, then your browser is confused or (if you use Firefox 1.5+) then your web server is misconfigured.  You'll need this line in /etc/httpd.conf (set automatically by version 0.3 and above):

.svg:image/svg+xml

These SVGs make AJAX-like calls to the openwrt box to get the data to put in the graph, located at these URLs:

http://openwrt/cgi-bin/webif/svggraph/data.sh
http://openwrt/cgi-bin/webif/svggraph/data.sh?if=br0

Where the first link above should display CPU data, like this:

Mon Feb 13 10:10:55 EST 2006
cpu  146970 0 1145264 62863984

And the second will display interface traffic.  Every different piece of hardware (and configuration) can have different interfaces, so you may have to choose an interface name that actually exists on your system:

Mon Feb 13 10:11:14 EST 2006
   br0:3602758287 8927578    0    0    0     0          0         0 1264113438 9404396    0    0    0     0       0          0

In other words, for cpu data, the script expects the date on one line, followed by the word cpu, then four separate numbers, on the next line.  For interface data, again the first line is the date, the second line is "interfacename": followed by 8 numbers, and 8 more numbers.  The script is concerned with the first number from each of those groups.  (If you "cat /proc/net/dev" you'll see that they are the number of bytes transmitted and recieved.)

If things are not working for you still, please follow these instructions:

First, install Fiddler (Or something similar if you aren't on Windows).  Then configure your browser to load pages through its proxy, and visit each of the URLs listed here once, or visit the page that gives you a problem.  Then for each URL, select it in the list on the left, click Edit->Copy->Session, and paste that into a text file.  Then, email it to me (link on the left of each post) and I'll get back to you!  This way I'll have a lot of the relevant information and we won't have to play email/forum tag to get the details.

GREAT !

Man, if you lived here - in belgium- I would take you out and buy you a couple of drinks ;-)

Thank you very much.

The mean problem was that I wasn't be able to see svg files. It is nog okay!

Realy nice work !

Ok, I got it working as soon as I tried it on Windows XP + Firefox 1.5. Seems like my Gentoo Linux + Firefox 1.0.7 isn't able to display the graph.. Anyhow, great feature, looks really impressive!

va1210: Correct, if you read carefully, I've said somewhere that you need FF 1.5+ .  1.5 is where FF introduced SVG functionality standard.

This package is written to work with WR RC4, and WebIf 0.01 not the versions you have installed david.

I see, my webif is actually 0.2. Anyway, since nbd snapshots are what will become rc5 you may want to start looking into it (no hurry of course).

Got it working... Happy now big_smile

All we need is one for ethernet use

All we need is one for ethernet use

What do you mean?  There should be a graph for all interfaces on your box.

i have a similar problem...

i can see all graphs working, only the cpu and eth0 graph prompt me to download!

i have firefox 1.5.1 and openwrt has the right package and right config files or modules instaled

I've just cleaned firefox cache and everything work fine!!!

The discussion might have continued from here.