cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
425
Views
10
Helpful
5
Replies

CUCM 12.5 Find MGCP device IP address in a table via CLI

Here is the output of a query for devices from the GUI of CUCM 12.5.

ElliotDierksen_0-1666204786637.png

I am trying to find the device IP address in a table from the platform CLI.I can find all the applicable IP addresses for SIP devices with this CLI command.

 

 

run sql select name, address from device, sipdevice, siptrunkdestination where tkmodel = 131 and tkdeviceprotocol = 11 and device.pkid = sipdevice.fkdevice and sipdevice.pkid = siptrunkdestination.fksipdevice order by 1, 2

 

 

 Anybody have any suggestions for how to get that information for the MGCP devices

1 Accepted Solution
5 Replies 5

Perfect! It doesn't need to be in a table. I just wanted somewhere to see it from the CLI. Thanks!

Happy to help! 

Looking at the output in the link provided by Dmytro, for kicks I pasted the output into Notepad++ and saved it as a .CSV file and it opened in Excel in table format. (You said you didn't care...but it nagged at me. lol)

Maren

I am a Unix kind of guy when it comes to crunching text. I have an uber-simple python script that SSH's to all the CM nodes. This customer has 33 of them in 12 different clusters. It sends the risdb commands, and here is my awk script to parse that. I didn't realize it, but it considers ATA's to be a gateway as well. I was trying to gather an inventory for the customer to see what hardware needs to be replaced soon, so all I was really looking for was the gateway name and IP address. Here is my ugly awk script.

awk -F, '
BEGIN { OFS="," }
/^Connected to:  / { cmhost = substr($0,length("Connected to:  ")+1) ; next }
$1 == "Seq#" { print $2, $3 ; next }
NF > 5 {
        n1 = index($2,"@") + 1
        n2 = index($2,".")
        ipaddr = substr($3,2)
        if (ipaddr == "")
                ipaddr = "none"
        if (n1 == 1 && n2 == 0)
        {
                phonegwname = substr($2,2)
                if (phonegwname ~ /^AN/)
                {
                        gwname = sprintf("SKIGW%s",substr($2,4,10))
                        if (sccpgw[gwname] == 1)
                        {
                                next
                        } else {
                                sccpgw[gwname] = 1
                        }
                } else {
                        gwname = phonegwname
                }
        } else {
                l = n2 - n1
                gwname = substr($2,n1,l)
        }
        print ipaddr, gwname, cmhost
}
' ${1} | sort -u