carosio / bird-snmp-agent

python based snmp-agent for the bird routing daemon
GNU General Public License v3.0
6 stars 18 forks source link

Failed to parse MIB file / #8

Open nagarjung opened 3 years ago

nagarjung commented 3 years ago

Hi,

I am trying to setup the snmp agent to monitor the bird bgp. I have followed the instructions in the README file from [https://github.com/mikenowak/bird-snmp-agent]

As I am new to bird daemon, I assume few instruction in the readme file as below:

1) Setting the environment variables in the setting section is done in /etc/bird/envvars. 2) I have put the systemd unit section into /etc/init.d/bird. (Is this location correct) ? But /etc/init.d/bird file does not recognise the sections [Unit], [service], [install].

So I have the copied the contents at the end of /etc/init.d/bird as :

Description="BIRD SNMP Agent" After=snmp.service

PermissionsStartOnly=true User=snmp Group=snmp WorkingDirectory=/usr/local/bird-snmp-agent ExecStart=/usr/bin/env python3 /usr/local/bird-snmp-agent/bird_bgp.py ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID PrivateTmp=true

WantedBy=multi-user.target

Finally I run bird daemon using the below command:

root@ubuntu:xxxxxxx# /etc/init.d/bird start

Looks like it is unable to parse the MIB file. I have placed my MIB file in /usr/share/snmp/mibs. I have also place the MIB File /var/lib/mibs/ietf/BGP4-MIB ( as required by bird-bop-agent).

Result of snmpwalk: root@ubuntu:/home/nagarjun# snmpget -v 2c -c public 172.20.10.2 1.3.6.1.2.1.15.1 iso.3.6.1.2.1.15.1 = No Such Object available on this agent at this OID

Any help is appreciated. Also do you have clear document/instructions to set the bird-bgp-agent.

Thanks Nagarjun

yswery-reconz commented 3 years ago

@nagarjung Did you get this solved?

peterbaumert commented 3 years ago

having same issue :(

peterbaumert commented 3 years ago

@nagarjung @yswery-reconz

add to adv_agentx.py

import locale under last import

def b(s):
    """ Encodes Unicode strings to byte strings, if necessary. """
    return s if isinstance(s, bytes) else s.encode(locale.getpreferredencoding())

after def ReadTOID for example

and last change axl.read_mib(mib) to axl.read_mib(b(mib))

yswery-reconz commented 3 years ago

@peterbaumert Nice, many thanks! looks like its no longer erroring and continuing to work all nice