bseltz-cohesity / scripts

Cohesity REST API examples in PowerShell and Python
Apache License 2.0
102 stars 41 forks source link

Unprotect Object #159

Closed jidelaf closed 5 months ago

jidelaf commented 5 months ago

Hi Brian, In powershell script script unprotectObjects.ps1

I'm trying to exclude a Netapp volume form a protection job.

./unprotectObjects.ps1 -clusterName MYCLUESTERNAME -objectName flexclone_volumename -jobName NAS_NetappSVMname
Connected!
    NOTFOUND: flexclone_volumename (not found in any protection jobs)

Output saved to log-unprotectObjects-2024-06-06.txt

When checking COhesity Web gui I can verify that the backup gropu name and volume names are good. Should this script work for netapp backup group? The Netapp source is registered at SVM level. unprotectnetapp

bseltz-cohesity commented 5 months ago

Keep in mind that the script can only work if the volume is explicitly selected in the protection group. If the NetApp cluster/SVM is autoprotected, then the volume can not be unselected.

jidelaf commented 5 months ago

And you are right :) We use autoprotect at SVM level.

Do you know if there is any alternative powershell script to exclude Netapp volumes?

I see we can do it form the GUI in the screenshot we have one excluded already unprotectnetapp2

When decommissioning a Netapp volume, our Netapp admins mark the volumes offline for several days before they actually delete it. During those days and until the volume gets deleted, we receive alerts such as "[1-5-1] No supported backup type for SVMname:volumename. Currently we only support NFSv3, NFSv4.1 or SMB(1-3) backup, so please check its supported NAS protocols and corresponding configurations"

So ideally we would like to have some script for them to run whenever they offline a volume that automtically exclude the volumes

bseltz-cohesity commented 5 months ago

Yes, you can use the protectNetapp.ps1 script: https://github.com/cohesity/community-automation-samples/tree/main/powershell/protectNetapp

./protectNetapp.ps1 -clusterName mycluster -jobName myjob -netappSource My-NetApp -vexString vol1
jidelaf commented 5 months ago

I have tested it with protectNetapp.ps1 and it works like a charm Thank you!

The only bad part is that it doesn't give you any output about whether it was excluded OK or not, if it was excluded aleady or what are the current exclusions. So we can't validate it was applied properly. (Only checking the Web gui) Is there any way to check current exclusions for a Netapp backup job?

bseltz-cohesity commented 5 months ago

I have updated the script to report what it is protecting/excluding. https://github.com/cohesity/community-automation-samples/tree/main/powershell/protectNetapp