|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
[SOLVED]RX bytes
Have a small ruby script I wrote that gathers bandwidth from ifconfig eth0 on linux. I get the info from this line.
RX bytes:6742305874 (6.2 GiB) TX bytes:269880060 (257.3 MiB) As far as I can tell my OpenBSD box does not provide this information in ifconfig. Is there another way to get the same type of info? Thanks. Last edited by gregf; 22nd October 2008 at 12:45 AM. |
|
|||
Code:
$ netstat -inb Name Mtu Network Address Ibytes Obytes lo0 33168 <Link> 14035 14035 lo0 33168 127/8 127.0.0.1 14035 14035 lo0 33168 ::1/128 ::1 14035 14035 lo0 33168 fe80::%lo0/ fe80::1%lo0 14035 14035 bge0 1500 <Link> 00:10:18:00:9f:fd 287795130 11082790 bge0 1500 192.168.222 192.168.222.20 287795130 11082790 bge0 1500 fe80::%bge0 fe80::210:18ff:fe 287795130 11082790 re0* 1500 <Link> 00:19:db:47:b0:4c 0 0 enc0* 1536 <Link> 0 0 Code:
$ netstat -in Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Colls lo0 33168 <Link> 75 0 75 0 0 lo0 33168 127/8 127.0.0.1 75 0 75 0 0 lo0 33168 ::1/128 ::1 75 0 75 0 0 lo0 33168 fe80::%lo0/ fe80::1%lo0 75 0 75 0 0 bge0 1500 <Link> 00:10:18:00:9f:fd 192905 42 129995 0 0 bge0 1500 192.168.222 192.168.222.20 192905 42 129995 0 0 bge0 1500 fe80::%bge0 fe80::210:18ff:fe 192905 42 129995 0 0 re0* 1500 <Link> 00:19:db:47:b0:4c 0 0 0 0 0 enc0* 1536 <Link> 0 0 0 0 0
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
That was quick. Thanks. Had looked at netstat but, I guess I ran it with the wrong options.
|
|
|||
A couple of months ago, I was writting a shell script to monitor internet usage. The script was based on netstat. The script was totally useless, because the statistic (in/out) is randomly resetted.
For example, this is statistic of a server which has been up for a couple of months: Code:
netstat -I bfe0 -nh Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll bfe0 1500 <Link#1> 00:15:c5:23:89:72 299M 1 277M 0 1 bfe0 1500 10.1.1.0/24 10.1.1.2 299M - 277M - - Any idea?
__________________
...then the God created man... |
|
|||
Wow, had no idea it was randomly reset. I knew it was reset upon reboot but not randomly. Any idea how long of a period before this "random" reset is? I would say it's at least a week? Anyways, I plan on using the deamon gem in ruby to have it update my data every 30 seconds or so. I gotta play with the idea still. So even if it was reset I would only be missing a few seconds of data. Would love to hear some better ideas.
|
|
||||
openbsd uses 64bit counters.
> So even if it was reset I would only be missing a few seconds of data. Would love to hear some better ideas. one way you could keep track of the bytes passing through an interface is through a script running from cron that keeps some state on the disk so that it can continue tracking the usage correctly on interface reset, counter roll-over, reboot etc. i wrote a daemon + script to keep track of my net usage you can check it out http://www.daemonforums.org/showthre...ighlight=bwmon also, i recall a program mentioned on one of the threads (can't remember which one - try searching) that can give you statistics in nice html o/p, graphs etc. |
|
|||
Thanks for all the ideas. That other thread was a great resource. Missed that when searching some how.
|
|
|