HPE OneView
1819932 Members
3579 Online
109607 Solutions
New Discussion

REST API retrieve iLO thermal data

 
SOLVED
Go to solution
BradV
Esteemed Contributor

REST API retrieve iLO thermal data

I'm trying to find the correct REST API call to retrieve the thermal data from iLOs.  I can get it via the redfish API, but would rather like to see if I can get it directly from OneView.  Using Redfish API:

i=1
TMP=$(mktemp)
for SERVER in my-server-r{1..2}-n{1..12}.myorg.com; do
   echo "Getting thermal data from ${SERVER}"
   UUID=$(jq -r '.members[] | select(.serverName=="'${SERVER}'") | "\'(.uuid)"' ${HARDW}
   read iLOSSO iLOAuth <<< $(curl --insecure --silent --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" --request GET ${OneView}/rest/server-hardware/${UUID}/remoteConsoleUrl | \
     jq -r '.remoteConsoleUrl' | sed -e 's|hplocons|https' -e 's|addr=||' -e 's|^\(.*\)&sessionkey=\(.*\)$|\1 \2')
   curl --insecure --silent --output thermal${i} --header "X-Auth-Token: ${iLOAuth}" --request GET ${iLOSSO}/redfish/v1/chassis/1/thermal
   jq '. + { "serverName": "'${SERVER}'" }' thermal${i} > ${TMP}
   cat ${TMP} > thermal${i}
   ((i++))
done
#
((i--))
j=${i}
THERMAL=thermal
CMD=""
for (( i=1; i<=${j}; i++ )); do
   CMD="${CMD} ${THERMAL}${i}"
done
cat $(echo "${CMD}") > ${THERMAL}
/bin/rm ${THERMAL}? ${THERMAL}?? ${TMP}
#
jq -r '.serverName as $name | .Temperatures[] | { "serverName": $name,"Name":.name,"PhysicalContext":.PhysicalContext,"ReadingCelsius":.ReadingCelsius }' ${THERMAL}

If anyone has insights on how to retrieve from OneView, I'd love to hear it.

4 REPLIES 4
support_s
System Recommended

Query: REST API retrieve iLO thermal data

System recommended content:

1. Advisory: HPE Integrated Lights-Out 5 (iLO 5) - HTTP GET for the iLO REST RedFish API /redfish/v1/systems/1/ethernetinterfaces/< item>/ may Return a 500 HTTP Error

 

Please click on "Thumbs Up/Kudo" icon to give a "Kudo".

 

Thank you for being a HPE valuable community member.


Accept or Kudo

BradV
Esteemed Contributor

Re: Query: REST API retrieve iLO thermal data

I have no idea whom posted that alert.  It had nothing to do with my question.  I gave a redfish example of how I retrieve iLO thermal data - not ethernet interfaces.  And I asked how to get the information through the OneView REST API and not using iLO Redfish API.

Kashyap02
HPE Pro

Re: REST API retrieve iLO thermal data

Establish a session with oneview using REST client. 

Add below headers. 

X-API-Version - 3200 (Based on OV Version)
Content Type - application/json

Add below content to Body: 

{
    "userName":"Administrator",
    "password":"Password"
}

Note: use the correct credentials. 

Use the Method as POST and URL : POST: https://<Appliance IP>/rest/login-sessions

Response should be 200 OK. 

You will get a session ID under response. 
Use the session ID and another header as below. 

Auth
<Session ID>

Then use the below command to retrieve the temperature of the server. 

https:///rest/server-hardware//utilization?fields=AmbientTemperature&view=hour

This will retrieve the Ambient Temperature of the server per hour.

You can also change the view=day. 


The output looks like this. 

{
  "refreshTaskUri": null,
  "uri": "/rest/server-hardware/",
  "resolution": 86400000,
  "sliceStartTime": "2022-11-16T00:00:00.000Z",
  "sliceEndTime": "2022-11-25T00:00:00.000Z",
  "newestSampleTime": "2022-11-24T07:40:00.000Z",
  "oldestSampleTime": "2022-11-16T03:45:00.000Z",
  "isFresh": true,
  "metricList": [{
    "metricName": "AmbientTemperature",
    "metricSamples": [
      [1669248000000, 22],
      [1669161600000, 21],
      [1669075200000, 21],
      [1668988800000, 16],
      [1668902400000, 19],
      [1668816000000, 22],
      [1668729600000, 18],
      [1668643200000, 17],
      [1668556800000, 20]
    ],
    "metricCapacity": 35
  }]
}

You can also try : https:///rest/server-hardware//environmentalConfiguration

 

But this will not give you each and every sensor temperature as we see in ILO REST. 

Hope this helps.

I am a HPE Employee.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

Accept or Kudo

BradV
Esteemed Contributor
Solution

Re: REST API retrieve iLO thermal data

Thanks for that.  However, it only gives the inlet ambient temperature.  That only tells me how warm the air is going in to the server.  Also, there is an error in the documentation: OneView REST API Reference 4200 .  It shows using serial number:

 

GET  https://{appl}/rest/server-hardware/USE7335NW3/utilization

 

It needs to the the UUID.  I think the answer appears to be that OneView does not pull this temperature data back.

Thanks!