Summary
The below example will show example of how to create SNMP policy from mib files received by vendors.
In this example, we faced "ERROR: There are unresolved oids" and we will show how the resolve this.
Question
mib2policy.sh returns the below error on Operations Manager for Linux (OML)
[root@Golqm mib-policy] cd /opt/OV/contrib/mib2policy/bin/
[root@Golqm bin]# mib2policy.sh /opt/OV/contrib/mib-policy/OPCD-BMCORE-MIB-V2.mib -p "OPCD-BMCORE-MIB-V2"
ERROR: There are unresolved oids:
opencode-systems
Use 'mib2policy_db_update' to create an extended oid database
Answer
1. We are uploading the MIB files into our test environment under the directory:
/opt/OV/contrib/mib-policy
[root@OML mib-policy]# ls -ltr
-rw-r--r--. 1 root root 7375 Oct 27 2014 OPCD-BMCORE-MIB-V2.mib
-rw-r--r--. 1 root root 5174 Oct 27 2014 OPCD-GENERAL-MIB.mib
2. Navigate to mib2policy folder and create the policy:
[root@OML mib-policy] cd /opt/OV/contrib/mib2policy/bin/
[root@OML bin]# mib2policy.sh /opt/OV/contrib/mib-policy/OPCD-BMCORE-MIB-V2.mib -p "OPCD-BMCORE-MIB-V2"
ERROR: There are unresolved oids:
opencode-systems
Use 'mib2policy_db_update' to create an extended oid database!
3. We got error for unresolved oids. In order to understand for which MIB file we have to create virtual.oid, we can check the “IMPORTS” section of the MIB file:
IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE, enterprises FROM SNMPv2-SMI
DisplayString FROM SNMPv2-TC
opencode-systems FROM OPCD-GENERAL-MIB;
|
4. So we have to create virtual.oids for this MIB file - OPCD-GENERAL-MIB
[root@OML bin]# mib2policy_db_update.sh --verbose -O virtual.oids /opt/OV/contrib/mib-policy/OPCD-GENERAL-MIB.mib
mib2policy_db_update:Reading default oid database
mib2policy_db_update:Reading oid database 'virtual.oids'
mib2policy_db_update:Reading mib file '/opt/OV/contrib/mib-policy/OPCD-GENERAL-MIB.mib'
mib2policy_db_update:Writing oid database 'virtual.oids'
5. Try again to create the policy:
[root@OML bin]# /opt/OV/contrib/mib2policy/bin/mib2policy.sh -v -O virtual.oids /opt/OV/contrib/mib-policy/OPCD-BMCORE-MIB-V2.mib -p "OPCD-BMCORE-MIB-V2"
mib2policy:Default config file=/opt/OV/contrib/mib2policy/bin/../etc/mib2policy.config
mib2policy:Checking options passed via '-l|--line'
mib2policy:Checking config file passed via '-c|--config'
mib2policy:Checking factory config file
mib2policy:Checking for file existance - ./OPCD-BMCORE-MIB-V2_data
mib2policy:Checking for file existance - ./OPCD-BMCORE-MIB-V2_header.xml
mib2policy:Policy name=OPCD-BMCORE-MIB-V2
mib2policy:Mib file=/opt/OV/contrib/mib-policy/OPCD-BMCORE-MIB-V2.mib
6. Check if it was created successfully:
[root@OML bin]# ls -ltr /opt/OV/contrib/mib2policy/bin/
total 68
-r-xr-xr-x. 1 bin bin 679 Mar 18 2010 mib2policy.sh
-r-xr-xr-x. 1 bin bin 16573 Mar 18 2010 mib2policy.pl
-r-xr-xr-x. 1 bin bin 719 Mar 18 2010 mib2policy_db_update.sh
-r-xr-xr-x. 1 bin bin 4018 Mar 18 2010 mib2policy_db_update.pl
-rw-r--r--. 1 root root 11185 Dec 13 14:08 virtual.oids
-rw-r--r--. 1 root root 17122 Dec 13 14:09 OPCD-BMCORE-MIB-V2_data
-rw-r--r--. 1 root root 1223 Dec 13 14:09 OPCD-BMCORE-MIB-V2_header.xml
The highlighted policies could now be loaded into any OM server and deployed on the monitored server