cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1217
Views
0
Helpful
2
Replies

EEM variables for MfgName, ModelName, SerialNum?

yaplej
Level 1
Level 1

I would like to have access to the Mfg, Model and Serial number in my EEM applet but I did not find any default variables that store that information. One could use the "show ver" and parse the output but that seems like it could be a little messy but SNMP should be a reliable means to get that information.
However when I try to access the OID I keep getting "NO_SUCH_INSTANCE_EXCEPTION".

Are these not the correct OIDs?
1.3.6.1.2.1.47.1.1.1.1.11 = entPhysicalSerialNum
1.3.6.1.2.1.47.1.1.1.1.12 = entPhysicalMfgName
1.3.6.1.2.1.47.1.1.1.1.13 = entPhysicalModelName

My example test applet:

event manager applet test-snmp
event none
action 1 info type snmp oid 1.3.6.1.2.1.47.1.1.1.1.11 get-type exact
action 2 syslog msg "Result is $_info_snmp_value"
2 Replies 2

yaplej
Level 1
Level 1
It looks like my particular version of IOS might not support "info type snmp oid". I could be wrong. https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/eem/configuration/xe-3s/eem-xe-3s-book/eem-overview.html
Cisco IOS Software, C3750 Software (C3750-IPBASEK9-M), Version 12.2(55)SE11, RELEASE SOFTWARE (fc3)

yaplej
Level 1
Level 1

I am still working on this and testing primarily on 3750s and 3650s.  

 

My first problem is that "show ver" has many locations that show the serial number and model number but each a little different.  I wanted to always capture the "master" serial and model if the unit is in a stack.  I think that this does that and also captures the full model number instead of the base model number.

 

Serial:

conf t
no event manager applet test-serial
event manager applet test-serial
event none
 action 1.01 cli command "enable"
 action 1.02 set i 0
 action 1.03 cli command "show ver | i ^System serial number"
 action 2.00 foreach line "$_cli_result" "\n"
 action  3.00 if $i eq 0
 action  3.01  regexp "^System serial number\s*:\s*(.*)" $line match serial_num
 action  3.02  puts "$serial_num"
 action  4.00 end
 action  4.01 increment i 1
 action 5.00 end
 exit
end
event manager run test-serial

 

Model:

conf t
no event manager applet test-model
event manager applet test-model
event none
 action 1.01 cli command "enable"
 action 1.02 set i 0
 action 1.03 cli command "show ver | i ^Model number"
 action 2.00 foreach line "$_cli_result" "\n"
 action  3.00 if $i eq 0
 action  3.01  regexp "^Model number\s*:\s*(.*)" $line match model_num
 action  3.02  puts "$model_num"
 action  4.00 end
 action  4.01 increment i 1
 action 5.00 end
 exit
end
event manager run test-model

 [edit] I confirmed that the first entry is alway the master.