HPE OneView
1833758 Members
2510 Online
110063 Solutions
New Discussion

Finding the reason for profile non-compliance

 
bradawk1
Trusted Contributor

Finding the reason for profile non-compliance

We have several hundred profiles which show in OneView being non-compliant with iLO settings.  Trying to re-apply through the gui is just a lot of clicking and would take quite a while.  I can extract all of the profiles using the REST API and store in a file with variable PROF pointing to it.

I can find the non-compliant profiles with:

jq -r '.members[] | select(.templateCompliance=="NonCompliant")' ${PROF}

however in the output, I can't identify the reason each profile is non-compliant.

I'm getting the profiles with:

curl --insecure --silent \
       --header "X-API0Version: ${currentVersion}" \
       --header "auth: ${sessionID}" \
       --output ${PROFN} \
       --request GET ${OneView}/rest/server-profiles
#
# And then looping through using nextPageUri until nextPageUri is null.

Anyone have an idea how I determine if the non-compliance is due to iLO settings?

1 REPLY 1
bradawk1
Trusted Contributor

Re: Finding the reason for profile non-compliance

Anyone from HPE know how to determine the source of the alert?  Trying to identify the ones non-compliant due to iLO settings.  Here is the complete code of how I download the alerts:

# We have multiple sites.  So, I set a site variable so that I can run the same commands
# simultaneously in multiple terminals.
SITE='<site name>'
ALERTN=alert-${SITE}
ACTV=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "\"alertState EQ 'Active'\"")
curl --insecure \
     --header "X-API-Version: ${currentVersion}" \
     --header "auth: ${sessionID}" \
     --output ${ALERTN} \
     --request GET ${OneView}/rest/alerts?start=0&count=-1&filter=${ACTV}
#
# That only pulls down 25 alerts.  Pull down the rest with:
i=1
NEXT=$(jq -r '.nextPageUri' ${ALERTN} | sed -e "s|\(.*filter=\).*|\1${ACTV}|")
while [[ ${NEXT} != *"null"* ]]; do
   curl --insecure \
        --header "X-API-Version: ${currentVersion}" \
        --header "auth: ${sessionID}" \
        --output ${ALERTN}${i} \
        --request GET ${OneView}${NEXT}
   NEXT=$(jq -r '.nextPageUri' ${ALERTN}${i} | sed -e "s|\(.*filter=\).*|\1${ACTV}|")
   ((i++))
done
# Concantenate into a single file.
j=0
while [[ ${j} -t ${i} ]]; do
   echo ${j}
   if [[ ${j} -eq 0 ]]; then
      CMD="cat ${ALERTN}"
   else
      CMD="${CMD} ${ALERTN}${j}"
   fi
   ((j++))
done
$(echo ${CMD} > alert-all-raw-${SITE})
cat alert-all-raw-${SITE} | jq -r '.' > alert-${SITE}-all
ALERTS=alert-${SITE}-all
/bin/rm alert-${SITE} alert-${SITE}? alert-${SITE}[1-9]? alert-all-raw-${SITE}