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

Help to get the "Cisco Tomcat Web Aplication (vmrest)" counter using Python.

Hi guys,

I am trying to create a python program to get the "(Cisco Tomcat Web Application (vmrest)" counter from RTMT, I have created a code that gives me most of the instances for the Object, but it is truncated.

 

Could you please help me to do it a little bit easier, I just need the Instance (vmrest).

This is what I am looking at.

2020-08-17_12-43-13.png

 

Trying to do my code, but only give me partial return of the AXL.text

 

import requests
import urllib3
import os
from dotenv import load_dotenv
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)



# Load enviroment variables
BASEDIR = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(BASEDIR, '.env'))

user = os.environ.get('CISCOUSER')
password = os.environ.get('PASS')

soapheaders = {'Content-type':'text/xml', 'SOAPAction':'PerfmonService'}
# Prepare the POST request for

xmlns = """
<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>HOST</soap:Host>
        <soap:Object>Cisco Tomcat Web Application</soap:Object>
    </soap:perfmonCollectCounterData>
</soapenv:Body>
</soapenv:Envelope>
"""
# uncomment to print the payload
# print(xmlns)
AXLRequest = requests.post('https://HOST:8443/perfmonservice2/services/PerfmonService', data = xmlns, headers = soapheaders, verify = False, auth=(user,password))

# Create the xml tree
# root = xml.dom.minidom.parseString(AXLRequest.text)
print(AXLRequest.text)

This is the result

 

... output omitted...
</ns1:perfmonCollectCounterDataReturn>
            <ns1:perfmonCollectCounterDataReturn>
                <ns1:Name>\\HOST\Cisco Tomcat Web Application(concerto)\Requests</ns1:Name>
                <ns1:Value>0</ns1:Value>
                <ns1:CStatus>1</ns1:CStatus>
            </ns1:perfmonCollectCounterDataReturn>
            <ns1:perfmonCollectCounterDataReturn>
                <ns1:Name>\\HOST\Cisco Tomcat Web Application(concert <<--- It truncates in here, no more text

Could you please help me just to get that specific VMREST counter?

0 Replies 0