Start a Conversation

Unsolved

This post is more than 5 years old

16123

November 8th, 2017 05:00

Clearing up old VMs in avamar

My client has alot of virtual machines which are backed up daily..... We are using avamar 7.4

In Administration we see alot of VMs which are GREY....and the note says "VM is no longer addressable through vCenter"

From the CLI, how do we identify these VM clients and either retire or delete them???

thanks!

73 Posts

November 8th, 2017 08:00

CLI command "mccli vmchache show --name=" will list if a VM client is deleted from vCenter or not.

CLI command "mccli client delete --name=" or "mccli client retire -name=" are the commands to remove them.

There is probably a solution to automate what your trying to do with custom bash scripting.

47 Posts

November 9th, 2017 05:00

thanks for the information but I'm assuming that there isnt a command to show VMs that arent addressable to vcenter?

If the client deletes alot of VM's then it seems we can only delete them manually.

1 Rookie

 • 

20.4K Posts

November 11th, 2017 17:00

Mike,

I used these utilities to automate retirement of deleted VMs:

  • List deleted VMs

java -jar proxycp.jar --listdeletedvms --vc myvcenter.company.com  >>retire.clients.list

  • Retire VMs using the file from previous command

java -jar av2ool.jar client retire --filename retire.clients.list



47 Posts

November 13th, 2017 03:00

many thanks. Useful info!

1 Message

July 10th, 2019 08:00

dynamox,

Where can I download av2ool.jar file from? Or is there any other better ways to retire VM clients automatically once they are deleted from the vCenter. 

1 Rookie

 • 

20.4K Posts

July 10th, 2019 12:00

Here you go

 

ftp://avamar_ftp:anonymous@ftp.avamar.com/software/scripts/av2ool.jar

17 Posts

November 20th, 2019 10:00

Hi,

I have done such a script.

Here we go :

### remove old lists
echo "Deleting old parameters files..."
rm retire.clients.list
rm retired.clients.list
rm delete.clients.list
rm Active.txt
###get vcenters list without any duplicate
echo "Creating vcenters list..."
mccli domain show --recursive=true | grep '/VMware/' | awk '{print $2}' | sed 's/\/VMware\///g' | awk '!a[$0]++' > vcenters.list
###create a list of deleted vm to retire cré une liste des vm effacees a retirer
echo "Creating a list of deleted vms from vmware disks to retire..."
echo "Connecting to Avamar vcenter cache..."
for i in $(cat vcenters.list); do java -jar proxycp.jar --listdeletedvms --vc $i | grep $i >>retire.clients.list; done
###proxycp ouptut garbage remove
cat retire.clients.list | grep VMware > retire.clients.clean.list
###list final items to retire and ask for confirmation
printf "\n\n\n"
echo "Here are the clients not on the vcenter disks anymore."
cat retire.clients.clean.list
echo "Do you wish to retire these clients ? If the list is empty, press 2."
select yn in "Yes" "No"; do
    case $yn in
        Yes ) java -jar av2ool.jar client retire --filename retire.clients.clean.list; break;;
        No ) echo "Ok no client retired";;
    esac
done
### list of vm retired without any data
echo "Creating a list of retired vm's with no data..."
mccli client show --domain=/MC_RETIRED | grep MC_RETIRED | awk '{print $1}' >>retired.clients.list
### get retired vm's backup list
for i in $(cat retired.clients.list)
do
        mccli backup show --domain=/MC_RETIRED --name=$i | grep Active >Active.txt
        if grep -q Active Active.txt
        then
                echo $i "has still data"
        else
                echo $i >>delete.clients.list
        fi
done
### remove retired vm's with no backups anymore
printf "\n\n\n"
echo "Here are the retired vms without any data left on Avamar server."
cat delete.clients.list
echo "Do you wish to delete these retired clients with no backup data ? If list is empty press 2."
select yn in "Yes" "No"; do
    case $yn in
        Yes ) for i in $(cat delete.clients.list);do mccli client delete --name=$i --domain=MC_RETIRED;done; break;;
        No ) echo "Ok no client deleted";;
    esac
done

 

2 Posts

January 6th, 2020 03:00

Hi,

 

Thanks for those information.

I work on something similar. I have already a script that delete retired client.

But I work on case of deleted client in VMware. On VMware, I have a use case that seems delete an existing VM. I didn't test because it's a production one.

Like a cloud, users have a selfcare on our VMware environment. And someome delete a VM and recreate a new with the same name. We do that sometimes to upgrade or redeploy and appliance.

In this case, a users recreate a VM with the same name. So avamar have two entries in mccli client show.

admin@avamar:~/>: mccli client show --domain=/vcenter/PROD/ --recursive=true --verbose=true > VMPROD.txt
admin@avamar:~/>: grep server1 VMPROD.txt
server1/vcenter/PROD Virtual Machine N/A Yes N/A No overtime allowed No High No Default Retention No N/A N/A N/A N/A N/A 2019-12-06 11:25:42 CET N/A 2020-01-06 01:32:43 CET N/A Yes Yes No
server1 /vcenter/PROD Virtual Machine N/A Yes N/A No overtime allowed No High No Default Retention No N/A N/A N/A N/A N/A 2019-07-17 00:00:00 CEST N/A 2019-12-05 22:29:11 CET N/A Yes Yes No
admin@avamar:~/>: mccli vmcache sync --domain=/vcenter/ --name=vcenter --recursive=true --showresult=true > DeletedVM.txt
admin@avamar:~/>: grep server1 DeletedVM.txt
server1 VMachine 50210d83-0028-653e-52d8-d4f1a336d00c N/A  N/A N/A   Yes N/A N/A N/A 0
server1 VMachine 502133e9-83ec-2b25-a5f3-62efabd876dd vmx-11 10.0.10.200 /DCname esx51  /DCname/vm/server1 No POWERED_ON group-v3 Resources 2

And when I specify the client name, I have only the active one.

admin@avamar:~/>: mccli client show --name=/vcenter/PROD/server1
0,23000,CLI command completed successfully.
Attribute                Value
------------------------ -----------------------------------------------------
Client Name              server1
Fully Qualified Name     /vcenter/PROD/server1_KpejAiBuPgmggd0UlxMAwQ
Client Type              Virtual Machine
Operating System         other3xLinux64Guest
Paging                   No
CID                      1546a70f192a7842351bd9430bf20d322bf921d6
CID Assigned             2019-12-06 11:25:42 CET
Disabled                 No
Agent Last Started       2020-01-06 01:32:43 CET
Override Group Retention No
Retention Policy         Default Retention
Overtime Option          No overtime allowed
Restore Only             No
Avamar encryption method High
Override Encryption      No
Allow CIS                Yes
Allow CIS file selection Yes
Override CIS retention   No
Browse Timeout           10 seconds
Contact Name             N/A
Contact Phone            N/A
Contact Email            N/A
Contact Location         N/A
Contact Notes            N/A
Member of Group          /vcenter/PROD/VM_PROD
Member of Group          /vcenter/Default Virtual Machine Group
Plugin                   Linux VMware Image(1016)
Initial Install Date     2019-12-06 11:25:42 CET
Last Version Registered  2019-12-06 11:25:42 CET
Last Successful Backup   N/A

 

Any idea?

 

Regards,

17 Posts

January 9th, 2020 02:00

Yes I have the same. They redeploy some vm frequently. But for Avamar the vm gets a new cid therefore is seen as a new client. You can still recover data from the old client, but the old one should be retired. 

14 Posts

February 21st, 2020 16:00

Thanks for the sample code!

I would like to 'me too' the 'non-unique name' issue.
Is there a way to work with VMs via their unique identifiers instead of by name in these java apps?
Just for kicks I tested, and sure enough, the incorrect VM (the newly created one) was retired when using the /domainpath/VMName in the 'VMs to retire' file, as populated by java -jar proxycp.jar --listdeletedvms --vc

17 Posts

March 2nd, 2020 06:00

As I do on my script, I test if there are still backups attached to the client before deleting it. Worst case if the wrong vm gets retired (not deleted) the rules will add again the correct vm in the inventory and the policies. This is the main advantage of working with auto-add rules by vmware tags.

14 Posts

April 9th, 2020 16:00

I played with this a bit more, and clients retired in this manner aren't necessarily rediscovered it seems.

I used the script to retire a few, some active VMs were retired, and the next day after backups I checked, and none of them were back again.  (We import all VMs found on the clusters both to Clients and to the Backup Policy itself).  I was able to manually add the clients fine.

It seems the problem is proxycp.jar --listdeletedvms outputs a 'friendly name' of the client (/vcenter/folder/hostname), isntead of the 'Fully Qualified Name' (/vcenter/folder/hostname_UID)

mccli client retire (and likely av2ool.jar) accept the Fully Qualified Name, likely it should be used in all instances, otherwise 'bad information' is being passed by the scripts.

17 Posts

June 12th, 2020 04:00

Actually if you force a vcenter sync as in https://www.dell.com/community/Avamar/Equivalent-MCCLI-command-for-quot-Sync-with-vCenter-quot-feature/m-p/7449411/highlight/true#M17310 it re-adds automatically the vm back.
Our setting in mcserver.xml is to resync every 4 hours, so it adds back the reinstalled vm's automatically.

2 Posts

March 8th, 2021 08:00

Ok, I find a solution.

In CLI, we use following command :

I list all long name :

avmgr getm --path="/VMWARE_DOMAIN"
1 Request succeeded
VMNAME_hLf7ue4cOa2Xyxnl8LCH8g location: eea8ee7dca74f3a292ba5587974f37406d88b1ab pswd: bffac819da543c3c38f291cf76f5630bbc031b59
[...]

After, I can check and manipulate each VM with mccli using long name

mccli client show --domain=/VMWARE_DOMAIN --name=VMNAME_hLf7ue4cOa2Xyxnl8LCH8g
0,23000,CLI command completed successfully.
Attribute Value ------------------------ ------------------------------------------------------
Client Name VMNAME
Fully Qualified Name /VMWARE_DOMAIN/VMNAME_hLf7ue4cOa2Xyxnl8LCH8g
[...]

17 Posts

March 22nd, 2021 08:00

As now procycp.jar and av2ool.jar don't work with Avamar >=19.3 anymore, I'll work on a new script which will also address this non unique problem using only mccli and avmgr tools.
Will keep you in touch.

No Events found!

Top