I want using SNMP to get members of Bundle-Ether, but I can not find the suitable Mib for Bundle-Ether
Have a look at ifStackStatus entry in IF-MIB::ifStackTable . If you know ifIndex of Bundle-Ether, for example 173, you can get lower-layer ifIndexes:
$ snmpwalk -v2c -c public 10.77.136.6 ifName.173
IF-MIB::ifName.173 = STRING: Bundle-Ether5
$ snmpwalk -v2c -c public 10.77.136.6 ifStackStatus.173
IF-MIB::ifStackStatus.173.72 = INTEGER: notInService(2)
IF-MIB::ifStackStatus.173.98 = INTEGER: active(1)
$ snmpget -v2c -c public 10.77.136.6 ifName.72 ifName.98 ifOperStatus.72 ifOperStatus.98
IF-MIB::ifName.72 = STRING: TenGigE0/1/0/0
IF-MIB::ifName.98 = STRING: TenGigE0/1/0/27
IF-MIB::ifOperStatus.72 = INTEGER: down(2)
IF-MIB::ifOperStatus.98 = INTEGER: up(1)
Related
Tring to go through new mib i added to mibs file, i have run this command as a test
snmpwalk -v3 -u $USER-l authPriv -a SHA -A "$PASS" -x AES -X $PASS 10.x.x.x panCommonMib
and i think it made the walk on the entire PAN-COMMON-MIB which is good, but some objects there are understandable like
PAN-COMMON-MIB::panSysSwVersion.0 = STRING: x.1.x
And i can translate and know what this obj do.
And some are like that:
PAN-COMMON-MIB::panCommonObjs.7.4.4.1.6.6 = INTEGER: 0
PAN-COMMON-MIB::panCommonObjs.7.5.1.1.201 = STRING: "Log Collector"
PAN-COMMON-MIB::panCommonObjs.7.5.1.2.0 = ""
PAN-COMMON-MIB::panCommonObjs.7.5.1.2.101 = ""
If i try to translate them it gives the textual translate of : panCommonObjs
snmptranslate -IR -Td -OS PAN-COMMON-MIB::panCommonObjs.7.4.4.1.6.6
PAN-COMMON-MIB::panCommonObjs.7.4.4.1.6.6
panCommonObjs OBJECT-IDENTITY
-- FROM PAN-COMMON-MIB
DESCRIPTION "
Sub-tree for common MIB objects."
::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) panRoot(25461) panMibs(2) panCommonMib(1) panCommonObjs(2) 7 4 4 1 6 6 }
I want to understand what is
INTEGER: 0 is, how can i translate this?
Thanks.
Maybe your MIBs are outdated.
snmptranslate -IR -Td -OS PAN-COMMON-MIB::panCommonObjs.7.4.4.1.6.6
PAN-COMMON-MIB::panDeviceLoggingExtFwdStatsTable1minAvgSendRate.6
panDeviceLoggingExtFwdStatsTable1minAvgSendRate OBJECT-TYPE
-- FROM PAN-COMMON-MIB
SYNTAX Unsigned32
MAX-ACCESS read-only
STATUS current
DESCRIPTION "Counter for average send rate over 1 minute interval."
::= { iso(1) org(3) dod(6) internet(1) private(4) enterprises(1) panRoot(25461) panMibs(2) panCommonMib(1) panCommonObjs(2) panDeviceLogging(7) panDeviceLoggingExtFwd(4) panDeviceLoggingExtFwdStatsTable(4) panDeviceLoggingExtFwdStatsEntry(1) panDeviceLoggingExtFwdStatsTable1minAvgSendRate(6) 6 }
I got them from github
When I run any commands such as:
# snmptranslate .1.3.6.1.4.1.28318.1.1.3
SNMPv2-SMI::enterprises.28318.1.1.3
# snmpwalk 58.196.58.149 1.3.6.1.4.1.28318.1.1.3
SNMPv2-SMI::enterprises.28318.1.1.3.1.0 = STRING: "89-14-a8-52-a4-46"
SNMPv2-SMI::enterprises.28318.1.1.3.2.0 = STRING: "058.196.58.149/255.255.255.252"
SNMPv2-SMI::enterprises.28318.1.1.3.3.0 = STRING: "058.196.58.149"
SNMPv2-SMI::enterprises.28318.1.1.3.6.0 = STRING: "137.010.060.016"
SNMPv2-SMI::enterprises.28318.1.1.3.7.0 = STRING: "137.010.060.017"
SNMPv2-SMI::enterprises.28318.1.1.3.8.0 = INTEGER: 0
SNMPv2-SMI::enterprises.28318.1.1.3.9.0 = INTEGER: 0
SNMPv2-SMI::enterprises.28318.1.1.3.10.0 = STRING: "reserved"
I would like net-snmp to translate .1.3.6.1.4.1.28318.1.1.3 to the textual MIB formats. I'm not sure how to debug this.
I have this in my /etc/snmp/snmp.conf:
# cat /etc/snmp/snmp.conf
mibdirs /usr/share/snmp/mibs
defVersion 2c
defCommunity public
Where all my MIBs are in /usr/share/snmp/mibs. I know that 1.3.6.1.4.1.28318.1.1.3.0 corresponds to a textual MIB name of mac representing the mac address.
Any idea how to debug what has gone wrong and fix the problem?
The issue is that net-snmp doesn't load MIBs even if they're specified in the MIB directory.
So by adding mibs to the /etc/snmp/snmp.conf file fixed it:
# cat /etc/snmp/snmp.conf
mibdirs /usr/share/snmp/mibs
mibs +MYMIB
defVersion 2c
defCommunity public
The OID is translated properly. This can also be debugged by doing a:
$ snmptranslate -m +MYMIB -IR -On hello
MYMIB::hello = STRING: "WORLD"
Which will either output correctly above or show an issue. Note the -m +MYMIB doesn't have to be there if in the /etc/snmp/snmp.conf file.
I am trying to set some OID but seems that it gives below error "No Such Instance currently exists at this OID" which should not be the case as i am able to get/walk same OID. so its present.
root#m-snm:~# snmpwalk -v 2c -c public 10.2.4.19 .1.3.6.1.2.1.2.2.1.7.3
iso.3.6.1.x.x.x.x.x.7.3 = INTEGER: 1
root#m-snm:~# snmpset -v 2c -c public 10.2.4.19 .1.3.6.1.2.1.2.2.1.7.3 i 2
iso.3.6.1.x.x.x.x.x.7.3 = **No Such Instance currently exists at this OID**
root#m-snm:~# snmpget -v 2c -c public 10.2.4.19 .1.3.6.1.2.1.2.2.1.7.3
iso.3.6.1.x.x.x.x.x.7.3 = INTEGER: 1
Is it the permission issue ? Or i am not allowed to write ? or the field itself is not writable ? how can check what field are r/w and what are readonly
I can ask to a snmp agent the query:
snmpwalk -v2c -c public 192.168.56.70 1.3.6.1.2.1.31.1.1.1.1.1
I recieve "lo" (loopback interface) as the answer. My question is: How I can access that OID through the names instead of using the OID numbers? That should be as follows:
snmpwalk -v2c -c public 192.168.56.70 iso.identified-organization.dod.internet.mgmt.mib-2.ifMIB.ifMIBObjects.ifXTable.ifXEntry.ifName
If I send this last query to the snmp agent, i get "Unknown Object Identification". Which changes should I do in the snmp agent configuration to get the same answer as when I am asking through the OID?
Any help will be appreciated, thanks!
Normally I'd use the simple symbolic name e.g.
snmptranslate -M+. -m +ALL 1.3.6.1.2.1.31.1.1.1.1.1
IF-MIB::ifName.1
From the agent's perspective the next two are the same, i.e. the netsnmp snmpwalk utility handles the symbol translations.
snmpwalk -v2c -c public 192.168.56.70 1.3.6.1.2.1.31.1.1.1.1.1
IF-MIB::ifName.1 = STRING: lo
Symbol version :
snmpwalk -v2c -c public 192.168.56.70 IF-MIB::ifName.1
IF-MIB::ifName.1 = STRING: lo
Include the MIB files if they're not in your default path -M+. -m +ALL
snmpwalk -v2c -c public vvx1 IF-MIB::ifName.1
IF-MIB::ifName.1 = STRING: lo
I try to create a custom SNMP oid (and script).
I add the following line to snmpd.conf (and restart service) :
pass .1.3.6.1.3.2 /bin/myscript.sh
.
cat myscript.sh
#!/bin/sh
echo .1.3.6.1.3.2
echo gauge
exec 100
.
snmpwalk -c mycommunity -v2c 10.2.1.4 .1.3.6.1.3.2
SNMPv2-SMI::experimental.2 = Gauge32: 100
Error: OID not increasing: SNMPv2-SMI::experimental.2
>= SNMPv2-SMI::experimental.2
Is snmpwalk expecting anything at the end of the query ? snmpget work with no problem!
By default snmpwalk expect the value to be increasing. To get around it try:
snmpwalk -Cc -c mycommunity -v2c 10.2.1.4 .1.3.6.1.3.2
The Cc option does this:
"do not check returned OIDs are increasing"
Often the walk can be completed with oid:s out of order using this.
snmpwalk expects increasing replies :
SNMPv2-SMI::experimental.2 = Gauge32: 100
SNMPv2-SMI::experimental.3 = Gauge32: 1125
SNMPv2-SMI::other.1 = Gauge32: 10
END
It appears that the snmp agent replies two identical values :
SNMPv2-SMI::experimental.2 = Gauge32: 100
SNMPv2-SMI::experimental.2 = Gauge32: 100
So it fails (unexpected behaviour).