{"id":8122,"date":"2019-06-11T14:20:33","date_gmt":"2019-06-11T04:20:33","guid":{"rendered":"https:\/\/www.penguinpunk.net\/blog\/?p=8122"},"modified":"2019-06-12T08:16:21","modified_gmt":"2019-06-11T22:16:21","slug":"cohesity-basics-excluding-vms-using-tags-real-world-example","status":"publish","type":"post","link":"https:\/\/www.penguinpunk.net\/blog\/cohesity-basics-excluding-vms-using-tags-real-world-example\/","title":{"rendered":"Cohesity Basics \u2013 Excluding VMs Using Tags &#8211; Real World Example"},"content":{"rendered":"<p><a href=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2015\/10\/cohesity.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-3134 size-medium\" src=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2015\/10\/cohesity-300x36.png\" alt=\"\" width=\"300\" height=\"36\" srcset=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2015\/10\/cohesity-300x36.png 300w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2015\/10\/cohesity.png 412w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I&#8217;ve <a href=\"https:\/\/www.penguinpunk.net\/blog\/cohesity-basics-excluding-vms-using-tags\/\">written before<\/a> about using VM tags with <a href=\"https:\/\/www.cohesity.com\/\">Cohesity<\/a> to exclude VMs from a backup. I wanted to write up a quick article using a real world example in the test lab. In this instance, we had someone deploying 200 VMs over a weekend to test a vendor&#8217;s storage array with a particular workload. The problem was that I had Cohesity set to automatically protect any new VMs that are deployed in the lab. This wasn&#8217;t a problem from a scalability perspective. Rather, the problem was that we were backing up a bunch of test data that didn&#8217;t dedupe well and didn&#8217;t need to be protected by what are ultimately finite resources.<\/p>\n<p>As I pointed out in the other article, creating tags for VMs and using them as a way to exclude workloads from Cohesity is not a new concept, and is fairly easy to do. You can also apply the tags in bulk using the vSphere Web Client if you need to. But a quicker way to do it (and something that can be done post-deployment) is to use <a href=\"https:\/\/code.vmware.com\/web\/tool\/11.2.0\/vmware-powercli\">PowerCLI<\/a> to search for VMs with a particular naming convention and apply the tags to those.<\/p>\n<p>Firstly, you&#8217;ll need to log in to your vCenter.<\/p>\n<pre class=\"p1\"><strong>PowerCLI C:\\&gt; Connect-VIServer vCenter<\/strong><\/pre>\n<p>In this example, the test VMs are deployed with the prefix &#8220;PSV&#8221;, so this makes it easy enough to search for them.<\/p>\n<pre class=\"p1\"><strong>PowerCLI C:\\&gt; get-vm | where {$_.name -like \"PSV*\"} | New-TagAssignment -Tag \"COH-NoBackup\"<\/strong><\/pre>\n<p>This assumes that the tag already exists on the vCenter side of things, and you have sufficient permissions to apply tags to VMs. You can check your work with the following command.<\/p>\n<pre class=\"p1\"><strong>PowerCLI C:\\&gt; get-vm | where {$_.name -like \"PSV*\"} | Get-TagAssignment<\/strong><\/pre>\n<p>One thing to note. If you&#8217;ve updated the tags of a bunch of VMs in your vCenter environment, you may notice that the objects aren&#8217;t immediately excluded from the Protection Job on the Cohesity side of things. The reason for this is that, by default, Cohesity only refreshes vCenter source data every 4 hours. One way to force the update is to manually refresh the source vCenter in Cohesity. To do this, go to Protection -&gt; Sources. Click on the ellipsis on the right-hand side of your vCenter source you&#8217;d like to refresh, and select Refresh.<\/p>\n<p><a href=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8123\" src=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source.png\" alt=\"\" width=\"1278\" height=\"175\" srcset=\"https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source.png 1278w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source-300x41.png 300w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source-768x105.png 768w, https:\/\/www.penguinpunk.net\/blog\/wp-content\/uploads\/2019\/06\/cohesity_source-1024x140.png 1024w\" sizes=\"auto, (max-width: 1278px) 100vw, 1278px\" \/><\/a><\/p>\n<p>You&#8217;ll then see that the tagged VMs are excluded in the Protection Job. Hat tip to my colleague Mike for his help with PowerCLI. And hat tip to my other colleague Mike for causing the problem in the first place.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve written before about using VM tags with Cohesity to exclude VMs from a backup. I wanted to write up a quick article using a real world example in the test lab. In this instance, we had someone deploying 200 VMs over a weekend to test a vendor&#8217;s storage array with a particular workload. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837,25,127,4,887],"tags":[297,832,768,786,151],"class_list":["post-8122","post","type-post","status-publish","format-standard","hentry","category-cohesity","category-dataprotection","category-vcenter","category-vmware","category-vsphere","tag-basics","tag-cohesity","tag-powercli","tag-vmware","tag-vsphere"],"_links":{"self":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/8122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/comments?post=8122"}],"version-history":[{"count":2,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/8122\/revisions"}],"predecessor-version":[{"id":8126,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/posts\/8122\/revisions\/8126"}],"wp:attachment":[{"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/media?parent=8122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/categories?post=8122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.penguinpunk.net\/blog\/wp-json\/wp\/v2\/tags?post=8122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}