{"id":7764,"date":"2019-01-15T06:31:51","date_gmt":"2019-01-14T20:31:51","guid":{"rendered":"https:\/\/nsrd.info\/blog\/?p=7764"},"modified":"2019-01-15T06:32:39","modified_gmt":"2019-01-14T20:32:39","slug":"basics-using-nsradmin-with-networker-policies","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2019\/01\/15\/basics-using-nsradmin-with-networker-policies\/","title":{"rendered":"Basics \u2013 Using nsradmin with NetWorker Policies"},"content":{"rendered":"\n<p>NetWorker 9 saw the introduction of the service-catalogue like <em>Policy\/Workflow\/Action<\/em> configuration engine in NetWorker, which replaced the previous group based configuration. While policies could be manipulated from within NMC, and from the command line using <em>nsrpolicy<\/em>, they couldn&#8217;t really be edited (unless you were feeling particularly brave) in <em>nsradmin<\/em> because they&#8217;re maintained in JSON format.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/bigStock-Using-a-Keyboard.jpg\" alt=\"\" class=\"wp-image-7788\" width=\"675\" height=\"451\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/bigStock-Using-a-Keyboard.jpg 900w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/bigStock-Using-a-Keyboard-300x200.jpg 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/bigStock-Using-a-Keyboard-768x513.jpg 768w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><figcaption><br><\/figcaption><\/figure>\n\n\n\n<p>NetWorker 18.2 has introduced an updated <em>nsradmin<\/em> utility though that can be used to manipulate NetWorker Protection Policies, Workflows and Actions, and in this blog post, I&#8217;m going to take you through how that works.<\/p>\n\n\n\n<p class=\"has-text-color has-background has-sitebg-color has-sitetext-background-color\"><strong>CAUTION<\/strong>: I&#8217;ve always said that an advanced NetWorker administrator should be fluent with nsradmin. However, nsradmin lets you directly edit NetWorker resources, so if you&#8217;re not sure about what you&#8217;re doing, you should always practice on a test server first. Remember you can always run up a temporary NetWorker server and use it in &#8216;trial&#8217; mode without enablers for a few weeks.<\/p>\n\n\n\n<p>Let&#8217;s check out what the resource types are with NetWorker 18.2:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"803\" height=\"492\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/01-NSR-Resource-Types.png\" alt=\"\" class=\"wp-image-7790\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/01-NSR-Resource-Types.png 803w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/01-NSR-Resource-Types-300x184.png 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/01-NSR-Resource-Types-768x471.png 768w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/01-NSR-Resource-Types-326x200.png 326w\" sizes=\"auto, (max-width: 803px) 100vw, 803px\" \/><figcaption>NetWorker Resource Types<\/figcaption><\/figure>\n\n\n\n<p>Here you&#8217;ll see the <em>NSR\u00a0Protection\u00a0Policy<\/em>, but no workflows or actions. Is that correct? Well, yes. The reason for this is that there&#8217;s some interpretation work going on in the background. But don&#8217;t worry, we&#8217;ll run through what that means. To start with, let&#8217;s look at one of my protection policies. Now, I have a &#8216;Platinum&#8217; protection policy, and I can see its details as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>print type: NSR Protection Policy; name: Platinum<\/strong><br>                         type: NSR Protection Policy;<br>                         name: Platinum;<br>                      comment: \"Template policy: Platinum\";<br>         restricted data zone: ;<br>          Notification action: nsrlog -f policy_notifications.log;<br>      Notification execute on: completion;<br>     policy protection period: ;<br>                 manual saves: No;<\/pre>\n\n\n\n<p>Using nsradmin to manipulate policies, workflows and actions is covered in the NetWorker 18.2 Administration Guide, so I&#8217;m going to more briefly introduce what you need to do here to get to a workflow. Let&#8217;s start by finding out what workflows I have in the <em>Platinum<\/em> policy. I&#8217;ll use the &#8216;show&#8217; command to only show the workflow names, then execute the print command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>show name:<\/strong><br>nsradmin> <strong>print type: NSR Protection Policy Workflow; policy name: Platinum<\/strong><br>                         name: Servers;<br><br>                         name: VM Filesystem Backups;<br><br>                         name: Laptops; <br><br>                         name: Desktops; <br><br>                         name: iTunes; <br><br>                         name: Uni;<br><\/pre>\n\n\n\n<p>So we&#8217;re using a &#8216;hidden&#8217; resource name called &#8220;NSR Protection Policy Workflow&#8221;, and to identify the workflows that we want to use, we characterise them by a resource key of &#8220;policy name&#8221;, being Platinum.<\/p>\n\n\n\n<p>Let&#8217;s drill down and have a look at one of those workflows, the <em>Servers<\/em> workflow.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>show<\/strong><br>Will show all attributes<br>nsradmin> <strong>print type: NSR protection policy workflow; name: Servers; policy name: Platinum<\/strong><br>                         type: NSR protection policy workflow;<br>                         name: Servers;<br>                      comment: ;<br>           Auto start enabled: Yes;<br>            Interval end time: \"23:00\";<br>                        Group: Platinum_Servers;<br>                     Interval: \"24:00\";<br>               Restart window: \"24:00\";<br>                   Start time: \"23:00\";<br>                      Enabled: Yes;<br>                  policy name: Platinum;<br>          Notification action: \"\/bin\/mail -s \\\"Servers Completion Notice\\\"\";<\/pre>\n\n\n\n<p>Now, what if we wanted to look at the actions that are present for this workflow? Using the &#8216;show&#8217; command first again to restrict our view to just the names, the command will look like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>show name  <\/strong>                                     <br>nsradmin> <strong>print type: NSR protection policy action; policy name: Platinum; workflow name: Servers<\/strong><br>                         name: backup; <br><br>                         name: clone;<\/pre>\n\n\n\n<p>Let&#8217;s look at the backup action, shall we?<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>show<\/strong><br>Will show all attributes<br>nsradmin> <strong>print type: NSR protection policy action; policy name: Platinum; workflow name: Servers; name: backup<br><\/strong>                         type: NSR protection policy action;<br>                         name: backup;<br>                      comment: ;<br>               action enabled: Yes;<br>                  policy name: Platinum;<br>                workflow name: Servers;<br>                   Concurrent: No;<br>                  action type: backup;<br>               Backup subtype: traditional;<br>           Force backup level: ;<br>                       period: week;<br>                      Actions: \"incr,incr,incr,incr,incr,incr,full\";<br>     Destination storage node: nsrserverhost;<br>             Destination pool: Backup_01;<br>                    Retention: 2 Months;<br>      Apply DD retention lock: No;<br>            Success threshold: success;<br>          Client can override: clientCanOverride;<br>               action retries: 1;<br>                  Retry delay: 15;<br>    action inactivity timeout: 30;<br>           action parallelism: 100;<br>               Failure impact: continue;<br>                   Soft limit: \"00:00\";<br>                   Hard limit: \"00:00\";<br>          Notification action: \\<br> \"\/root\/bin\/mailer.pl  -s \\\"[NetWorker] Servers Backup Results\\\"\";<br>      Notification execute on: completion;<br>                    Overrides: ;<br>                   start time: ;<br>       DD retention lock time: ;<br>                    Driven by: ;<\/pre>\n\n\n\n<p>Here we can see the individual action associated with the policy and workflow. Like any normal <em>nsradmin<\/em> situation, we can edit these resources, too. For instance, let&#8217;s say I wanted to reduce the action parallelism from 100 down to 80:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>update action parallelism: 80<\/strong><br>           action parallelism: 80;<br>Update? <strong>y<\/strong><br>184066:nsradmin: 'Platinum \/ Servers \/ backup' Action will be updated<br>nsradmin> <strong>print<\/strong><br>                         type: NSR protection policy action;<br>                         name: backup;<br>                      comment: ;<br>               action enabled: Yes;<br>                  policy name: Platinum;<br>                workflow name: Servers;<br>                   Concurrent: No;<br>                  action type: backup;<br>               Backup subtype: traditional;<br>           Force backup level: ;<br>                       period: week;<br>                      Actions: \"incr,incr,incr,incr,incr,incr,full\";<br>     Destination storage node: nsrserverhost;<br>             Destination pool: Backup_01;<br>                    Retention: 2 Months;<br>      Apply DD retention lock: No;<br>            Success threshold: success;<br>          Client can override: clientCanOverride;<br>               action retries: 1;<br>                  Retry delay: 15;<br>    action inactivity timeout: 30;<br>           action parallelism: 80;<br>               Failure impact: continue;<br>                   Soft limit: \"00:00\";<br>                   Hard limit: \"00:00\";<br>          Notification action: \\<br> \"\/root\/bin\/mailer.pl  -s \\\"[NetWorker] Servers Backup Results\\\"\";<br>      Notification execute on: completion;<br>                    Overrides: ;<br>                   start time: ;<br>       DD retention lock time: ;<br>                    Driven by: ;<\/pre>\n\n\n\n<p>Now, what if I wanted to create an entirely new workflow for my &#8216;Platinum&#8217; policy? Since NetWorker will automatically fill in defaults for resources, we can create a &#8216;templated&#8217; workflow very easily that we can then adjust. For instance:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>create type: NSR protection policy workflow; name: Demo; policy name: Platinum<\/strong><br>                         type: NSR protection policy workflow;<br>                         name: Demo;<br>                  policy name: Platinum;<br>Create? <strong>y<\/strong><br>183936:nsradmin: 'Platinum \/ Demo' workflow was successfully created<br>nsradmin> <strong>print type: NSR protection policy workflow; name: Demo; policy name: Platinum<\/strong><br>                         type: NSR protection policy workflow;<br>                         name: Demo;<br>                      comment: ;<br>           Auto start enabled: Yes;<br>            Interval end time: \"21:00\";<br>                        Group: ;<br>                     Interval: \"24:00\";<br>               Restart window: \"12:00\";<br>                   Start time: \"21:00\";<br>                      Enabled: Yes;<br>                  policy name: Platinum;<br>          Notification action: \" \";<\/pre>\n\n\n\n<p>Since I don&#8217;t really need that workflow, I can equally delete it. Because it&#8217;s still the target of my previous print command in my session, that&#8217;s as simple as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nsradmin> <strong>delete<\/strong><br>                         type: NSR protection policy workflow;<br>                         name: Demo;<br>                      comment: ;<br>           Auto start enabled: Yes;<br>            Interval end time: \"21:00\";<br>                        Group: ;<br>                     Interval: \"24:00\";<br>               Restart window: \"12:00\";<br>                   Start time: \"21:00\";<br>                      Enabled: Yes;<br>                  policy name: Platinum;<br>          Notification action: \" \";<br> Delete? <strong>y<\/strong><br> 183985:nsradmin: Platinum \/ Demo Workflow deleted successfully<\/pre>\n\n\n\n<p>(If you&#8217;re unsure, you&#8217;d always fully target the resource you want to delete, but nsradmin will prompt you to confirm as long as you&#8217;re working against a NetWorker server in interactive mode.)<\/p>\n\n\n\n<p>And there you have it: using nsradmin to manipulate Policies, Workflows and Actions in NetWorker 18.2. That&#8217;s yet another good reason to make sure you upgrade ASAP, as far as I&#8217;m concerned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NetWorker 9 saw the introduction of the service-catalogue like Policy\/Workflow\/Action configuration engine in NetWorker, which replaced the previous group based&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7788,"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":[6,16,17],"tags":[1380,1201,1249,653,1501,1379],"class_list":["post-7764","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-basics","category-networker","category-policies","tag-action","tag-command-line","tag-networker","tag-nsradmin","tag-protection-policy","tag-workflow"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2019\/01\/bigStock-Using-a-Keyboard.jpg","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-21e","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/7764","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=7764"}],"version-history":[{"count":3,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/7764\/revisions"}],"predecessor-version":[{"id":7791,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/7764\/revisions\/7791"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media\/7788"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=7764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=7764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=7764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}