- Community Home
- >
- Software
- >
- HPE OneView
- >
- Custom Report -> HPE API and/or PowerShell
-
-
Forums
- Products
- Servers and Operating Systems
- Storage
- Software
- Services
- HPE GreenLake
- Company
- Events
- Webinars
- Partner Solutions and Certifications
- Local Language
- China - 简体中文
- Japan - 日本語
- Korea - 한국어
- Taiwan - 繁體中文
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Latin America
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Blog, Poland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Forums
-
Blogs
-
Information
-
English
- 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
04-19-2021 06:52 AM
04-19-2021 06:52 AM
Hello - sucessfully pull in all server hardware using API, but the request now is to add the enclosure rack location as a column on the blade server report.
Since I can't create a custom report within OneView (we don't have global and won't be getting it), is there a way to create a custom report using the powershell commandlets?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 11:04 AM
04-19-2021 11:04 AM
Re: Custom Report -> HPE API and/or PowerShell
OneView Global Dashboard is a no-cost product that any OneView customer is entitled to download and use.
Rack information is an Index resource. So, to get the rack information of servers, you can use the following to get the rack name associated with the server resource:
# Index base URI
$baseUri = '/rest/index/associations?name=RACK_TO_PHYSICAL_DEVICE&childUri={0}'
# Get list of rack mount servers
$Servers = Get-OVServer | Where { $null -eq $_.locationUri }
ForEach ($server in $Servers) {
$uri = $baseUri -f $server.uri
# Get the resource association
$indexResource = Send-OVRequest -Uri $uri
# Get the rack
$associatedRack = Send-OVRequest -Uri $indexResource.members[0].parentUri
Write-Host $server.name "is associated with" $associatedRack.name
}
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 11:23 AM - edited 04-19-2021 11:44 AM
04-19-2021 11:23 AM - edited 04-19-2021 11:44 AM
Re: Custom Report -> HPE API and/or PowerShell
Thanks @ChrisLynch ! Oddly that doesn't provide any output for me. It doesn't error and does finish, but nothing in the console.
My pre-req command was just using Connect-OVMgmt to connect to my oneview appliance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 12:02 PM
04-19-2021 12:02 PM
SolutionThe code filters out BL and SY servers from the appliance. Both of which have a different method of obtaining the rack information. This code would work for those types of devices:
# Index base URI
$baseUri = '/rest/index/associations?name=RACK_TO_PHYSICAL_DEVICE&childUri={0}'
# Get list of rack mount servers
$Servers = Get-OVServer | Where { $null -ne $_.locationUri }
ForEach ($server in $Servers) {
# The locationUri value is the Enclosure resource's URI
$uri = $baseUri -f $server.locationUri
# Get the enclosure resource only for reporting purposes
$enclosureResource = Send-OVRequest -Uri $server.locationUri
# Get the resource association
$indexResource = Send-OVRequest -Uri $uri
# Get the rack
$associatedRack = Send-OVRequest -Uri $indexResource.members[0].parentUri
"{0} is associated with {1} enclosure, associated with {2} rack" -f $server.name, $enclosureResource.name, $associatedRack.name | Write-Host
}
I am an HPE employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2021 12:37 PM
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2022 Hewlett Packard Enterprise Development LP