![]() The output file will look like this (with serial numbers masked) –ĭevice Description,Device Type,Serial Number,Model Number,OtherĪSA 5520 Adaptive Security Appliance,chassis,JM#,ASA5520,ĪSA 5500 Series Security Services Module-20,module,JA#,ASA-SSM-20, Echo TABLE into sed and grab lines from var LINES.Įcho -e “$TABLE” | sed -n echo -e "$i"p > $REPORT 2> /dev/null # Loop through line numbers in var LINES. LINES=$(echo -e “$TABLE” | cut -sd “,” -f 3 | grep -n. # Get line numbers that only have an entry in entPhysicalSerialNum column and input into var LINES # and sed to remove top 3 lines of output. # and entPhysicalAlias (entPhysicalAlias somtimes has serial number of chassis on router and model number on Nexus) colums # Querry ENTITY table on device cut only entPhysicalDescr, entPhysicalClass, entPhysicalSerialNum, entPhysicalModelName HOST=$(snmpget -v2c -c $COMMUNITY -Oqv $DEVICE SNMPv2-MIB::sysName.0)Įcho -e “Querying device: $DEVICE – Hostname: $HOST” If & thenĮcho -e “./getserial.sh n” ĮNTITY=”/usr/share/snmp/mibs/ENTITY-MIB.txt”Įcho -e “Device Description,Device Type,Serial Number,Model Number,Othern” > $REPORT Report_file.csv – the output CSV file for the report List – text file with the list of DNS name or IP addresses for each device – one device per line getserial.sh Ĭommunity – RO community string for devices The command syntax is (which you can also get from running “./getserial.sh -–help” ) – The location of the ENTITY-MIB specified in the variable ENTITY on line 13 of the script.A Linux distro with net-snmp-utils installed.Rather than access each device manually, I wrote a bash script that would get the serial numbers via the SNMP ENTITY table. Recently, I was doing a true up of our Cisco SmartNet contract, and had to get the serial numbers from all of the Cisco devices on the network. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |