I am trying to export cluster info with the below code which I got from the internet (do not remember where I got this). but the below script runs fine and able to export the data required except for Cluster name and its IP address.
As per my understanding it is able to export only the content of “NTNXHost” but not the content of “NTNXClusterInfo” and “NTNXVM”
$report = @()
$NTNXHost = Get-NTNXHost | Select-Object name,hypervisorAddress,clusterUuid,serviceVMId,serviceVMExternalIP,ipmiAddress,serial,blockSerial,blockModel,blockModelName,cpuModel,numCpuCores,numCpuThreads,numCpuSockets,cpuFrequencyInHz,cpuCapacityInHz,memoryCapacityInBytes,hypervisorFullName,hypervisorType
$NTNXClusterInfo = Get-NTNXClusterInfo | Select-Object name,clusterExternalIPAddress
$report += "`r`n"
$NTNXVM = Get-NTNXVM -SearchString "VM is a Nutanix CVM" | ft vmname,ipAddresses
$report | Export-Csv -Path C:\temp\ClusterInfo.csv -NoTypeInformation -UseCulture
Hence request you to fix this so that I can export the data along with the Cluster Name & Cluster IP?
Note: Before running the above script I am using the below commands to connect to the cluster.
$credentials = Get-Credential -Message "**Enter your Nutanix Admin credentials here**"
$username = $credentials.username
$password = ConvertTo-SecureString $($credentials.GetNetworkCredential().password) -AsPlainText -Force
Connect-NTNXCluster -Server ClusterFQDN -UserName admin -AcceptInvalidSSLCerts -ForcedConnection
Best answer by TapatiView original
You can have a look into these below links which have got some good content that might help you.
Please let me know how it goes.
Thank you for the quick response and sharing the link. I will check and get back to you on this.
It seems like something which I am missing here or its broken. I am getting an error as “Error sending request Get : unsupported protocol scheme "
I am new to this API environment.
I also tried inputting my PE details in the host, username & password, it still doesn’t work. Anymore changes do I need to do before proceeding to the request?
“Error sending request Get https://PEName.net/api/nutanix/v2.0/cluster: dial tcp: lookup PEname.net on 127.0.0.11:53: no such host”
Can anyone suggest me how to add the Cluster name and IP to the above code?
@Nagarjunb, it seems something is broken on dev.nutanix site. But your API call should be correct. We will look into this.
If you have a Linux machine, you can curl the same information.
In the section where you put in the parameter details, if you click on ‘Code Generation’, you can see the request sent out. Just copy it out and run it from any Linux or even a CVM.
So the request would look like this -
Notice I added a ‘-k’ in the curl request to create an insecure connection. I would not recommend in production clusters.
Thank you for the response. I will check and get back to you on this.