#ontap python sdk api for volume metrics

1 messages · Page 1 of 1 (latest)

finite olive
#

Hey Everyone , I’m trying to get volume metrics for a volume and it returns an empty list. Could you please help with with what I was doing wrong . Below is the snippet

from netapp_ontap.resources import VolumeMetrics

list(VolumeMetrics.get_collection(vol_uuid))

spice finch
#

Hi Kalyan, this is the correct way to get volume metrics. One thing that really helps is enabling debugging, described here: https://library.netapp.com/ecmdocs/ECMLP2882316/html/index.html#debugging. If you also set LOG_ALL_API_CALLS to 1, you will be able to see what requests are being made and what the output is. Couple follow up questions that would help me diagnose this ...

  1. What version of the library are you using?
  2. if you do a GET on this API using just curl, do you get any records returned?
finite olive
#

Twesha, thanks for looking into this . Here are details . ONTAP VERSION: ONTAP 9.9.1P10 . Python SDK Version: netapp-ontap==9.12.1.0 . Here’s the debug log [2023-02-28 11:13:29,897] [DEBUG] [resource:437] Key values provided for the API endpoint: 0f24930f-b3bd-11ed-b9e4-d039ea37864a
[2023-02-28 11:13:30,187] [DEBUG] [connectionpool:456] https://hostname:443 "GET /api/storage/volumes/vol-uuid/metrics HTTP/1.1" 200 163

spice finch
#

if you set utils.LOG_ALL_API_CALLS to 1, you will also see the output from the REST request in the log.

spice finch
#

Could you try using curl and run this request for the same volume uuid? If you don't get any records back, that would indicate this is an issue with ONTAP and not the library.

finite olive
# spice finch if you set utils.LOG_ALL_API_CALLS to 1, you will also see the output from the R...

GET https://<hostname>:443/api/storage/volumes/vol-uuid/metrics
User-Agent: python-requests/2.28.2
Accept-Encoding: gzip, deflate
Accept: /
Connection: keep-alive
X-Dot-Client-App: netapp-ontap-python-9.12.1.0
None

[2023-02-28 16:22:27,315] [DEBUG] [connectionpool:456] https://hostname:443 "GET /api/storage/volumes/vol-uuid/metrics HTTP/1.1" 200 163
[2023-02-28 16:22:27,315] [DEBUG] [host_connection:361]
-----------RESPONSE-----------
200 OK
Date: Wed, 01 Mar 2023 00:22:27 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors: 'self'
Content-Length: 163
Content-Type: application/hal+json
Keep-Alive: timeout=5, max=94
Connection: Keep-Alive
{
"records": [
],
"num_records": 0,
"_links": {
"self": {
"href": "/api/storage/volumes/vol-uuid/metrics"
}
}
}

finite olive
spice finch
#

Thank you Kalyan for providing this. It looks like this is not necessarily related to the python SDK, but the API itself. I have reached out to one of our internal teams who implemented the endpoint and have asked them for information on why one would not get any metrics returned. I will follow up here ASAP once I get an answer from them.