manageiq icon indicating copy to clipboard operation
manageiq copied to clipboard

How to get OCP cluster metrics using curl api

Open sandesh-dev opened this issue 2 years ago • 4 comments

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. image

sandesh-dev avatar Jan 08 '24 06:01 sandesh-dev

Does this help @sandesh-dev? https://www.manageiq.org/docs/reference/latest/api/reference/metric_rollups.html

Fryguy avatar Jan 17 '24 18:01 Fryguy

@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 ?

sandesh-dev avatar Jan 23 '24 07:01 sandesh-dev

I'm surprised curl would respond with that, since it's an API endpoint - do you see anything with /api/providers/3 ?

Fryguy avatar Jan 24 '24 18:01 Fryguy

/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": [
       ]
}``` 

sandesh-dev avatar Jan 25 '24 16:01 sandesh-dev

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.

Fryguy avatar Apr 10 '24 13:04 Fryguy

enhancement: https://github.com/ManageIQ/manageiq-api/pull/1258

kbrock avatar Apr 11 '24 14:04 kbrock

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.

Fryguy avatar Apr 12 '24 21:04 Fryguy