{"id":9404,"date":"2020-03-30T10:12:00","date_gmt":"2020-03-30T00:12:00","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=9404"},"modified":"2020-03-30T10:12:03","modified_gmt":"2020-03-30T00:12:03","slug":"basics-finding-unprotected-virtual-machines-with-networker","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2020\/03\/30\/basics-finding-unprotected-virtual-machines-with-networker\/","title":{"rendered":"Basics \u2013\u00a0Finding Unprotected Virtual Machines with NetWorker"},"content":{"rendered":"\n<p>Most environments these days have a high percentage of virtualisation. It&#8217;s not uncommon to see 90% or more of all systems within an environment virtualised, so confirming all those resources are protected is critical.<\/p>\n\n\n\n<p>Within the NetWorker GUI, it&#8217;s quite simple to see which virtual machines are protected. Using the HTML5 GUI for instance, you can manually scan through the resources for a vCenter server to see their protected status:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"3120\" height=\"1504\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List.png\" alt=\"\" class=\"wp-image-9406\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List.png 3120w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List-300x145.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List-1024x494.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List-768x370.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List-1536x740.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Manual-List-2048x987.png 2048w\" sizes=\"auto, (max-width: 3120px) 100vw, 3120px\" \/><figcaption>Manually reviewing protection status list<\/figcaption><\/figure>\n\n\n\n<p>The steps shown above are:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Click &#8220;Protection&#8221; in the left-hand pane.<\/li><li>Click &#8220;VMware vCenters&#8221; under Protection.<\/li><li>Select the vCenter server you want to view the inventory for.<\/li><\/ol>\n\n\n\n<p>You can then scroll through the inventory and visually see the virtual machines that are protected or not \u2013&nbsp;a virtual machine shown in blue, bold text, with a dot, is protected. A grey virtual machine is not a member of a protection policy.<\/p>\n\n\n\n<p>You can also get the NetWorker GUI to only show you the protected, or unprotected guests:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"505\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-1024x505.png\" alt=\"\" class=\"wp-image-9407\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-1024x505.png 1024w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-300x148.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-768x379.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-1536x758.png 1536w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/NWUI-Filter-2048x1011.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Manually listing only the unprocted clients<\/figcaption><\/figure>\n\n\n\n<p>The steps shown above are:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Click &#8220;Protection&#8221; in the left-hand pane.<\/li><li>Click &#8220;VMware vCenters&#8221; under Protection.<\/li><li>Select the vCenter server you want to view the inventory for.<\/li><li>Click the filter option, and change it from &#8220;All&#8221; to &#8220;Unprotected&#8221;.<\/li><\/ol>\n\n\n\n<p>By applying the &#8220;Unprotected&#8221; filter, the <em>only<\/em> virtual machines listed in the inventory are the unprotected ones.<\/p>\n\n\n\n<p>But what about doing it from the command line? Well, for that, you&#8217;ll have to leverage the NetWorker REST API. <\/p>\n\n\n\n<p>To check that out, I&#8217;ve written a Perl script that you can use to poll a NetWorker server to retrieve a list of unprotected virtual machines. (This assumes you&#8217;ve got the &#8220;curl&#8221; utility on your system, and also requires the JSON Perl module installed.) Since you need to authenticate against a NetWorker server to retrieve configuration details from the REST API, this prompts you for the server, username and password. If running this in a production environment, you might want to reconfigure that process for greater security, but as a proof of concept, you&#8217;ll get the idea.<\/p>\n\n\n\n<p>Here&#8217;s an example output from the script:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Sun Mar 29 15:29:28]\n [\u2022  ~\/projects\/util-Perl  \u2022]\n pmdg@hala \n $ <strong>.\/list-unprotected-vms.pl <\/strong>\n Find Unprotected Virtual Machines\n Server? <strong>orilla.turbamentis.int<\/strong>\n Username? <strong>pmdg<\/strong>\n Password? <strong><em>SuperSecretPassword<\/em><\/strong>\n 39 Unprotected Virtual Machines:\n     oaktier.turbamentis.int:2kpro\n     oaktier.turbamentis.int:2kpro_recovery\n     oaktier.turbamentis.int:aal\n     oaktier.turbamentis.int:aal_Backup\n     oaktier.turbamentis.int:adamantium\n     oaktier.turbamentis.int:binar\n     oaktier.turbamentis.int:cent38\n     oaktier.turbamentis.int:centaur<\/pre>\n\n\n\n<p>(Since you can have multiple vCenter servers protected by NetWorker, the script provides output in the format <em>vCenterServer:VMName<\/em>.)<\/p>\n\n\n\n<p>The script used can be downloaded <strong><a href=\"https:\/\/nsrd.info\/scripts\/list-unprotected-vms.zip\">from here<\/a><\/strong>. You&#8217;ll need an appropriately configured Perl environment to run in, but it should give you an idea of how simply you can pull this data out of NetWorker.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most environments these days have a high percentage of virtualisation. It&#8217;s not uncommon to see 90% or more of all&hellip;<\/p>\n","protected":false},"author":1,"featured_media":9405,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[16,1357],"tags":[1249,1087],"class_list":["post-9404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-networker","category-vproxy","tag-networker","tag-vmware"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2020\/03\/bigStock-Virtual-Machines.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-2rG","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/comments?post=9404"}],"version-history":[{"count":5,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9404\/revisions"}],"predecessor-version":[{"id":9412,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/9404\/revisions\/9412"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/9405"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=9404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=9404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=9404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}