Question

While I am running snmpd as following (using net-snmp 5.7.2.rc1,ubuntu-12.04)
    [root@manage /root]#snmpd –f -Le
    [root@manage /root]# snmpwalk -c public -v 2c 127.0.0.1 IF-MIB::ifInOctets.1
    It is working fine and answering me values
    Eg. 
    IF-MIB::ifOutOctets.1 = Counter32: 35497924
    IF-MIB::ifOutOctets.1 = Counter32: 35499234
    IF-MIB::ifOutOctets.1 = Counter32: 35503212

    I have done packaging of it and its almost working fine. But the issue is the ‘values’ displaying are constant !! it is not changing since the packaging of it..here the /var/snmp3 is a root folder and I am running it with chroot
    [root@manage /root]#/usr/sbin/chroot /var/snmp3/ /usr/local/bin/snmpd –f -Le
    [root@manage /root]#/usr/sbin/chroot /var/snmp3/ /usr/local/bin/snmpwalk -c public -v 2c -Oqv 127.0.0.1 IF-MIB::ifInOctets.1
    IF-MIB::ifOutOctets.1 = Counter32: 34689322
    IF-MIB::ifOutOctets.1 = Counter32: 34689322
    IF-MIB::ifOutOctets.1 = Counter32: 34689322

Can any one tell me what dependencies I am missing over here? why it is not giving current value of it? Please help me with this.

Était-ce utile?

La solution

I'm not sure if I got you correctly, however I will try to offer you a hint. The IF-MIB object you are accessing is the number of octets sent through interface with index 1. Are you sure that during your second snmpwalk you did send some data? The SNMP agent is responding, all the environment variables like MIBS and MIBDIRS seem to be exported correctly. I do not see the issue here.

Please verify your configuration by accessing some data which for sure are constantly changing, i.e. snmpEngineTime. Instead of snmpwalk (this object is a scalar), use multiple snmpget requests. I'm sure data will change.

The second thought I have is that data which are contained in the system files i.e. interface throughput probably need to be binded with your new root directory. Use

mount --bind

option to bind i.e. /dev/ and /etc/ folders with your new root directory (/var/snmp3/dev and /var/snmp3/etc).

You may try this (before chrooting!):

mount -t proc none /var/snmp3/proc
mount --rbind /sys /var/snmp3/sys
mount --rbind /dev /var/snmp3/dev
chroot /var/snmp3/ /bin/bash
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top