How to get OCP cluster metrics using curl api
I have integrated OCP cluster in ManageIQ. From UI, I am able to see cluster utilisation details but I want same data to be availbale using curl request. Can you please help me with curl api to fetch cluster utilisation.
Does this help @sandesh-dev? https://www.manageiq.org/docs/reference/latest/api/reference/metric_rollups.html
@Fryguy thanks for reply but when I am trying /api/providers/3/metric_rollups it gives me The page you were looking for doesn't exist
Does metrics_rollups support openshift providers ?
I'm surprised curl would respond with that, since it's an API endpoint - do you see anything with /api/providers/3 ?
/api/providers/3
yes I see below data with endpoint api/providers/3 endpoint
curl --user username:password --insecure --request GET --header "Content-Type: application/json" https://xx.xx.xx.xx:xxxx/api/providers/3 | python3 -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1504 0 1504 0 0 958 0 --:--:-- 0:00:01 --:--:-- 960
{
"href": "https://xx.xx.xx.xx:xxxx/api/providers/3",
"id": "3",
"name": "maximo-sample-test1",
"created_on": "2024-01-12T09:23:35Z",
"updated_on": "2024-01-25T16:00:34Z",
"guid": "xxxxxxxxxxxxxxxxxxxxxxx",
"zone_id": "2",
"type": "ManageIQ::Providers::Openshift::ContainerManager",
"api_version": "4.12.44",
"uid_ems": "xxxxxxxxxxxxxxxxxxxxx",
"host_default_vnc_port_start": null,
"host_default_vnc_port_end": null,
"provider_region": null,
"last_refresh_error": null,
"last_refresh_date": "2024-01-25T16:00:34Z",
"provider_id": null,
"realm": null,
"tenant_id": "1",
"project": null,
"parent_ems_id": null,
"subscription": null,
"last_metrics_error": null,
"last_metrics_update_date": "2024-01-25T16:00:31Z",
"last_metrics_success_date": "2024-01-25T16:00:31Z",
"tenant_mapping_enabled": null,
"enabled": true,
"options": null,
"zone_before_pause_id": null,
"last_inventory_date": null,
"capabilities": {},
"last_refresh_success_date": null,
"actions": [
]
}```
it sounds like metric_rollups is not defined as a subcollection on providers? I thought it was. @kbrock can you take a look at this one.
enhancement: https://github.com/ManageIQ/manageiq-api/pull/1258
Switched this to an enhancement request, since it never existed before, but was completed in https://github.com/ManageIQ/manageiq-api/pull/1258. @sandesh-dev if you can try with master code, you can see if this new subcollection on a provider works for you.