- Community Home
- >
- Software
- >
- HPE OneView
- >
- closing an alert
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2019 04:23 AM
08-06-2019 04:23 AM
I can retrieve active alerts with:
ACTIVE=$(curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET ${OneView}/rest/alerts?start=0&count=-1&filter="alertState EQ 'Active'")
Some of the alerts are on older servers that are no longer under maintenance. I'm trying to clear the alert with:
USER=Brad
NOTE='Server no longer under maintenance'
DATA='{ "alertState": "Cleared", "assignedToUser": "'${USER}'", "alertUrgency": "None", "notes": "'${NOTE}'", "eTag": "" }'
ALERTURI='/rest/alerts/2177698'
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--header "If-Match" '*'" \
--data "${DATA}" \
--request PUT "${OneView}${ALERTURI}" | jq -r '.'
but am getting back "parse error: Invalid numeric literal at line 1, column 10." I can echo ${DATA} | jq -r '.' and get back a valid JSON object.
Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 12:06 AM - last edited on 06-29-2021 04:45 AM by Ramya_Heera
08-07-2019 12:06 AM - last edited on 06-29-2021 04:45 AM by Ramya_Heera
Re: closing an alert
Greetings,
You can clear “active” alerts through PowerShell.
Please find the steps to clear OneView “active” alerts through PowerShell.
1. Download and install HPE.OneView.XX.PowerShell.Library.exe from below link. (where XX is OneView Version)
https://github.com/HewlettPackard/POSH-HPOneView/releases
2. Open PowerShell prompt and Check first what the execution policy is in this environment. If it is Restricted, set it to Unrestricted. Type:
Get-ExecutionPolicy
and press Enter. If it is Unrestricted, skip to the next step. If it is Restricted, type:
Set-ExecutionPolicy Unrestricted
Confirm with Y <Enter> and verify if it is Unrestricted now by typing again:
Get-ExecutionPolicy
3. Establish a connection with the appliance by executing below command:
Connect-HPOVMgmt -appliance <IP Address>
where <IP Address> is the IP address of your appliance on the network, and option -appliance is default for the first parameter (might be omitted).
You are asked to enter User (Administrator), Password (password), and optionally Authentication Domain (not used here). After a few seconds, a session is established and prompt changed to show the user and managed server.
4. Run below command view/verify the “active” alerts.
Get-HPOVAlert -State active
5. Verify the active alerts and later run below command to clear “active” alerts.
Get-HPOVAlert -State active | Remove-HPOVAlert -force
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2019 05:14 AM
08-07-2019 05:14 AM
Re: closing an alert
I don't have any Windows systems. So, no powershell. I know you guys are big on powershell, be we have no Windows servers, workstations, desktops, etc in this enclave, just RHEL. I'll take a look at the powershell scripts and see if they give me an idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 12:54 AM
08-08-2019 12:54 AM
Re: closing an alert
Hi @BradV
Was able to get your script to work just with curl the way you have been using.
The problem here is similar to the other one you have with default-login-domain.
It seems to have to do with single quotes, double quotes, JSON and "curl" sensitivity.
The two fields that seem to give trouble are the single quotes around 'Server no longer under maintenance'
NOTE='Server no longer under maintenance'
as well as
the extra "double quotes" in the --header below
--header "If-Match" '*'"
For it to work, this should be --header "If-Match '*'"
Remove the double quotes soon after If-Match.
Here is what my command line looks like and works.
curl --insecure --header "content-type: application/json" --header "X-API-Version: 800" --header "auth:XYZ" --data '{ "alertState": "Active", "assignedToUser": "administrator", "alertUrgency": "None", "notes": "Server no longer under maintenance", "eTag": "" }' --header "If-Match '*'" --request PUT "https://myappliance.hpe.com/rest/alerts/5"
First get a command line like the above with all values substituted working.
Get all the singlq quote, double quote, URL encoding issues sorted. out.|
Then convert it to a script like the one you are trying to get working.
Regards,
Bhaskar
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2019 03:09 AM - edited 08-08-2019 03:12 AM
08-08-2019 03:09 AM - edited 08-08-2019 03:12 AM
SolutionHi Bashkar,
The extra double quote in the if-match line was a typo. On my system I had
--header "If-Match: '*'"
All of the other headers have a "Name" followed by a colon and then a "Value." I expected the same for this header. But once I removed the colon, it worked! It worked either if I got the correct eTag, or left the eTag empty. WIth getting the eTag, I used:
ALERTURI='/rest/alerts/2177698'
ETAG=$(curl --insecure \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--request GET "${OneView}${ALERTURI}" | jq -r '.eTag')
USER=Brad
NOTE='Server no longer under maintenance'
DATA='{ "alertState": "Cleared", "assignedToUser": "'${USER}'", "alertUrgency": "None", "notes": "'${NOTE}'", "eTag": "'${ETAG}'" }'
echo ${DATA} | jq -r '.'
curl --insecure \
--header "content-type: application/json" \
--header "X-API-Version: ${currentVersion}" \
--header "auth: ${sessionID}" \
--header "If-Match '*'" \
--data "${DATA}" \
--request PUT "${OneView}${ALERTURI}" | jq -r '.'
can also just set ETAG='' and it works.
Thanks so much for the help!