cancel
Showing results for 
Search instead for 
Did you mean: 

Command to list all the VM machines in all vCenters

Jim-90
Level 6

Is there any command to list all the VMware machines that NBU can access?

One work around is to create a dummy policy that uses a selection rule to get all machines in the listed vCenters. Once done run the command nbdiscover for that policy.    The problem with this it doesn't give you much info apart from the each VM machine name.

1 ACCEPTED SOLUTION

Accepted Solutions

Jim-90
Level 6

I had a look at that. The problem was the strucutre of the xml is not a trivial exercise to parse with bash+awk scripting.

View solution in original post

9 REPLIES 9

Jim-90
Level 6

Doing a RTFM found that you can dispense with the dummy policy and use a query but it doesn't give you much.  It would be nice to get te same info when you manually add VM machines.

nbdiscover -noxmloutput "vmware:/?filter=vCenter Contains 'vcenter01'"

Where vcenter01 is the hostname of vCenter. 

I could get a usable result of runnning nbdiscovery multiple times with different queries and merge them which is not a trivial exercise

 

Mark_Solutions
Level 6
Partner Accredited Certified

Not sure if it helps but when the refresh runs every 8 hours or so it produces a list on the vmware backup host which includes everything if i remember correctly

Take a look under \program files\veritas\netbackup\online_util\fi_cntl\

It should be the largest xml file named after your vcenter server

Hope this helps

 

Jim-90
Level 6

I had a look at that. The problem was the strucutre of the xml is not a trivial exercise to parse with bash+awk scripting.

Mark_Solutions
Level 6
Partner Accredited Certified

Ok - try this to see if it is better...

Create the bpvmutil log folder

When the refresh runs it tells you where it saves the initial file which will be something like:

C:\Users\user~1.dom\AppData\Local\Temp\ and the file name is VMutl-xxxxx where xxxx is a LONG number!

Open this up in notepad - looks a bit better to me - see what you think

Jim-90
Level 6

The OS is RHE.  I set-up NBU logging (level 3) and blew away the contents of /usr/openv/netbackup/online_util/fi_cntl/.  The contents of that dir was rebuilt by automagic and no logs produced.  In the enitre server I could not find any file that had "VM" or "vm" in its name after the rebuild of the xml files.  

StefanosM
Level 6
Partner    VIP    Accredited Certified

OpsCenter has a very good report that the output is all VMs with their Vcenter and the ESX that belongs. Also reports if the VM is protected or not.

It may be useful to you, if you export it to cvs format.

It is the client reports -> Virtual Client Summary

 This report shows details of the VMware or HyperV servers that you have configured with NetBackup. It also shows whether these virtual machines are protected by NetBackup or not.
This report may take several minutes to run. Alternatively schedule this report to be emailed or exported.

 

Jim-90
Level 6

The OpsCenter (7.5.0.6) VMware Client Audit report is broken.  It says that about 85% of  the VM clients do not exist in a policy.  The reality is >98% of VM clients exist in a policy and the report doesn't say if the policy is active.  If the OpsCenter report is obviously wrong in one metric can you trust any of the others?

The other problem is OpcCenter is on a windows box and I do all my scripting on a RHE linux media server.

 

 

 

 

Mark_Solutions
Level 6
Partner Accredited Certified

I would have expected the file to be in /tmp on RHE - anything in there?

It wont be there until after the next run / refresh

Jim-90
Level 6

Gave up and used the method below.  Would have been nice to be able to get more info about the machines

This is the engine that will audit a given vCenter for new machines and what is currently not being backed up.  Management of new servers has to be manual rather than using a VMware rule to select boxes as they are created. 

rpt_period=240 # the reporting period, in hours, for bperror
$VM_current=   # the file that is a copy of$tmp_file2 from a
               # previous run. If current list contains machines
               # that are not the previous run baseline list
               # then they must be new machines   
query="vmware:/?filter=vCenter Contains '$vCenter' AND Powerstate Equal poweredOn"

sudo bperror -l -hoursago $rpt_period  | grep 'EXIT STATUS' | \
        awk '{ printf"%s,%s\n",$12,$14}' | sort -u | grep -v SLP_ | \
        grep -v client > $tmp_file1

sudo nbdiscover -noxmloutput "$query"  > $tmp_file2  # the new baseline

grep ^+ $tmp_file2 | sort  | awk '{ print tolower($2)}' |\
        tr -d '"' > $tmp_file3

for box in $(cat $tmp_file3); do
  grep -i $box $VM_current > /dev/null 2>&1
  rc=$?
  if [ "$rc" -ne "0" ] ; then
    printf "%s,New\n" $box >> $out_file_1
  fi
  #
  grep -i $box $tmp_file1 >> $out_file_2
  rc=$?
  if [ "$rc" -ne "0" ]; then
    printf "%s,\"NO BACKUPS\"\n" $box >> $out_file_3
  fi
done
# now merge all the out_files into a final csv file