Configuring an SNMP View

It is possible to include certain OIDs and exclude certain other OIDs within one SNMP MIB view. You do this by stacking different set snmp view includes and excludes which specify a single view name. This allows the user to view all of the “included” OID strings for their associated view name, minus all of the “excluded” OID strings for their view name. If no such parameter is specified, “included” is assumed.

Though it is possible to create and use multiple view names as desired, for demonstration purposes it is simplest to modify the default view, since it is already being referenced by the remainder of the SNMP command set.

The following example removes the default view specifications, and inserts one which permits access to branch MIB 1.3.6.1.2.1 with the exception of branch interfaces 1.3.6.1.2.1.2.:

System(su)->clear snmp view All 1
System(su)->clear snmp view All 0.0
System(su)->set snmp view viewname All subtree 1.3.6.1.2.1
System(su)->set snmp view viewname All subtree 1.3.6.1.2.1.2 excluded 
System(su)->show snmp view
 View Name       = All
 Subtree OID     = 1.3.6.1.2.1
 Subtree mask    =
 View Type       = included
 Storage type    = nonVolatile
 Row status      = active
 
 View Name       = All
 Subtree OID     = 1.3.6.1.2.1.2
 Subtree mask    =
 View Type       = excluded
 Storage type    = nonVolatile
 Row status      = active

You can test this configuration using any MIB browser directed to the IP of the configured device and using the default community name public associated with the view All. If configured correctly, only your specified sections of the MIBs will be visible.