# feel free to use whatever the way you want # To install place check_vmware_server.ps1 # into scripts dir of your nsclient++ install # dir and in nsclient.ini put(if you don't already have): # Minimal settings in nsclient.ini to add to an already working NRPE setup: # # ; A list of wrappped scripts (ie. using the template mechanism) # [/settings/external scripts/wrapped scripts] # check_vmware_server = check_vmware_server.ps1 -username username -password password -hostname https://myvmwareserver:8333/sdk # # ; A list of templates for wrapped scripts # [/settings/external scripts/wrappings] # # ; POWERSHELL WRAPPING - # ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command - # param([string]$username = "username", [string]$password = "password", [string]$hostname = "hostname" ) $output = & "C:\Program Files (x86)\VMware\VMware VIX\vmrun.exe" -T server -u $username -p $password -h $hostname list # I only ever cared for the one feel free to # improve if you need more but I'd suggest esxi instead IF ($output -eq "Total running VMs: 1"){ echo "OK - $output" exit 0 }ELSEIF ($output -eq "Error: Unable to connect to the host"){ echo "CRITICAL - $output" exit 2 }ELSEIF ($output -eq "Total running VMs: 0") { echo "WARNING - $output" exit 1 }ELSE{ echo "UNKNOWN - $output" exit 3}