Discussion:
Perhaps in OID .1.3.6.1.2.1.2.2.1.10.3 are updated only every 30 seconds, why?
o***@gomelpromstroy.by
2007-11-18 19:06:07 UTC
Permalink
-- Installed

ubuntu 7.10
***@ubnt:/home/alex# snmpd -v
NET-SNMP version: 5.3.1
Web: http://www.net-snmp.org/
Email: net-snmp-***@lists.sourceforge.net

-- When requesting

***@ubnt:/home/alex# date; snmpget -v 1 -c private localhost
.1.3.6.1.2.1.2.2.1.10.3

-- Get a response

Вск Ноя 18 19:58:40 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 76695825

-- Repeat request

***@ubnt:/home/alex# date | snmpget -v 1 -c private localhost
.1.3.6.1.2.1.2.2.1.10.3
IF-MIB::ifInOctets.3 = Counter32: 76695825

-- Again repeat request

***@ubnt:/home/alex# date; snmpget -v 1 -c private localhost
.1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 19:59:08 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 76701041

-- ... Then the answer is not updated within 30 seconds
-- On proshedstvii 30 seconds

***@ubnt:/home/alex# date; snmpget -v 1 -c private localhost
.1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 19:59:37 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 76705537
***@ubnt:/home/alex# date; snmpget -v 1 -c private localhost
.1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 19:59:38 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 76705537
***@ubnt:/home/alex#

/etc/snmp/snmpd.conf

com2sec readwrite 127.0.0.1/32 private
group MyRWGroup v1 readwrite
group MyRWGroup v2c readwrite
group MyRWGroup usm readwrite
view all included .1 80
view system included .iso
access MyRWGroup "" any noauth exact all all none
syslocation Unknown (configure /etc/snmp/snmpd.local.conf)
syscontact Root <***@localhost>


-- Why are updated only every 30 seconds?

-- In version smnpd 5.1.2, the data are updated through 1 second

office:~# date; snmpget -v 1 -c private 169.254.0.1 .1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 20:32:27 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 398074730
office:~# date; snmpget -v 1 -c private 169.254.0.1 .1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 20:32:28 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 398075418
office:~# date; snmpget -v 1 -c private 169.254.0.1 .1.3.6.1.2.1.2.2.1.10.3
Вск Ноя 18 20:32:29 EET 2007
IF-MIB::ifInOctets.3 = Counter32: 398076106
office:~#


-- In man snmpd.conf found mention about versionClearCache, thinking that
might help, but ...

man snmpd.conf
...
In either case, the exit statement and output will be cached
for
30s after the initial query. This cache can be flushed by a
SET
request of the integer value 1 to the MIB instance
version‐
ClearCache.0.
...

OID - 1.3.6.1.4.1.2021.100.10.0
ReadWrite
Set to 1 to clear the exec cache, if enabled

***@ubnt:/home/alex# snmpget -v 1 -c private localhost
.1.3.6.1.4.1.2021.100.10.0
UCD-SNMP-MIB::versionClearCache.0 = INTEGER: 0
***@ubnt:/home/alex# snmpset -v 1 -c private localhost
.1.3.6.1.4.1.2021.100.10.0 i 1
UCD-SNMP-MIB::versionClearCache.0 = INTEGER: 1
***@ubnt:/home/alex# snmpget -v 1 -c private localhost
.1.3.6.1.4.1.2021.100.10.0
UCD-SNMP-MIB::versionClearCache.0 = INTEGER: 0
***@ubnt:/home/alex#
Dave Shield
2007-11-18 19:36:34 UTC
Permalink
Post by o***@gomelpromstroy.by
-- Why are updated only every 30 seconds?
When the agent receives a request for any information from
the ifTable, it will read in the data for *all* interfaces. This
process is relatively expensive, so it is cached for later use.
This helps when walking the whole table.
Post by o***@gomelpromstroy.by
-- In version smnpd 5.1.2, the data are updated through 1 second
The 5.1.x code didn't have much support for data caching, so most
MIB modules (including the ifTable) would retrieve data afresh for
every single request. This gives more up-to-date information, at
the cost of increased processing overheads.

Later release lines improved the caching support, so the newer
ifTable implementation makes use of this facility.
Post by o***@gomelpromstroy.by
-- In man snmpd.conf found mention about versionClearCache,
thinking that might help
Probably not.
But have a look at the NET-SNMP-AGENT-MIB::nsCacheTable.
That should allow you to tweak the expiry time of the ifTable cache,
or turn it off completely (by setting it to 0).

Dave
oleg
2007-11-20 15:07:26 UTC
Permalink
Здравствуйте, Dave Shield
Ответ на Ваше письмо от 18.11.2007 21:36
Post by Dave Shield
But have a look at the NET-SNMP-AGENT-MIB::nsCacheTable.
That should allow you to tweak the expiry time of the ifTable cache,
or turn it off completely (by setting it to 0).
Thank you very much for the hint!
Helped follows:

***@ubnt:/home/alex# snmpget -v 1 -c private localhost
.iso.org.dod.internet.private.enterprises.netSnmp.netSnmpObjects.nsCache.nsCacheTable.nsCacheEntry.nsCacheTimeout.1.3.6.1.2.1.2.2
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 30
***@ubnt:/home/alex# snmpset -v 1 -c private localhost
.iso.org.dod.internet.private.enterprises.netSnmp.netSnmpObjects.nsCache.nsCacheTable.nsCacheEntry.nsCacheTimeout.1.3.6.1.2.1.2.2
i 1
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 1
***@ubnt:/home/alex# snmpget -v 1 -c private localhost
.iso.org.dod.internet.private.enterprises.netSnmp.netSnmpObjects.nsCache.nsCacheTable.nsCacheEntry.nsCacheTimeout.1.3.6.1.2.1.2.2
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 1
***@ubnt:/home/alex# snmpget -v 1 -c privategps localhost
.1.3.6.1.2.1.2.2.1.10.3
IF-MIB::ifInOctets.3 = Counter32: 5965581
***@ubnt:/home/alex# snmpget -v 1 -c privategps localhost
.1.3.6.1.2.1.2.2.1.10.3
IF-MIB::ifInOctets.3 = Counter32: 5965933
***@ubnt:/home/alex# snmpget -v 1 -c privategps localhost
.1.3.6.1.2.1.2.2.1.10.3
IF-MIB::ifInOctets.3 = Counter32: 5966285

there are still a number of issues

1.
if you enter a new value OID
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 1
further
/etc/init.d/snmpd restart
OID returns to
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 30

how to maintain the state of OID, or re-establish values needed OID?

2.
if I am not mistaken OID values for RFC1213-MIB: ifTable derived from
/proc/net/dev

cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes
packets errs drop fifo colls carrier compressed
lo: 216180 935 0 0 0 0 0 0
216180 935 0 0 0 0 0 0
eth1: 4431269 5585 0 0 0 0 0 17
764898 6332 0 0 0 0 0 0
eth2: 88454 1002 0 0 0 0 0 0
90988 761 0 0 0 0 0 0
eth3: 6036 78 0 0 0 0 0 0
8264 98 0 0 0 0 0 0
eth4: 50789 580 0 0 0 0 0 0
1772 26 0 0 0 0 0 0
eth0: 934991 8355 0 0 0 0 0 0
2920080 8049 0 0 0 0 0 0
sit0: 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

snmpwalk -v 1 -c private localhost iftable | grep ifDescr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth1
IF-MIB::ifDescr.3 = STRING: eth2
IF-MIB::ifDescr.4 = STRING: eth3
IF-MIB::ifDescr.5 = STRING: eth4
IF-MIB::ifDescr.6 = STRING: eth0
IF-MIB::ifDescr.7 = STRING: sit0

order devices - lo eth1 eth2 eth3 eth4 eth0 sit0

after reboot

cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes
packets errs drop fifo colls carrier compressed
lo: 715758 3290 0 0 0 0 0 0
715758 3290 0 0 0 0 0 0
eth2: 3764882 15476 0 0 0 0 0 0
10887263 17284 0 0 0 0 0 0
eth3: 56643 349 0 0 0 0 0 0
78477 347 0 0 0 0 0 0
eth4: 357422 2982 0 0 0 0 0 0
215365 2305 0 0 0 0 0 0
eth1:105923511 86945 0 0 0 0 0 27
7206085 68837 0 0 0 0 0 0
eth0:860359620 977560 0 0 0 0 0 0
122021014 425923 0 0 0 0 0 0
sit0: 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

snmpwalk -v 1 -c private localhost iftable | grep ifDescr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth2
IF-MIB::ifDescr.3 = STRING: eth3
IF-MIB::ifDescr.4 = STRING: eth4
IF-MIB::ifDescr.5 = STRING: eth1
IF-MIB::ifDescr.6 = STRING: eth0
IF-MIB::ifDescr.7 = STRING: sit0


order devices - lo eth2 eth3 eth4 eth1 eth0 sit0

for this reason, changing the name of a particular network device OID

and value for a particular device had to borrow from another OID
how can we work around this problem?
--
Олег
Dave Shield
2007-11-20 15:22:19 UTC
Permalink
Post by oleg
if you enter a new value OID
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 1
further
/etc/init.d/snmpd restart
OID returns to
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 = INTEGER: 30
That's correct.
The initial cache timeout is hardcoded into the MIB implementation.
Post by oleg
how to maintain the state of OID....
Not possible. Sorry.
Post by oleg
..... or re-establish values needed OID?
edit "/etc/init.d/snmpd" and add the line:

snmpset -v 1 -c private localhost
NET-SNMP-AGENT-MIB::nsCacheTimeout.1.3.6.1.2.1.2.2 i 1

to the end of the "start" function :-)
Post by oleg
if I am not mistaken OID values for RFC1213-MIB: ifTable derived from
/proc/net/dev
It depends on the O/S, but yes - I believe that is the source of
the ifTable statistics on Linux kit.
Post by oleg
order devices - lo eth1 eth2 eth3 eth4 eth0 sit0
after reboot
order devices - lo eth2 eth3 eth4 eth1 eth0 sit0
for this reason, changing the name of a particular network device OID
and value for a particular device had to borrow from another OID
That's certainly possible.
Continue reading on narkive:
Search results for 'Perhaps in OID .1.3.6.1.2.1.2.2.1.10.3 are updated only every 30 seconds, why?' (Questions and Answers)
7
replies
I'm unsure what I should get?
started 2008-08-10 12:57:34 UTC
laptops & notebooks
4
replies
acessing cached pages?
started 2006-07-07 05:56:14 UTC
computers & internet
Loading...