WebSphere Application Server & Liberty

 View Only
Expand all | Collapse all

How to get PMI data on TWAS

  • 1.  How to get PMI data on TWAS

    Posted Sun January 29, 2023 02:41 PM
    Hi,
    is there anyway to monitor PMI data on TWAS using JMX API without using the AdminClient Interface,
    I am writing the code in Java language?

    If MbeanServerDelegate can help me to achieve this goal , i am happy if you share examples of how to do?

    Thanks
    Sharbel 



    ------------------------------
    Sharbel Nasra
    ------------------------------


  • 2.  RE: How to get PMI data on TWAS

    IBM Champion
    Posted Sun January 29, 2023 05:14 PM
      |   view attached
    Hi,

    If you are running newer versions, you should give metrics app a try, it is based on prometheus and only require activating PMI :


    Hope it helps
    --
    Best regards, 

    Walid Largou
    Solution Architect / IBM Champion
    Power Maroc
    Mobile : +212 621 31 98 71
    320 Bd Zertouni 6th Floor, Casablanca, Morocco


    This message is confidential .Its contents do not constitute a commitment by Power Maroc S.A.R.L except where provided for in a written agreement between you and Power Maroc S.A.R.L. Any authorized disclosure, use or dissemination, either whole or partial, is prohibited. If you are not the intended recipient of the message, please notify the sender immediately.






  • 3.  RE: How to get PMI data on TWAS

    IBM Champion
    Posted Mon January 30, 2023 03:06 AM
    Hello Sharbel,
    sure it should be possible to retrieve the PMI data via JMX but why not use the simple Metrics App as mentioned by @Largou walid and just scrap the data into Prometheus?
    If your TWAS is too old to be supported my Metrics App you could consider using the Performance Servlet to keep things simple (unless you are eager to use JMX).

    Hope that helps, Hermann


    ------------------------------
    Hermann Huebler
    2innovate IT Consulting GmbH
    Vienna
    Austria

    #IBMChampion
    ------------------------------



  • 4.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 05:39 AM
    Hi Hermann,
    I am running as JMX client in standalone JVM, my goal to write a function to gather PMI data from the existing JMX client, I have already gathered JMX data
    for the registered/standards Mbeans (like Mempools MXbean), and got connection using the JRMP port, the question if i can get PMI data using the JRMP port connection.
    BTW, I am trying different ways to figure out.

    Thanks,
    Sharbel

    ------------------------------
    Sharbel Nasra
    ------------------------------



  • 5.  RE: How to get PMI data on TWAS

    Posted Mon January 30, 2023 04:58 AM
    Lot of good answers above.  I wrote a small app some years ago that collects some stats and saves them into the tWAS distributed cache that can then be read and used as needed.

    https://github.com/bpaskin/JavaExamples/tree/master/DistributedPMI

    Brian

    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 6.  RE: How to get PMI data on TWAS

    IBM Champion
    Posted Mon January 30, 2023 05:50 AM
    Hello Sharbel,

      You alternative ways to obtain PMI data from @Largou walid and @Hermann Huebler  answers.

      A practical example of get data through java program suggested by @Brian S Paskin 

      An here oficial documentation links:

      https://www.ibm.com/docs/en/was/9.0.5?topic=health-custom-pmi-api

      https://www.ibm.com/docs/en/was/9.0.5?topic=health-developing-your-own-monitoring-applications ​​​

      Hope this helps. Tell us if you need more support.

    Regards

      Gabriel Aberaturi.

    ------------------------------
    Gabriel Aberasturi
    Versia Sistemas TI
    ------------------------------



  • 7.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 05:21 AM
    hi ,
    I think the best option to go with is retrive PMI data using the PerfServletApp, but when i tried to invoke the http request, i got this SSLException:

    CWPKI0022E: SSL HANDSHAKE FAILURE: A signer with SubjectDN "CN=ASCR1.WSDMGR, OU=CB390, O=IBM" was sent from target host:port "172.2
    4.48.167:10141". The signer may need to be added to local trust store "safkeyring:///WASKeyring" located in SSL configuration alias
    "CellDefaultSSLSettings" loaded from SSL configuration file "security.xml". The extended error message from the SSL handshake exce
    ption is: "PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid C
    ertPath.; internal cause is:
    java.security.cert.CertPathValidatorException: The certificate issued by CN=WAS CertAuth for Security Domain, OU=DEVA is not truste
    d; internal cause is:
    java.security.cert.CertPathValidatorException: Certificate chaining error".
    CWPKI0428I: The signer might need to be added to the local trust store. You can use the Retrieve from port option in the administrat
    ive console to retrieve the certificate and resolve the problem. If you determine that the request is trusted, complete the followin
    g steps: 1. Log into the administrative console. 2. Expand Security and click SSL certificate and key management. Under Configurati
    on settings, click Manage endpoint security configurations. 3. Select the appropriate outbound configuration to get to the (cell):DC
    855 management scope. 4. Under Related Items, click Key stores and certificates and click the CellDefaultTrustStore key store. 5. Un
    der Additional Properties, click Signer certificates and Retrieve From Port. 6. In the Host field, enter 172.24.48.167 in the host
    name field, enter 10141 in the Port field, and 172.24.48.167_cert in the Alias field. 7. Click Retrieve Signer Information. 8. Ver
    ify that the certificate information is for a certificate that you can trust. 9. Click Apply and Save.
    execute - caught PrivilegedActionException in initAdminnull
    java.security.PrivilegedActionException: com.ibm.websphere.management.exception.AdminException: com.ibm.websphere.management.excepti
    on.ConnectorNotAvailableException
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5520)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
    at com.ibm.ws.pmi.perfServlet60.PerformanceServlet.initAdmin(PerformanceServlet.java:324)
    at com.ibm.ws.pmi.perfServlet60.PerformanceServlet.doPost(PerformanceServlet.java:108)
    at com.ibm.ws.pmi.perfServlet60.PerformanceServlet.doGet(PerformanceServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
    at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
    at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
    at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1227)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:776)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:458)

    The problem that I go through the steps using WAS admin console but WAS admin console didn't let me to do the change because its Read only , any idea how to solve this problem? 


    ------------------------------
    Sharbel Nasra
    ------------------------------



  • 8.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 05:35 AM
    If you are not able to make changes in the tWAS Console, it means that you are not granted an admin role.  You need someone with an admin role to add you to the admin group. In the console it is on the left side under users and groups.

    Brian

    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 9.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 05:56 AM
      |   view attached
    Hi Brian,
    I got this error message:CWPKI0699E: The CellDefaultTrustStore keystore is marked as a read-only access. The Application Server cannot write data to this keystore file.
    attached the screen shot.

    ------------------------------
    Sharbel Nasra
    ------------------------------



  • 10.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 06:01 AM
    You need to remove the check mark that makes this only a readable keystore (read only).  

    Brian

    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 11.  RE: How to get PMI data on TWAS

    Posted Tue January 31, 2023 06:25 AM
    Thanks a lot , it helps.

    ------------------------------
    Sharbel Nasra
    ------------------------------



  • 12.  RE: How to get PMI data on TWAS

    Posted Fri February 03, 2023 06:27 PM
    hi,
    I tried to establish JMX connection to WAS using JMX Client, and I connected using this URL :
    this.jmxServiceUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"+host+":"+jmxPort+"/WsnAdminNameService#JMXConnector"+jmxPort);
    I see that the connection is succeded but when i tried to query all the "WebSphere:*" , i got only 2 Mbeans(LeakAdmin and LeakConfig) , I expected to have the PerfMbean but i didn't get that, any one can help on this?

    code +result:
    try {
    //trying to query all the websphere Mbeans 
    String query = "WebSphere:*";
    ObjectName queryName = new ObjectName(query);
    Set s = mbSrvConn.queryNames(queryName, null);
    Iterator<ObjectName> namesIterator=s.iterator();
    if (s.isEmpty()==true)
    {
    GlobalBean.mjeWTO("emptyMbeans",'D');
    }
    while (namesIterator.hasNext()) {
    nodeAgent = (ObjectName)namesIterator.next();

    GlobalBean.mjeWTO("PerfMbean mbean found "+ nodeAgent.toString(),'D');
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    result:
    PerfMbean mbean found WebSphere:type=MemoryLeakAdmin,name=LeakAdmin
    PerfMbean mbean found WebSphere:type=MemoryLeakConfig,name=LeakConfig

    Thanks
    Sharbel

    ------------------------------
    Sharbel Nasra
    ------------------------------



  • 13.  RE: How to get PMI data on TWAS

    Posted Sat February 04, 2023 06:21 PM
    I have always used the AdminService client, however, you will need to access the service with credentials.  Once you do, you can get a perf bean with WebSphere:node=<nodename>,process=<servername>,type=Perf,*

    Brian


    ------------------------------
    Brian S Paskin
    Sr. Technology Engineer
    IBM Cloud Engineering
    ------------------------------



  • 14.  RE: How to get PMI data on TWAS

    Posted Thu February 09, 2023 02:38 PM

    Hi,

    Finally I know how to get all websphere MBeans, now the question how to access the operations and attributes of the PerfMbean in JMX, Any ideas?

    II know how to access Mbean from Liberty but in TWAS I don't know , need clarification 



    ------------------------------
    Sharbel Nasra
    ------------------------------