Virtual Southwest
  • Blog
  • About
  • Presentations

Configure NSX Backups with API Call

9/13/2017

 
Whether you need to recover your NSX Manager from a failure or revert from changes, it is always good to have a current backup!
And if you have several NSX Managers to configure backups on, updating them using the API call will save you quite a lot of time.
NSX Manager supports setting up backups using FTP or SFTP, and to schedule them to run on an hourly,
daily or weekly frequency.
If you are looking for a FTP Server, I have used the FileZilla Server and pointed NSX Manager backups. It will support SFTP as well, check out the FileZilla info- forum.filezilla-project.org/viewtopic.php?t=8812
I have had the best success running API calls to NSX using the Firefox RESTClient.  To start with-
1. Locate the RESTClient Mozilla add‐on, and add it to Firefox.
2. Click Tools > REST Client to start the add‐on.
3. Click Authentication,then Basic Authentication, and enter the NSX Manager login credentials, which then appear encoded in the Request Header.
Note: you may need to browse to the NSX Managers web ui, and accept the certificate warning before running query.
4. Select a method such as GET, POST, or PUT, and type the URL of a REST API.
Response Header, Response Body, and Rendered HTML appear in the bottom window.
5. For POST and PUT, you will need to add a Custom Header.
Select Headers, Custom header and add the name Content-Type and Value application/xml

Below is an example of adding a backup for a daily schedule:

Method   PUT   URL: https://nsx-manager.corp.local/api/1.0/appliance-management/backuprestore /backupsettings
Headers: Authorization: Basic       Content-Type: application/xml
Body:
<backupRestoreSettings>
<ftpSettings>
<transferProtocol>FTP</transferProtocol>
<hostNameIPAddress>ftp-server.corp.local</hostNameIPAddress>
<port>21</port>
<userName>ftp-user</userName><password>my-pasword</password>
<backupDirectory>NSXBackupDir</backupDirectory>
<filenamePrefix>nsx-manager-</filenamePrefix>
<passPhrase>my-password</passPhrase>  - This item was not listed in the API guide
<passiveMode>true</passiveMode>
<useEPRT>false</useEPRT>
<useEPSV>true</useEPSV>
</ftpSettings>
<backupFrequency>
<frequency>DAILY</frequency>
<hourOfDay>19</hourOfDay>
<minuteOfHour>30</minuteOfHour>
</backupFrequency>
<excludeTables>
<excludeTable>AUDIT_LOGS</excludeTable>
<excludeTable>SYSTEM_EVENTS</excludeTable>
</excludeTables>
</backupRestoreSettings>
 
The items in Bold are the options for your specific configuration…
To check your backup settings, just change the Method to GET, and run the same URL with the Authentication: Basic Header-
Method   GET   URL: https://nsx-manager.corp.local/api/1.0/appliance-management/backuprestore /backupsettings
Headers: Authorization: Basic       
The configured settings will display in the Body:
<backupRestoreSettings>
<ftpSettings>
<transferProtocol>FTP</transferProtocol>
<hostNameIPAddress>ftp-server.corp.local</hostNameIPAddress>
<port>21</port>
<userName>ftp-user</userName><password>my-pasword</password>
<backupDirectory>NSXBackupDir</backupDirectory>
<filenamePrefix>nsx-manager-</filenamePrefix>
<passiveMode>true</passiveMode>
<useEPRT>false</useEPRT>
<useEPSV>true</useEPSV>
</ftpSettings>
<backupFrequency>
<frequency>DAILY</frequency>
<hourOfDay>19</hourOfDay>
<minuteOfHour>30</minuteOfHour>
</backupFrequency>
<excludeTables>
<excludeTable>AUDIT_LOGS</excludeTable>
<excludeTable>SYSTEM_EVENTS</excludeTable>
</excludeTables>
</backupRestoreSettings>

Comments are closed.
    View my profile on LinkedIn
    Follow @virtsouthwest

    RSS Feed

    Archives

    December 2024
    October 2024
    August 2024
    September 2023
    September 2022
    June 2022
    August 2021
    December 2019
    September 2019
    January 2019
    August 2018
    June 2018
    October 2017
    September 2017
    March 2017
    September 2016
    February 2016
    November 2015
    March 2015
    May 2014
    January 2014
    July 2013
    April 2013
    December 2012
    September 2012
    August 2012
    July 2012
    June 2012

[email protected]