HPE OneView
1820590 Members
2443 Online
109626 Solutions
New Discussion

How to get Temperature report from OneView using API script?

 
Vinodh_Kumar_V
Senior Member

How to get Temperature report from OneView using API script?

Hello Team,

We have 40 servers in the OneView and need to download Temperature inventory for each server in Microsoft Excel.

Please share the different methods to download customized Report from OneView. Thanks!

 

3 REPLIES 3
MV3
HPE Pro

Re: How to get Temperature report from OneView using API script?

Server status is refreshed every 20 minutes when there is no event from the iLO.  If you are looking for real-time temp monitoring or data collection,it is not possible.

You will have to collect the data from individual server and insert it in excel.

Cheers....



I work at HPE
HPE Support Center offers support for your HPE services and products when and how you need it. Get started with HPE Support Center today.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
bradawk1
Trusted Contributor

Re: How to get Temperature report from OneView using API script?

You can use the OneView REST API to get authenticated to the OneView appliance.  Then useing those credentials can get credentials to log into the iLO of each server.  Once you have that, you can use the iLO Redfish API to get thermal data.  There are lots of locations.  Here is just an example:

 

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}

 

bradawk1
Trusted Contributor

Re: How to get Temperature report from OneView using API script?

I'm sorry.  Just realized I posted getting the UUID from a downloaded file of all of the OneView hardware.  In order to query OneView directly for that, substitute the UUID= line above with these two lines:

ACTV=$(python3 -c "import urllib.parse, sys; print urllib.parse.quote(sys.argv[1])"'serverName' = '${SERVER}'\"")
UUID=$(curl --insecure --header "X-API-Version: ${currentVersion}" --header "auth: ${sessionID}" --silent \
   --request GET ${OneView}/rest/server-hardware?filter=${ACTV} | jq -r '.members[] | .uuid'})