Earlier this year I attended the HPE Technology Solutions and Summit conference in Paris. This is a great technical event for HPE Employees, Partners and Customers. My focus this year was around automation and the developer side of things so I attended quite a few of the HPE DEV sessions and workshops.
In one of these workshops we worked with the fairly new HPE OneView Global Dashboard REST API and discussed working with the API through both Postman and Powershell. I was surprised to find that there was no Powershell Module available for Global Dashboard since HPE has been creating modules for other products, like OneView.
This post will discuss briefly how I decided to create that module my self.
HPE OneView Global Dashboard
First let’s check out what HPE OneView Global Dashboard is and how it’s used.
Global Dashboard is aimed to be a Unified View across multiple HPE OneView instances. One instance of Global Dashboard supports up to 50 OneView appliances and up to 20000 servers.
In our environment we are using HPE OneView a lot to manage our HPE Server hardware, and we currently have three instances.
There are many reasons for having multiple instances even though OneView supports quite a lot of hardware. We have spread the hardware based on the ability to test updates and profile changes, as well as separation of environments.
With Global Dashboard we can get an overview across these instances to get a quick and easy way to check health status and inventory of our environment.
HPE OneView Global Dashboard API
With the release of Global Dashboard version 1.60 HPE shipped a new (public) RESTful API.
The documentation for the API is available through the Help section of the appliance itself, and there’s a version of the API published on swaggerhub.
The Global Dashboard Powershell module
At the time of this writing the module is at version 0.5.0.
It doesn’t support all the functionality from the REST API yet. I’ve focused on the GET stuff and more specifically on the things we use in our environment. Currently the following can be done through the module:
- Connect, (and disconnect) to a Global Dashboard (GD) instance
- Add, reconnect and remove a OneView appliance to the GD instance
- List the OneView appliances connected to the GD instance
- List the current GD appliance certificate
- List Converged Systems
- List Enclosures
- List Server Hardware
- List Server Profiles and Profile Templates
- List Storage Systems
- Create and delete logical groups
- List Logical groups
- List members of a logical group
Installing the module is easiest done through the Powershell Gallery (note that you should start PS as an Admin).
Find-Module -Repository PSGallery -Name GlobalDashboardPS | Install-Module
You can also download the code from GitHub and import it the way you want to your Powershell session
To check the available functions you can use we utilize the builtin Get-Command cmdlet
Get-Command -Module GlobalDashboardPS
To start off we need to connect to the Global Dashboard Instance. Note that currently you need to specify your credentials. I will add support for PS Credentials going forward.
Connect-OVGD -Server "your-appliance-ip" -Username "your-username" -Directory "your-directory"
Just to show the basic usage of the module I’ll demonstrate how we list Server Hardware. First with the default format (pulled from the ps1xml formatting file).
To see all details of an object you need to specify this.
Get-OVGDServerHardware | select -First 1 *
All functions have help text where you can see examples of the usage.
Get-Help Get-OVGDServerHardware Get-Help Get-OVGDServerHardware -Examples
Paging and querying
Note that the API uses paging of results and defaults to 25 objects. You can specify the count of objects you want to return in the module functions, but currently it does not support paging as such.
Currently you can query for specific objects, but you need to use the ID of the object. I am working on adding support for querying by name as well.
Building the module
I have previously written about how you can easily create a Powershell module as a wrapper for a REST API. Recently I also wrote a post about how I created a more advanced module based on another HPE API, the PDU module.
I’ve pretty much gone through the same process this time using most of the same techniques. This time I’ve also published the module to the Powershell Gallery making it easier to install and update. I’ve also added custom formatting for the output from the function calls.
- Building a powershell module - Rambling Cookie Monster
- Decorating objects - Rambling Cookie Monster
- How to Version and Publish a PowerShell Module to GitHub and PSGallery with AppVeyor - Chris Wahl
What I haven’t gotten around to fix is the automatic publishing to PS Gallery in the CI/CD pipeline, but that’s next in line.
There’s quite a few things missing in the module, but hopefully I will be able to add in stuff going forward. Please feel free to contribute as I have limited time, and I don’t have access to all of the hardware neccessary.