How to backup HP OneView appliance using REST APIs/Powershell


HP OneView management

HP's OneView manages HP's c7000 blade chassis settings and configuration.  It consolidates the Onboard Administrator and Virtual Connect management into a single interface.  OneView runs as a virtual appliance on vSphere (or Hyper-V).  It is similar to vCenter in terms of importance to the environment manages.   If it goes down,  the environment will stay up,  however, you will have limited access to the underlying environment and no changes can be made.

Since OneView manages the underlying network/storage infrastructure for blades,  misconfiguring network/storage settings in OneView could result in loss of networking on the managed blades.    For this reason OneView should never run on a vSphere blade that it is managing.

HP OneView backup options

For environments that have existing licensed vSphere hosts running on rack servers,  OneView can be backed up using vCenter integrated backups.  However,  what if your environment doesn't have an existing vSphere infrastructure running on rack servers OR you don't want to waste vSphere licenses on a vSphere host running only OneView virtual appliance?   Answer:  Install vSphere Hypervisor (free) on a rack server.   This solution works,  but does not allow for vCenter integrated backups. 

OneView has a backup menu item that will save a backup of the configuration to the OneView appliance.   To get the backup file off of the appliance,  you need to click the download backup button and then you can save it to a remote location.   Which begs the question:  How can a OneView scheduled backup job be created that saves the file to an off-appliance location?

HP OneView Rest APIs

HP OneView includes REST APIs that allow almost every configuration item and function to be accessed via scripting.   HP has taken this API a step further and created an HPOV Powershell module that allows the REST APIs to be called using POSH.

HP OneView POSH Module setup



Create backup POSH script

On the Windows VM that will execute the backup job and save the backup files create a POSH script file named: HPOV-Backup.ps1
Add these 2 lines of code,  replacing the OneView appliance info for your environment:

Right-click on the HPOV-Backup.ps1 file and choose to Run with Powershell.  The script should take a few minutes and when complete,  verify that a *.bkp file has been created in the file location specified

Schedule backup job

Using Windows Task Scheduler schedule a job that will run the HPOV-Backup.ps1 on a daily basis.    In the Task's Actions,  the Program/Script should be set to the Powershell.exe:  C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.   The Add Arguments should point the full path of the scripts file:  c:\backups\HPOV-Backup.ps1.

Verify the scheduled task runs successfully and make sure that the Windows VM running the scheduled tasks is being backed up.

Labels: , , , , , , , , , , , , ,