HPE OneView
1754014 Members
4448 Online
108811 Solutions
New Discussion

Re: OneView Alert Mails - Filtering out Multiple Conditions

 
SOLVED
Go to solution
NJK-Work
Honored Contributor

Re: OneView Alert Mails - Filtering out Multiple Conditions

This did not seem to work for me:

status:critical status:warning NOT alertTypeID:Trap.cpqNic3ConnectivityLost alertTypeID:Trap.cpqNicAllLinksDown

When I set it to that, I could not receive any emails alerts including that test alert generated from the iLO.  When I changed it to this:

status:critical status:warning NOT alertTypeID:Trap.cpqNic3ConnectivityLost NOT alertTypeID:Trap.cpqNicAllLinksDown

Then I could at least receive the test alert.  Going to leave it at this for a while and see how it works for actual alerts.

Thanks

NK

sbr140
New Member

Re: OneView Alert Mails - Filtering out Multiple Conditions

Any updates to documentation I have been missing. We are running 4.2 the DOCS are still bad.

 

BradV
Esteemed Contributor

Re: OneView Alert Mails - Filtering out Multiple Conditions

Not sure if this will help, but instead of trying to filter the alerts in the API call, I just extract all of the active alerts to a file, then filter then with standard shell commands.  This is on a Linux system.

# Get active alerts:
ACTIVE=$(curl --insecure \
              --header "X-API-Version: ${currentVersion}" \
              --header "auth: ${sessionID}" \
              --request GET "${OneView}/rest/alerts?start=0&count=-1&filter="\%22alertState+EQ+%27Active%27%22")
URIS=$(echo ${ACTIVE} | jq -r'.' | grep uri\"\: | grep -v count | awk '{ print $2 }' | cut -d, -f1 | cut -d\" -f2)
declare -A URI
i=0
for f in $(echo ${URIS}); do
   URI[${i}]=${f}
   ((i++))
done
j=${i}
i=0
DAT=$(date '+%d-%m-%Y')
while [ ${i} -lt ${j} ]; do
   if [[ ${URI[${i}] != *"AlertChangeLog"* ]]; then
      echo 'i = ${i}"
      curl --insecure \
           --header "X-API-Version: ${currentVersion}" \
           --header "auth: ${sessionID}" \
           --request GET ${OneView}${URI[${i}]} | jq -r '.' | tee -a alerts-${DAT}
   else
      echo "This URI is invalid in this context"
   fi
   ((i++))
done
cat alerts-${DAT} | jq -r '.description,.correctiveAction,.uri,.severity,.alertState,.resourceUri,.associatedResource.resourceName'

I can pipe that to grep or whatever I am looking for.

SullivanMarkA
Occasional Visitor

Re: OneView Alert Mails - Filtering out Multiple Conditions

This guidance does NOT seem to work for, "alertTypeID:server-hardware.opStatus.nandIssueDetected."
Need to filter these errors to ID crit issues not of this type in OneView, and if possible would like to filter from SMTP alerts.

OneView verion 5.20.01-0420365
iLO 4 version 2.75
Have already tried all steps in Document ID: c04996097

Any help would be appreciated.

ChrisLynch
HPE Pro

Re: OneView Alert Mails - Filtering out Multiple Conditions

@SullivanMarkA , I believe you are including an invalid item in the alertID value.  Remove server-hardware, as that is a category, not alertTypeID.  You can validate this by looking at the alert resource object, then expanding Details and looking at the alertTypeID field.  Can you provide a screenshot of the alert you are trying to filter, including the expanded Details section?


I am an HPE employee

Accept or Kudo