# Add a new MIB (TCP-MIB rfc4022) for bsnmpd



## GROND (Jun 9, 2014)

I have a project in which I am trying to pull pids for open network connections through SNMP. I'm running the included `bsnmpd` daemon on FreeBSD 10-RELEASE. The default distribution does not include TCP-MIB, and I am at a loss for how to actually add it. Is there a way to add other MIBs to `bsnmp`? If so, how?


----------



## junovitch@ (Jun 10, 2014)

Maybe one of the add on ports like net-mgmt/bsnmp-ucd would help.  Haven't tried it, just pointing it out.


----------



## SirDice (Jun 17, 2014)

I don't think I've used bsnmp yet but for net-mgmt/net-snmp you need to store the MIB files in /usr/local/share/snmp/mibs. You then need to add each of those files to snmp.conf. I'm sure bsnmp has a similar configuration.


----------



## GROND (Jun 20, 2014)

I know that net-mgmt/net-snmp includes TCP-MIB, but to be honest, I've never managed to get the service to start. bsnmpd works great, so I was hoping to add the MIB I need. The net-mgmt/bsnmp-ucd port doesn't include the MIBs I'm after.


----------



## SirDice (Jun 20, 2014)

GROND said:
			
		

> I know that net-mgmt/net-snmp includes TCP-MIB, but to be honest, I've never managed to get the service to start.


It can be a bit tricky to get going. Move or delete any existing snmp.conf/snmpd.conf and run snmpconf(1). That should create a basic, working, configuration. Once it's working you can modify them to suit your needs.


----------



## GROND (Jun 27, 2014)

Thanks SirDice. You're helpful as always. I'll give it a shot.


----------



## nazari (Aug 5, 2014)

Hi @SirDice,

I need  to add BGP4-MIB to the SNMP agent. I was just there in the snmpd.conf and the snmp.conf does not exist that add into  snmp.conf this code:

```
mibs +BGP4-MIB
```

And before that, I copy  BGP4-MIB.txt to /usr/local/share/snmp/mibs but no Walk BGP:

```
snmpwalk -v2c -c public localhost 1.3.6.1.2.1.15 
SNMPv2-SMI::mib-2.15 = No Such Object available on this agent at this OID
```

Then I add  snmp.conf to /usr/local/share/snmp and add above code and so no walk BGP:

```
snmpwalk -v2c -c public localhost 1.3.6.1.2.1.15 
MIB search path: /root/.snmp/mibs:/usr/local/share/snmp/mibs
Cannot find module (BGP4-MIB): At line 0 in (none)
SNMPv2-SMI::mib-2.15 = No Such Object available on this agent at this OID
```

Help me  please. Thanks.


----------



## SirDice (Aug 5, 2014)

It's possible the MIB you added is depending on other MIBs. And simply loading an MIB doesn't make the values available. Even without MIBs you should still be able to get the values. The MIB just makes it easier to read for us mortals.


----------



## nazari (Aug 5, 2014)

I see  BGP4-MIB.txt and it only import from SNMPv2-SMI and  RFC1213-MIB , that MIBs are exist in agent.

```
IMPORTS
                    MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
                    IpAddress, Integer32, Counter32, Gauge32
                        FROM SNMPv2-SMI
                    mib-2
                        FROM RFC1213-MIB;
```



			
				SirDice said:
			
		

> Even without MIBs you should still be able to get the values.


How get the values? With snmpget(1)?


----------



## SirDice (Aug 5, 2014)

nazari said:
			
		

> How get the values? With snmpget(1)?


Yes, by using the OIDs instead.


----------



## nazari (Aug 5, 2014)

I think  
	
	



```
SNMPv2-SMI::mib-2.15 = No Such Object available on this agent at this OID
```
  means that SNMPv2-SMI::mib-2.15 (SNMPv2-SMI::mib-2.bgp) do_es_ not exist.  My mistake.

I downloaded BGP4-MIB from another site and tried again and I succeeded.
Thanks a lot.


----------

