cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1970
Views
0
Helpful
4
Replies

perfmon APi did not work with Python

Hi, community!

I have tried to collect perfmonCollectCounterData info from my Cisco Unified Communication Manager via Perfmon API.

But I have got next error:

'<?xml version=\'1.0\' encoding=\'UTF-8\'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>Query counter data failed. Error=9 ErrorMsg=null</faultstring><detail /></soapenv:Fault></soapenv:Body></soapenv:Envelope>'

But other operation, for example, perfmonOpenSession works.

This is Python script:

import requests

from requests.auth import HTTPBasicAuth

def run():

    url="https://CUCM_IP:8443/perfmonservice2/services/PerfmonService?wsdl"

    headers = {'content-type': 'text/xml', 'SOAPAction': "http://schemas.cisco.com/ast/soap/action/#PerfmonPort#perfmonCollectCounterData"}

    body ="""

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.cisco.com/ast/soap">

   <soapenv:Header/>

   <soapenv:Body>

      <soap:perfmonCollectCounterData>

         <soap:Host>CUCM_IP</soap:Host>

         <soap:Object>Cisco CallManager</soap:Object>

      </soap:perfmonCollectCounterData>

   </soapenv:Body>

</soapenv:Envelope> """

    response = requests.post(url,data=body,headers=headers,verify=False,auth=HTTPBasicAuth("USER", "PASSWORD" ))

    print response

    import pdb;pdb.set_trace()

if __name__ == "__main__":

    run()

Could you please help me with this issue.

4 Replies 4

Geevarghese Cheria
Cisco Employee
Cisco Employee

Hi Andrii,

   Moving your question under UC Manager Serviceability community for getting more visibility of the support engineers.

Thanks and Regards,

Geevarghese

npetrele
Cisco Employee
Cisco Employee

This is a Python and Requests issue.  I suggest you find out who supports Requests and ask them.  You'll need to show them the Perfmon WSDL so they can try to figure out why it's not interpreting your request correctly.

dstaudt
Cisco Employee
Cisco Employee

Your Python code seems to work unchanged against my CUCM 10.5 lab system.

If there is an internal issue with the RIS component (or something else in CUCM), it's possible that restarting the CUCM may correct it (not ideal, of course.)  I would recommend opening a ticket with DevNet developer support for detailed troubleshooting: Cisco DevNet: DevNet Developer Support

dwasserzug1
Level 1
Level 1

Hello zadorojnuiandriu,

I have also encountered this issue. In my case, the "Query counter data failed. Error=9 ErrorMsg=null" was because the element "Host" was incorrect (did not exist) for the "perfmonCollectCounterData" name space. In other words, I had the "<soap:Host>...</soap:Host>" part wrong. I suggest you check your "<soap:Host>CUCM_IP</soap:Host>" as you probably have the same problem.

To find the correct value, go to the Cisco Unified CM Administration and navigate to System -> Server. Find what the IP or hostname is there. FYI, you don't need to use the FQDN. For example you can use "<soap:Host>cucm1</soap:Host>" where you have "cucm1.example.com" configured, but you cannot use the same when you have "cucm1-something-else.example.com". Similarly, you can use IPv4, provided that the address is the same.

Thank you,

Dominic D. Wasserzug

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: