====== HMC using Rest API ====== HMC REST web services operate on 12443 HTTP Port. The following URL is an example of the full URL that must be used to get the management console information: https://:12443/rest/api/uom/ManagementConsole \\ https://:12443/rest/api/uom/ManagedSystem https://aix4admins.blogspot.com/2018/08/api-hmc.html https://ftpmirror.your.org/pub/misc/ftp.software.ibm.com/systems/power/docs/hw/p9/p9ehl.pdf ==== Initiate a new RestAPI session ==== Create a file **login.xml** hscroot abc123 First login to create a cokies.txt file HMC=hmcp9 curl -k -c cookies.txt -i -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_test" -d @login.xml https://$HMC:12443/rest/api/web/Logon ==== Kill the RestAPI session ==== First login to create a cokies.txt file HMC=hmcp9 curl -k -c cookies.txt -b cookies.txt -X "DELETE" https://$HMC:12443/rest/api/web/Logon ==== List partitions ==== # curl -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://$HMC:12443/rest/api/uom/LogicalPartition ==== List Managed system / Power Servers ==== # curl -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://$HMC:12443/rest/api/uom/ManagedSystem ==== Get temperature on the Power servers ==== Get Power9 system ID: [root@lnx01 ~]# curl -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://$HMC:12443/rest/api/uom/ManagedSystem > toto [root@lnx01 ~]# cat toto | egrep '|SystemName' 38xxxxxx-140b-30f2-8544-7xxxxxxxx4b3 f0xxxxxx-c7c9-38f3-8f99-6xxxxxxxx58a p9-SiteA 3exxxxxx-7ac6-325d-9f15-3xxxxxxxxdd3 p9-SiteB Use now the ID of both P9 to get the list of json files # curl -k -c cookies.txt -b cookies.txt -H "Accept: application/atom+xml; charset=UTF-8" https://hmcp9:12443/rest/api/pcm/ManagedSystem/f0xxxxxx-c7c9-38f3-8f99-6xxxxxxxx58a/RawMetrics/EnergyMonitor/ f0xxxxxx-c7c9-38f3-8f99-6de73b35758a 2025-10-22T16:38:30.000+02:00 EnergyMonitorMetrics ManagedSystem f0xxxxxx-c7c9-38f3-8f99-6de73b35758a 8bdaf564-ad40-4c3a-be9b-3d5f506ebd7b 2025-10-22T15:46:00.000+02:00 LTM_9009-22A*78xxxx0_fsp_20251022T154600+0200.json 2025-10-22T15:46:00.000+02:00 IBM Power Systems Management Console 11ba3435-47a5-406e-b315-5979210a9b4b 2025-10-22T15:46:30.000+02:00 LTM_9009-22A*78xxxx0_fsp_20251022T154630+0200.json 2025-10-22T15:46:30.000+02:00 IBM Power Systems Management Console .... Get one json file (you need to accept JSON), and read it using **jq** JSON parser # curl -k -c cookies.txt -b cookies.txt -X GET -H "Accept: application/json" https://hmcp9:12443/rest/api/pcm/ManagedSystem/f0xxxxxx-c7c9-38f3-8f99-6xxxxxxxx58a/RawMetrics/EnergyMonitor/LTM_9009-22A*78xxxx0_fsp_20251022T154630+0200.json | jq . % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1306 0 1306 0 0 39575 0 --:--:-- --:--:-- --:--:-- 39575 { "timeStamp": "2025-10-22T15:46:30+0200", "status": 0, "errorInfo": [], "utilInfo": { "version": "1.0.0", "metricType": "Raw", "monitoringType": "LTM", "mtms": "9009-22A*78xxxx0", "name": "p9-SiteB" }, "powerEnergyReading": { "currentPowerReading": 700, "minimumPowerReading": 700, "maximumPowerReading": 700, "averagePowerReading": 700, "ipmiTimeStamp": "Wed Oct 22 15:52:09 2025", "reportingPeriod": 30, "powerReadingState": "activated" }, "thermalEnergyReading": { "inletTemperatures": [ { "entityId": "Inlet air temperature(40h)", "entityInstance": "1", "temperatureData": 27 } ], "cpuTemperatures": [ { "entityId": "CPU temperature sensors(41h)", "entityInstance": "1", "temperatureData": 60 }, { "entityId": "CPU temperature sensors(41h)", "entityInstance": "2", "temperatureData": 68 } ], "baseboardTemperatures": [ { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "1", "temperatureData": 47 }, { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "2", "temperatureData": 46 }, { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "3", "temperatureData": 45 }, { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "4", "temperatureData": 48 }, { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "5", "temperatureData": 49 }, { "entityId": "Baseboard temperature sensors(42h)", "entityInstance": "6", "temperatureData": 48 } ] } } ====== SNMP ====== Question How to configure HMC SNMP? Answer The HMC does not support being managed by an external SNMP application/agent. The only SNMP related features available on the HMC is the ability to send a SNMP traps (short notification messages) to an external server.