NetWorker: How To Use vmconfig Utility to Troubleshoot VM Protection Failures
Summary: This KB provides instructions for how to use the vmconfig utility to troubleshoot Virtual Machine (VM) protection failures.
Instructions
Overview:
The vmconfig utility is troubleshooting utility that can be used to identify potential impacts to NetWorker VMware Protection (NVP) operations. For example, it can list if a VM is still locked from backup; or if the VM has VMware Change Block Tracking (CBT) enabled or disabled. Additional uses are detailed in the below Instructions field. The ProxyHC utility can also be used to perform many of the same functions; however, vmconfig is provided on the vProxy by default where ProxyHC must be downloaded and placed on the vProxy. For more information about ProxyHC, see the Additional Info section of this article.
Instructions:
1. Log in to the vProxy as admin, then switch to root:
sudo su -
2. Change to the bin directory:
cd /opt/emc/vproxy/bin
3. Run the command below to load the library path:
source ../unit/vproxy.env
vmconfig if the above step is not performed.
4. Run the vmconfig command.
Syntax:
VM Config
Missing argument(s)...
-D string
Enable detail logging for package, "-D common/example""
-L string
Log level { debug, trace, info, warn }
-c string
Commands: "cancel-sdm-snapshot" | "cleanup-vddk" | "disable-cbt" | "disable-migration" | "disable-sdm" | "enable-cbt" | "enable-migration" | "enable-sdm" | "info" | "lock-vm" | "reset-backup" | "unlock-vm"
-d value
Disk key: [ -d <int> ], ...
-f Force command to take effect, ignoring current state
-k string
Lookup key associated with lookup mode. Note: for lookup by path use [<datacenter-folder>/]<datacenter-name>/vm/[<vapp-name>]/<vm-name>.
-l string
Lookup mode: { "dns" | "ip" | "moref" | "path" }
-logsdir-owner-group string
owner group name of the log folders and files
-m string
Hypervisor mode: { "VMC" | "vSphere" } (default "vSphere")
-p string
User password
-s string
Snapshot UUID
-u string
User name
-v string
vCenter host name
-vddk-hotadd-threshold int
Threshold for logging warnings indicating too many concurrent VDDK hotadd sessions. (default 24)
nsr-vproxy01:/opt/emc/vproxy/bin # ./vmconfig -c info -k "vm-17023" -l moref -u administrator@vsphere.local -p '!Password1' -v vcsa.amer.lan VM Config vCenter: "vcsa.amer.lan", User: "administrator@vsphere.local", Password: "!Password1", Lookup Mode: "moref", Lookup Key: "vm-17023", HypervisorMode: "vSphere", Command: "info" Logged into vCenter 'vcsa.amer.lan'. Connected to session on vCenter 'vcsa.amer.lan' Version '8.0.3 build-24322831, API:8.0.3.0', Uuid:e5390e5f-912e-4818-ad6e-ea9b878ff57d. Found virtual machine 'rhel-client01.amer.lan' with MORef 'vm-17023'. vm-17023: Name: "rhel-client01.amer.lan". vm-17023: CBT Enabled: true. vm-17023: Migration Enabled: true. vm-17023: Backup Locked: false. Disconnected from session on vCenter 'vcsa.amer.lan'. Logged out from vCenter 'vcsa.amer.lan'.
Collecting VM MoRef Values:
Additional Information
The following example shows how to script check all VMs in the environment.
vmconfig options may be dangerous if loop scripted incorrectly, or run against a VM that is undergoing active protection operations. Proceed with caution and only use loop scripting against VMs when it is safe to do so, or when performing low risk actions, like info collection. NetWorker support does not provide scripting support. This method is for demonstration purposes for NetWorker and VMware administrators to use at their own discretion. The ProxyHC utility also provides some methods to bulk cleanup NetWorker protection operations in VMware, see: NVP-vProxy: How to use health check tool ProxyHC on vProxy appliances
- Get all of the VM
MoRefids on the NetWorker server and put them in a file:
Linux:
mminfo -aS -t "1 weeks ago" -q client=VCENTER_CLIENT_NAME \
| grep -oE 'vm-[0-9]+' \
| sort -u \
> moref_ids.txt
Windows (PowerShell):
mminfo -aS -t "1 weeks ago" -q client=VCENTER_CLIENT_NAME |
Select-String -Pattern 'vm-\d+' -AllMatches |
ForEach-Object { $_.Matches.Value } |
Sort-Object -Unique |
Set-Content moref_ids.txt
MoRef has changed. The -t time period can be modified as per your discretion.
- Copy the
moref_ids.txtfile to the vProxy appliance. - Log in to the vProxy as admin, then switch to root:
sudo su - - Change to the bin directory:
cd /opt/emc/vproxy/bin - Run the command below to load the library path:
source ../unit/vproxy.env - Use a for loop to run a
vmconfigoperation against theMoRefids in themoref_ids.txt
while read -r moref; do
echo "===== $moref ====="
./vmconfig -c info \
-k "$moref" \
-l moref \
-u VCENTER_USER \
-p 'PASSWORD' \
-v VCENTER_ADDRESS
echo
done < /home/admin/moref_ids.txt > vmconfig_output.txt 2>&1
In this example, the vmconfig utility with the info argument is recursively run against each of the VM MoRef id's in moref_ids.txt and generates an output file containing the vmconfig info output for each of the VMs:
nsr-vproxy01:~ # cd /opt/emc/vproxy/bin
nsr-vproxy01:/opt/emc/vproxy/bin # source ../unit/vproxy.env
nsr-vproxy01:/opt/emc/vproxy/bin # while read -r moref; do
> echo "===== $moref ====="
> ./vmconfig -c info \
> -k "$moref" \
> -l moref \
> -u administrator@vsphere.local \
> -p '!Password1' \
> -v vcsa.amer.lan
> echo
> done < /home/admin/moref_ids.txt > vmconfig_output.txt 2>&1
nsr-vproxy01:/opt/emc/vproxy/bin # cat vmconfig_output.txt
===== vm-17020 =====
VM Config
vCenter: "vcsa.amer.lan", User: "administrator@vsphere.local", Password: "!Password1", Lookup Mode: "moref", Lookup Key: "vm-17020", HypervisorMode: "vSphere", Command: "info"
Logged into vCenter 'vcsa.amer.lan'.
Connected to session on vCenter 'vcsa.amer.lan' Version '8.0.3 build-25413364, API:8.0.3.0', Uuid:e5390e5f-912e-4818-ad6e-ea9b878ff57d.
Found virtual machine 'win-client01.amer.lan' with MORef 'vm-17020'.
vm-17020: Name: "win-client01.amer.lan".
vm-17020: CBT Enabled: true.
vm-17020: Migration Enabled: true.
vm-17020: Backup Locked: false.
Disconnected from session on vCenter 'vcsa.amer.lan'.
Logged out from vCenter 'vcsa.amer.lan'.
===== vm-17021 =====
VM Config
vCenter: "vcsa.amer.lan", User: "administrator@vsphere.local", Password: "!Password1", Lookup Mode: "moref", Lookup Key: "vm-17021", HypervisorMode: "vSphere", Command: "info"
Logged into vCenter 'vcsa.amer.lan'.
Connected to session on vCenter 'vcsa.amer.lan' Version '8.0.3 build-25413364, API:8.0.3.0', Uuid:e5390e5f-912e-4818-ad6e-ea9b878ff57d.
Found virtual machine 'win-client02.amer.lan' with MORef 'vm-17021'.
vm-17021: Name: "win-client02.amer.lan".
vm-17021: CBT Enabled: true.
vm-17021: Migration Enabled: true.
vm-17021: Backup Locked: false.
Disconnected from session on vCenter 'vcsa.amer.lan'.
Logged out from vCenter 'vcsa.amer.lan'.
===== vm-17023 =====
VM Config
vCenter: "vcsa.amer.lan", User: "administrator@vsphere.local", Password: "!Password1", Lookup Mode: "moref", Lookup Key: "vm-17023", HypervisorMode: "vSphere", Command: "info"
Logged into vCenter 'vcsa.amer.lan'.
Connected to session on vCenter 'vcsa.amer.lan' Version '8.0.3 build-25413364, API:8.0.3.0', Uuid:e5390e5f-912e-4818-ad6e-ea9b878ff57d.
Found virtual machine 'rhel-client01.amer.lan' with MORef 'vm-17023'.
vm-17023: Name: "rhel-client01.amer.lan".
vm-17023: CBT Enabled: true.
vm-17023: Migration Enabled: true.
vm-17023: Backup Locked: false.
Disconnected from session on vCenter 'vcsa.amer.lan'.
Logged out from vCenter 'vcsa.amer.lan'.
===== vm-17025 =====
VM Config
vCenter: "vcsa.amer.lan", User: "administrator@vsphere.local", Password: "!Password1", Lookup Mode: "moref", Lookup Key: "vm-17025", HypervisorMode: "vSphere", Command: "info"
Logged into vCenter 'vcsa.amer.lan'.
Connected to session on vCenter 'vcsa.amer.lan' Version '8.0.3 build-25413364, API:8.0.3.0', Uuid:e5390e5f-912e-4818-ad6e-ea9b878ff57d.
Found virtual machine 'rhel-client02.amer.lan' with MORef 'vm-17025'.
vm-17025: Name: "rhel-client02.amer.lan".
vm-17025: CBT Enabled: true.
vm-17025: Migration Enabled: true.
vm-17025: Backup Locked: false.
Disconnected from session on vCenter 'vcsa.amer.lan'.
Logged out from vCenter 'vcsa.amer.lan'.
nsr-vproxy01:/opt/emc/vproxy/bin #