HPE OneView
1748102 Members
5324 Online
108758 Solutions
New Discussion юеВ

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

 
SOLVED
Go to solution
RussF
Occasional Contributor

Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be found

I am trying to remove my cleared events.  I have 75000 of them.  I continually get this error

PS E:\Install> Get-HPOVAlert -State cleared -Count 10
Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be found. Provide a valid alert URI.
At line:1 char:1
+ Get-HPOVAlert -State cleared -Count 10
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (URI:String) [Get-HPOVAlert], ResourceNotFoundException
+ FullyQualifiedErrorId : ResourceNotFound,Get-HPOVAlert

PS E:\Install>

I have OneView 4.10.04 installed
POSH HPE.OneView.4.10.1928.2181.PowerShell.Library.exe installed

PS E:\Install> $PSVersionTable.PSVersion

Major Minor Build Revision
----- ----- ----- --------
5         1          14409      1018

running on Windows 2012 R2 Standard

 

Any help on how to remove this corrupted entry or continue on would be appreciated.

6 REPLIES 6
m_icha
HPE Pro

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

Hello  RussF,

Just to have a better understanding of the issue you face, is there an a warning message that you received or you just trying to clear some events for a reason? Furthermore, what is the status (active, locked) of your events?

m_icha

I'm an HPE Employee
Need assistance? Contact HPE Support
How to Say Thank You? Just click the KUDOS!
BradV
Esteemed Contributor

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

I don't have any Windows system.  Using curl instead.  I also have that alert, but it is automatically cleared by the system.  I think yours should be also?

If I retrieve a list of all alerts, I see it in the results:

ALERTS=$(curl --insecure \
--header "content-type: application/json" \
--header "accept: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/alerts?start=0&count=-1)

(currentVersion is set to 800, sessionID is set to my current session ID, and OneView is set to the URI to my appliance)

In the return, I see the alert.  healthCategory is Appliance; alertTypeID is Alerts.DBMaxCapacity.  I would think I could retrieve the specific alert with:

ALERTS=$(curl --insecure \
--header "content-type: application/json" \
--header "accept: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/alerts?start=-&count=3&filter="healthCategory EQ 'Appliance'"&filter="alertTypeID EQ 'Alerts.DBMaxCapacity'")

but it retrieves a whole bunch and not just this type.  I have a whole slew of alerts related to a root CA certificate that is invalid in FIPs mode.  I'd like to just delete them all and remove that certificate (I have another post opened related to that).  I'll keep watching to see if you find a way using the powershell commands to clear.  If so, it should point me to the correct REST API command.  :)

Henry_B
Occasional Advisor

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

I ran the same command you did and I received my 10 cleared alerts. My OneView is 4.10.03 (unable to test 4.10.4 yet) and I am using POSH HPE.OneView.4.10.1928.2185.PowerShell.Library.exe.

I suggest upgrading the PowerShell OneView module to the latest. You can also run the below command to see if you get the alerts you want:

Send-HPOVRequest -uri /rest/alerts?start=0'&'count=10'&'sort=created:ascending'&'filter="alertState EQ 'Cleared'"

This is the REST API call. If it returns alerts the issue might be with the command Get-HPOVAlert, but if it fails then it might be the OneView version IMO.

 

RussF
Occasional Contributor
Solution

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

Hi there, I had 75000 alerts that I wanted to clear out.  I get an error for what appears to be one specific alert.  I found that is I specified a /Start time the day after the event, that I was able to clear the bulk of them.  I then used a /end and set it to the day before the alert.  So now I have what appears to be one bad alert.  I can't seem to look it up or see in the GUI.  OneView is working just fine and I had a runaway authentication issue with an iLO (caused by another app) and wanted to clear the 1000's of alerts out of OneView.  So I still have the bad alert in OneView, but I do have a work around.

RussF
Occasional Contributor

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

Hi the Get-HPOVAlert command fails

PS C:\> Get-HPOVAlert
Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be found. Provide a valid alert URI.
At line:1 char:1
+ Get-HPOVAlert
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (URI:String) [Get-HPOVAlert], ResourceNotFoundException
    + FullyQualifiedErrorId : ResourceNotFound,Get-HPOVAlert

The command you gave me did return data

PS C:\> Send-HPOVRequest -uri /rest/alerts?start=0'&'count=10'&'sort=created:ascending'&'filter="alertState EQ 'Cleared'"


type                : AlertResourceCollectionV3
uri                 : /rest/alerts?start=0&count=10&sort=created:ascending&filter=alertState EQ 'Cleared'
category            : alerts
eTag                :
created             : 2019-01-28T19:12:30.420Z
modified            : 2019-01-28T19:12:30.420Z
start               : 0
count               : 10
total               : 158
prevPageUri         :
nextPageUri         : /rest/alerts?start=10&count=10&sort=created:ascending&filter=alertState EQ 'Cleared'
members             : {@{type=AlertResourceV3; uri=/rest/alerts/7354; category=alerts; eTag=2018-01-04T20:31:44.604Z;
                      created=2018-01-04T20:31:41.147Z; modified=2018-01-04T20:31:44.604Z; associatedEventUris=System.Object[]; resourceID=;
                      assignedToUser=; activityUri=; changeLog=System.Object[]; clearedByUser=System; clearedTime=2018-01-04T20:31:44.604Z;
                      correctiveAction=Update the OneView trust store with a valid server iLO certificate using the link below. Refresh the server

    [...] about 20 lines of data returned but trimmed out

alertSeverityCounts :

Not quite sure what to do with this or if its the magical '/rest/alerts/7353' that i am trying to get rid of.

ProjectOsiris
New Member

Re: Cannot clear events, Get-HPOVAlert : The requested resource '/rest/alerts/7353' could not be f

I too stumbled upon this issue with five of the OneVIew servers I manage. After picking the nuggets out of this thread, I cobbled a function together that will allow the user to run through their cleared events in chunks as small as one day, as far back as he/she needs to go, and keep as many or as few cleared alerts as desired.

Function defaults to four years seek-back, one day granularity, and 30 days retained (YMMV on the retention - you might get a day more or less than specified).

function Clear-HPOneViewAlerts {
  param(
    # Seek duration (how many days to go back)
    [Parameter(Mandatory = $False)]
    [Alias('S')]
    [int]$SeekDays = (365 * 4),
    
    # Interval to process (smaller blocks process quicker and guarantee more deletions when there are bad alerts)
    [Parameter(Mandatory = $False)]
    [Alias('I')]
    [int]$Interval = 1,

    # Max age of cleared events to keep
    [Parameter(Mandatory = $False)]
    [alias('K')]
    [int]$MaxAge = 30
  )
  
  $S = $SeekDays #How many days to go back
  $I = $Interval #Interval
  $K = $MaxAge #How many days to keep
  $E = $S - $I
  for ($S ; $E -ge $K$S -= $I) {
    $E = $S - $I
    $StartDate = (Get-Date).AddDays(-$S)
    $SD = "$($StartDate.Year)-$($StartDate.Month)-$($StartDate.Day)"
    $EndDate = ((Get-Date).AddDays(-$E))
    $ED = "$($EndDate.Year)-$($EndDate.Month)-$($EndDate.Day)"
    Write-Host "Processing Alerts: Starting $SD ; Ending $ED"
    $null = Get-HPOVAlert -AlertState 'Cleared' -Start $SD -End $ED | Remove-HPOVAlert -Force -Confirm:$false
  }
  
}