Page 1 of 1

Octets to kbps?

Posted: Sat Nov 11, 2006 5:24 pm
by sandoval
Hi,

Your plugin works great! Nice job well done!

I have a wrt54g, 1.3.6.1.2.1.2.2.1.10.8 gets me the number of octets on Wan side. How can I convert this to kbps??

Posted: Sun Nov 12, 2006 7:19 pm
by phil
As far as I am aware (and as Google has helped me find out), an Octet is a byte.

\"Octets are units of 8 bits (also know as bytes).\"

So 1 octet = 1 byte, therefore the conversion is pretty straight forward :)
Octets = Bytes, therefore multiply by 8 to get bits. Then divide by 1000 (Kbit or 1024 KiB. I think normally we use 1024 for data coms?)

Thanks,
Phil

Posted: Sun Nov 12, 2006 7:24 pm
by sandoval
Hello Phil,

How it should be:

1e in 4114816394 | out 1416674403
2e in 4120532506 | out 1419886543

Math calculation:

4120532506 - 4114816394 = 5716112
5716112 * 8 = 45728896
45728896 / 1000 = 45728
45728 / 60 = 762kbps

But the problem is that using the DLL in Smartie is that you can't get 2 readings, so you can't do the math!

Posted: Sun Nov 12, 2006 7:38 pm
by phil
You should be able to get two readings in one query....
and you should be able to do the maths - let me try and describe it...

Bear with me because its been a while since I actually did this :)

a) Use function 10 to multiply the result of a) by 0.000133333 (which is 8/1000/60)

b) Use function 9 to subtract two values...
Value 1 = Use funciton 1 with OID of 1e
Value 2 = Use function 1 with OID of 2e

Giving something like:
$dll(NetStuffPlugin.dll,10,$dll(NetStuffPlugin.dll,9,$dll(NetStuffPlugin.dll,1,ipaddress:public,oid-1e),$dll(NetStuffPlugin.dll,1,ipaddress:public,oid-2e)),0.000133333)

I think thats right...
Let me know how you get on :)

Thanks,
Phil

Posted: Sun Nov 12, 2006 7:50 pm
by sandoval
Hi,

Yes, that would be a solution if the points would be 1 second appart.

But that is the problem, the time var is not correct:

$dll(NetStuffPlugin.dll,10,$dll(NetStuffPlugin.dll,9,$dll(NetStuffPlugin.dll,1,192.168.200.1:public,1.3.6.1.2.1.2.2.1.10.8),$dll(NetStuffPlugin.dll,1,192.168.200.1:public,1.3.6.1.2.1.2.2.1.10.8)),0.000133333)
=
-26666600

Posted: Sun Nov 12, 2006 7:53 pm
by phil
Ah I see your problem...
Not sure how to handle this one... Either it will be a change to the plugin to remember the last value... or some other method will be required...

I'll have a think and get back to you.

Thanks,
Phil

Posted: Sun Nov 12, 2006 7:58 pm
by sandoval
Thank you for your input so far!

I really really love this plugin, really nice job! I'm still having lots of fun with it, great way of monitoring your network if you can see router stats on your mediacenter LCD!

Posted: Sun Nov 12, 2006 9:22 pm
by phil
Ive just made a new version for you to try.

It has 2 new funcitions, the important one, is funciton 12.
It takes the same parameters as function 1 but it basically gets the difference between the current value, and the value last time the funciton was called.

And returns the result extrapolated over 1 second.

So it should, if my theory works, return bytes per second for the SNMP OID counter.

Does that make sence?
Download the new NetStuffPlugin.rar from my website (same name but it should have todays date on the files)

Let me know if it works.

Thanks,
Phil

Posted: Sun Nov 12, 2006 9:50 pm
by sandoval
It works like a charm!

$dll(NetStuffPlugin.dll,11,$dll(NetStuffPlugin.dll,12,192.168.200.1:public,1.3.6.1.2.1.2.2.1.10.8),1000)

Result is 876,4823 that is close to my maximum download speed, so it should be right I think.

If you need a tester, please mail me. I'm willing to help..

Keep up the good work.

Posted: Sun Nov 12, 2006 9:54 pm
by phil
Great :)
Let me know if there is anything else I can add.

I'll try and remember to let you know if I make any changed, but generally the plugin is fairly stable (I hope) - this is the first change I have made to it .

Thanks,
Phil

Posted: Sun Nov 26, 2006 2:25 pm
by sandoval
Hi me again,

You might want to update your download page, it still links to your old download file!