HPE Oneview Global Dashboard Powershell Module
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.
You can also head over to HPE Dev to get more information about the API and there's also a "getting started" post
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
Install module
Installing the module is easiest done through the Powershell Gallery (note that you should start PS as an Admin).
1Find-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
Usage
To check the available functions you can use we utilize the builtin Get-Command cmdlet
1Get-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.
1Connect-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).
1Get-OVGDServerHardware
To see all details of an object you need to specify this.
1Get-OVGDServerHardware | select -First 1 *
All functions have help text where you can see examples of the usage.
1Get-Help Get-OVGDServerHardware
2
3Get-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.
I have used a couple of resources when doing this. For a lot of this I've been using some great posts by The Rambling Cookie Monster and Chris Wahl:
- 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.
Summary
The full source of this project is available on GitHub and the module is available on the Powershell Gallery
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.
I try to keep the changelog up to date. If you have any questions, comments, requests or want to contribute please contact me on Twitter, or open an issue on GitHub.