I’m not sure of the syntax needed for the following function. Where can I find details on writing functions and the syntax:
Intialize variables v1=v2=r1=0
We need to perform an SNMP get for a single OID that contains that current counter for throughput (cumulative counter). This value needs to be saved to a variable (v1).
We wait 30 seconds and then perform another SNMP get for the same OID. We store this value in another variable (v2).
We subtract the the value stored in step 1 (v1) from the current value just retrieved (v2), store the result in another variable (r1), and display it on a link.
We then save the most resent value to the first varible and return to step 2 (v1=v2).
calculates and returns parameter change speed within given time interval.
First parameter - counter value, second - optional - interval to calculate
rate over - default 1 second (1.0)
so if you want to get speed at which some oid changes per second you would
type [rate(oid(“1.2.3.4.5”))]
OK. I tried that but the OID is a 9 digit number. The function is returning negative 10 digit number. What’s the max number that the function can support?
It seems you’re retrieving octets and octets generally are byte-sized values (octet, 8, as in 8 bits, so 0 to 255, wikipedia). So perhaps there’s some confusion about the data-type being returned by your SNMP query, cause the figures you’re showing sure aren’t byte-sized.?
Is there perhaps another oid called ‘aptrafficRfInDecimals’ or something like that?
Thanks Winkelman. The MIB reference indicates that this is a counter counting bytes. But you are right, it looks like octets. I have no idea why they would display this as octets instead of base 10 or even HEX.
Well, the rate function simply doesn’t work. Is the source for the rate function available?
Also, is there a programming guide for DUDE? The syntax is a little different from router OS. Are the only operators that are available for use listed in the Function list?