HMC

 View Only
Expand all | Collapse all

Querying the Power9 Systems via HMC API

  • 1.  Querying the Power9 Systems via HMC API

    Posted Mon January 04, 2021 09:22 AM

    Hi All,

    I require some assistance. I've recently been tasked with getting the status of some of the Hardware via the HMC REST API, and i've been unsuccessful in authenticating to the API Endpoint, as i might not be sending the correct Headers through.

    If possible, does anyone have any pointers on how to authenticate to the endpoint via Postman? Also, if anyone has any idea if i can get this information via the HMC SSH CLI commands, that would also be helpful.

    Thanks

    Andre.



    #HMC
    #Support
    #SupportMigration


  • 2.  RE: Querying the Power9 Systems via HMC API

    Posted Mon January 04, 2021 10:28 AM

    Hello,

    I'm not using Postman so I can't give any advise there, but this is how I do it with curl:

    HmcAuth_url=https://<your.hmc.address>:12443/rest/api/web/Logon HmcAuth_user=<USER> HmcAuth_password="<PASSWORD>" HmcAuth_Cookies=/tmp/cookies.txt HmcAuth_header=/tmp/httpheader /bin/curl -sk -c ${HmcAuth_Cookies} -X PUT \ -H 'Content-Type: application/vnd.ibm.powervm.web+xml; type=LogonRequest' \ -H 'Accept: application/vnd.ibm.powervm.web+xml; type=LogonResponse' \ -H 'X-Audit-Memento: hmc_logon_via_curl' \ -d "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><LogonRequest xmlns=\"http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/\" schemaVersion=\"V1_0\"> <UserID>${HmcAuth_user}</UserID> <Password>${HmcAuth_password}</Password></LogonRequest>" \ ${HmcAuth_url}

    You'll want to use the cookie file in your further calls (-b and -c flags for curl), as it contains your session authentication info.

    You can also gather the data you need over HMC cli (over ssh), most likely you'll want lssyscfg and lshwres commands (hard to tell without knowing what exactly do you want to collect).

    Cheers



    #HMC
    #Support
    #SupportMigration


  • 3.  RE: Querying the Power9 Systems via HMC API

    Posted Mon January 04, 2021 10:37 AM

    Hi Donatas,

    Thanks alot for your reply.

    The API request you posted makes sense, but i dont think its something i would be able to use seeing as you mentioned it has a Cookies file requirement. We are using a monitoring tool called Sciencelogic, and we cannot create a cookies.txt file for each REST Request we do for monitoring.

    So the preferred method for us would be to do monitoring via the HMC CLI, i can actually give you the 4 metrics we want for the hardware:

    *Size of the CPU (Cores & Clock Frequency) & Memory (Size)

    *CPU Utilisation %

    *Memory Utilisation %

    I really appreciate your assistance!



    #HMC
    #Support
    #SupportMigration


  • 4.  RE: Querying the Power9 Systems via HMC API

    Posted Mon January 04, 2021 12:44 PM

    Hello,


    I would really encourage you to take a look at the man pages of the commands to fine tune the data you want to pull. Quick examples could be:


    • LPAR CPU sizing info (Entitlement and VCPU) for all LPARs of a managed system (MS=ManagedSystemName)


    lshwres -m ${MS} -r proc --level lpar -F lpar_name,curr_proc_units,curr_procs


    • LPAR allocated memory for all LPARs on a managed system:


    lshwres -m ${MS} -r mem --level lpar -F lpar_name,curr_mem


    • LPAR CPU utilisation:


    lslparutil -m ${MS} -r lpar --filter "lpar_ids=1" -n 1 -F time,lpar_id,capped_cycles,idle_cycles,time_cycles


    ..etc






    #HMC
    #Support
    #SupportMigration