adamZ88 has asked for the wisdom of the Perl Monks concerning the following question:
All I am looking for someone that can instruct me on how to communicate to Cisco Unified Communications Manager with Perl. The requirement is as follows: I have completed a script that via SNMP polls network switches for connected phones, now , I need to take the phone name "SEP(plus phones MAC" I.E SEPFFFFFFFFFFFF , and talks to CUCM to determine the phones Directory Number(s) programmed on it.
Here is my code thus far. Pardon my horrible variable naming convention, I was trying to create this script in a hurry. I now need some of the output of this script (the SEP Name) and query CUCM for more details about the phone. Help please?
#!/usr/bin/perl #Version 1 2/27/17 use SNMP_util; use NetAddr::IP; #use warnings; ####Variable Dec my $sCdpCacheCapabilities = "1.3.6.1.4.1.9.9.23.1.2.1.1.9"; my $sCommu +nityString = "notReallyGivingUmyCommunityString"; my $counter =0; $cd +pCacheDeviceId = "1.3.6.1.4.1.9.9.23.1.2.1.1.6"; $cdpCachePlatform = +"1.3.6.1.4.1.9.9.23.1.2.1.1.8"; $cdpInterfaceEntry = "1.3.6.1.4.1.9.9 +.23.1.1.1.1.6"; $cdpCacheAddress = "1.3.6.1.4.1.9.9.23.1.2.1.1.4"; ##### End Variable Declaration #####Open File Handle open (FILEREAD, "formerlyBridges2Input.csv"); while ($Host = <FILEREAD>){ chomp ($Host); (@cdpNeighborPackedCapabilities) = &snmpwalk("$sCommunityString\@$Ho +st","$sCdpCacheCapabilities"); foreach $PcdpCap (@cdpNeighborPackedCapabilities){ + #($index, $capHEX) = split( +/:/, $PcdpCap, 2); ($uni, $mee, $capHEX) = split (/[\.,:]/, $PcdpCap); + #($ind, $in2) = split(/./, + $index, 2); ($index) = join ('.' , $uni,$mee); my $sUnpackedCDPcap; map { $sUnpackedCDPcap .= sprintf("%02x",$_) } unpack "CCCCCC", $c +apHEX; if ($sUnpackedCDPcap == "00000490"){ $sIDcomp = "$cdpCacheDeviceId.$index"; $sPlaComp = "$cdpCachePlatform.$index"; $sInEntry = "$cdpInterfaceEntry.$uni"; $sAddComp = "$cdpCacheAddress.$index"; ###print "$sAddComp\n"; ($devName) = &snmpget("$sCommunityString\@$Host","$sIDcomp"); ($sDevPlatform) = &snmpget("$sCommunityString\@$Host","$sPlaComp") +; ($sPortName) = &snmpget("$sCommunityString\@$Host","$sInEntry"); ($ipAdd) = &snmpget("$sCommunityString\@$Host","$sAddComp"); # $Do = join '.', unpack "C*", pack "H*", $ipAdd; my $val4; map {$val4 .= sprintf("%02x",$_)} unpack "C*", $ipAdd; $neighIP = join '.', unpack "C*", pack "H*", $val4; print "$Host,$devName,$sDevPlatform,$sPortName,http://$neighIP/\n" +;} }}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Getting data from Cisco Call Manager with Perl
by genio (Beadle) on Feb 28, 2017 at 14:19 UTC | |
by adamZ88 (Beadle) on Mar 02, 2017 at 22:00 UTC | |
|
Re: Getting data from Cisco Call Manager with Perl
by marto (Cardinal) on Feb 28, 2017 at 14:15 UTC |