Smarts NCM: Cisco IOS device names have additional fields along with Hostname
book
Article ID: 331012
calendar_today
Updated On:
Products
VMware Smart Assurance
Issue/Introduction
Symptoms:
Cisco IOS devices are pulling hostnames with additional strings such as ",Switch", ",Switch,Switch" and ",Switch,Switch,Switch". SNMP is not in use for these devices communication.
Environment
VMware Smart Assurance - NCM
Cause
NCM fetches Hostname with below function via SSH/Telnet for Cisco IOS devices:
From file $VOYENCE_HOME/package/cisco/ios/stdfuncs.inc getHostNameViaTerm(var session) { if(m_showVer==0||m_showVer==""){ m_showVer = ciscoSendCommand(session,"show version"+stdEOL); } var hostName = trim(chomp(stdGetMatchedStrings(m_showVer,"(.*) uptime"))); var hosts = ciscoSendCommand(session,"show hosts"+stdEOL); var domain = trim(chomp(stdGetMatchedStrings(hosts,"Default domain is (.*)"))); if( strlen(domain) > 0 && strfind(domain,"not set")==-1 ) hostName += "."+domain; retVal = hostName; LOG="ciscoGetTermHostName =" + hostName;
return; } NCM considers string before uptime in "show version" command output as hostname.
Cisco IOS Stack Switches have uptime string more than once in the show version command output, hence the device name is appearing like that in NCM. Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>CHVPKVSL-V2025 uptime is 1 week, 4 days, 9 hours, 10 minutes Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>Switch 02 Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>--------- Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>Switch uptime : 1 week, 4 days, 9 hours, 16 minutes Dec 01 04:47:38 -901806336/ssh#1: RCV-1001> Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>Switch 03 Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>--------- Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>Switch uptime : 1 week, 4 days, 9 hours, 15 minutes Dec 01 04:47:38 -901806336/ssh#1: RCV-1001>
Resolution
Implement the below workaround in your environment:
In DS, follow the first 3 steps(a,b,c) if you don t have $VOYENCE_HOME/custompackage/cisco/ios directory. If you already have the directory structure and stdfuncs.inc file at that path, take a backup of the file and skip to step d.
a. Make a cisco directory in the custompackage directory as follows: source /etc/voyence.conf mkdir $VOYENCE_HOME/custompackage/cisco
b. Make a ios directory in the $VOYENCE_HOME/custompackage/cisco directory as follows: mkdir $VOYENCE_HOME/custompackage/cisco/ios
c. Copy the stdfuncs.inc file from the package/cisco/ios directory to the custompackage/cisco/ios directory as follows: cp $VOYENCE_HOME/package/cisco/ios/stdfuncs.inc $VOYENCE_HOME/custompackage/cisco/ios/stdfuncs.inc
d. Open stdfuncs.inc file at $VOYENCE_HOME/custompackage/cisco/ios directory:
e) Execute service voyence restart . f) Clear device cache and pull All on the device. (or) Navigate to $VOYENCE_HOME/data/devserver/cm/cache/<deviceIDX>, delete the files SystemProperties.xml and Identity.xml and run pull selected of SystemProperties, Identity on the device.
With this workaround, NCM is making use of entry after hostname string in show run command output of device, to retrieve the hostname.