In this post we will explore how NSX manager system info can be retrieved via Rest API. NSX manager appliance home page is itself very descriptive and provides all system info.
In this post we will learn how the same system info can be explored via API calls. Let’s get started.
Query NSX Manager Information
Below API query will provide you info like what is the major and minor version of NSX appliance you are running along with patch number and build number
1 2 3 |
# Fetch Global Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/1.0/appliance-management/global/info |
Example: curl -k -u “vcadmin@corp.local” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/global/info | tidy -xml -indent -quiet
1 2 3 4 5 6 7 8 9 10 |
<?xml version="1.0" encoding="utf-8"?> <globalInfo> <currentLoggedInUser>admin</currentLoggedInUser> <versionInfo> <majorVersion>6</majorVersion> <minorVersion>3</minorVersion> <patchVersion>5</patchVersion> <buildNumber>7119875</buildNumber> </versionInfo> </globalInfo> |
Query NSX Manager Summary Information
This API query will present you with all info which you used to see from the NSX manager homepage. This call can be used to obtain all system related info in one shot.
1 2 3 |
# Fetch System Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/1.0/appliance-management/summary/system |
Example: curl -k -u “admin” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/summary/system | tidy -xml -indent -quiet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
<?xml version="1.0" encoding="utf-8"?> <systemSummary> <ipv4Address>192.168.109.130</ipv4Address> <dnsName>nsxmgr-01a.corp.local</dnsName> <hostName>nsxmgr-01a</hostName> <domainName>corp.local</domainName> <applianceName>vShield Virtual Appliance Management</applianceName> <versionInfo> <majorVersion>6</majorVersion> <minorVersion>3</minorVersion> <patchVersion>5</patchVersion> <buildNumber>7119875</buildNumber> </versionInfo> <uptime>13 days, 20 hours, 11 minutes</uptime> <cpuInfoDto> <totalNoOfCPUs>4</totalNoOfCPUs> <capacity>2600 MHZ</capacity> <usedCapacity>29 MHZ</usedCapacity> <freeCapacity>2571 MHZ</freeCapacity> <usedPercentage>1</usedPercentage> </cpuInfoDto> <memInfoDto> <totalMemory>16024 MB</totalMemory> <usedMemory>4644 MB</usedMemory> <freeMemory>11380 MB</freeMemory> <usedPercentage>29</usedPercentage> </memInfoDto> <storageInfoDto> <totalStorage>81G</totalStorage> <usedStorage>3.8G</usedStorage> <freeStorage>77G</freeStorage> <usedPercentage>5</usedPercentage> </storageInfoDto> <currentSystemDate>Wednesday, 09 May 2018 08:04:23 AM IST</currentSystemDate> </systemSummary> |
You can also get details about individual components like CPU/Memory and Storage using below queries
Memory Info:
1 2 3 |
# Fetch Memory Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/1.0/appliance-management/system/meminfo |
Example: curl -k -u “admin:Password” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/system/meminfo | tidy -xml -indent -quiet
1 2 3 4 5 6 7 |
<?xml version="1.0" encoding="utf-8"?> <memInfo> <totalMemory>16024 MB</totalMemory> <usedMemory>4642 MB</usedMemory> <freeMemory>11382 MB</freeMemory> <usedPercentage>29</usedPercentage> </memInfo> |
CPU Info
1 2 3 |
# Fetch CPU Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/1.0/appliance-management/system/cpuinfo |
Example: curl -k -u “admin:Password” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/system/cpuinfo | tidy -xml -indent -quiet
1 2 3 4 5 6 7 8 |
<?xml version="1.0" encoding="utf-8"?> <cpuInfo> <totalNoOfCPUs>4</totalNoOfCPUs> <capacity>2600 MHZ</capacity> <usedCapacity>83 MHZ</usedCapacity> <freeCapacity>2517 MHZ</freeCapacity> <usedPercentage>3</usedPercentage> </cpuInfo> |
Storage Info
1 2 3 |
# Fetch Storage Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/1.0/appliance-management/system/storageinfo |
Example: curl -k -u “admin:Password” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/system/storageinfo | tidy -xml -indent -quiet
1 2 3 4 5 6 7 |
<?xml version="1.0" encoding="utf-8"?> <storageInfo> <totalStorage>81G</totalStorage> <usedStorage>3.8G</usedStorage> <freeStorage>77G</freeStorage> <usedPercentage>5</usedPercentage> </storageInfo> |
Get vCenter Configuration Details
This API query will provide you details about vCenter to which this NSX manager is registered.
1 2 3 |
# Fetch vCenter Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/2.0/services/vcconfig |
Example: curl -k -u “admin” -X GET https://nsxmgr-01a.corp.local/api/2.0/services/vcconfig | tidy -xml -indent -quiet
1 2 3 4 5 6 7 8 9 10 11 |
<?xml version="1.0" encoding="utf-8"?> <vcInfo> <ipAddress>vcsa-01a.corp.local</ipAddress> <userName>svcnsx@corp</userName> <certificateThumbprint> 6E:47:DC:ED:AA:D9:B7:58:4F:3D:0A:4A:3A:7A:BA:CD:17:C8:A8:8B</certificateThumbprint> <assignRoleToUser>true</assignRoleToUser> <simplifiedUIEnabled>false</simplifiedUIEnabled> <vcInventoryLastUpdateTime> 1525860115278</vcInventoryLastUpdateTime> </vcInfo> |
Get vCenter Server connection status
1 2 3 |
# Fetch vCenter Info # METHOD: GET # API CALL: https://NSX-MGR-IP/api/2.0/services/vcconfig/status |
Example: curl -k -u “admin” -X GET https://nsxmgr-01a.corp.local/api/2.0/services/vcconfig/status | tidy -xml -indent -quiet
1 2 3 4 5 |
<?xml version="1.0" encoding="utf-8"?> <vcConfigStatus> <connected>true</connected> <lastInventorySyncTime>1525859635213</lastInventorySyncTime> </vcConfigStatus> |
Thats it. This is how you can generate system related info for your nsx manager. Above API calls can be used in scripting for doing a daily health check on your NSX manager.
I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing. Be sociable