{"id":6394,"date":"2017-08-05T08:36:23","date_gmt":"2017-08-04T22:36:23","guid":{"rendered":"http:\/\/nsrd.info\/blog\/?p=6394"},"modified":"2018-12-11T08:14:41","modified_gmt":"2018-12-10T22:14:41","slug":"basics-running-workflows-manually","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2017\/08\/05\/basics-running-workflows-manually\/","title":{"rendered":"Basics &#8211; Running Workflows Manually"},"content":{"rendered":"<p>It may be something to do with my long Unix background, or maybe it&#8217;s because my first system administration job saw me administer systems over insanely low link speeds, but I&#8217;m a big fan of being able to use the CLI whenever I&#8217;m in a hurry or just want to do something small. GUIs may be nice, but CLIs are fun.<\/p>\n<p>Under NetWorker 8 and below, if you wanted to run a server initiated backup job from the command line, you&#8217;d use the&nbsp;<em>savegrp<\/em> command. Under NetWorker 9 onwards, groups are there only as containers, and what you really need to work on are&nbsp;<em>workflows<\/em>.<\/p>\n<p><a href=\"https:\/\/nsrd.info\/blog\/2017\/08\/05\/basics-running-workflows-manually\/bigstock-workflow\/\" rel=\"attachment wp-att-6395\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6395\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/bigStock-Workflow.jpg\" alt=\"bigStock Workflow\" width=\"900\" height=\"605\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/bigStock-Workflow.jpg 900w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/bigStock-Workflow-300x202.jpg 300w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/bigStock-Workflow-768x516.jpg 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p>There&#8217;s a command for that \u2013 <em>nsrworkflow<\/em>.<\/p>\n<p>At heart it&#8217;s a very simple command:<\/p>\n<pre># <strong>nsrworkflow -p <em>policy<\/em> -w <em>workflow<\/em><\/strong><\/pre>\n<p>That&#8217;s enough to kick off a backup job. But there&#8217;s some additional options that make it more useful, particularly in larger environments. To start with, you&#8217;ve got the -a option, which I really like. That tells nsrworkflow you want to perform an &#8216;adhoc&#8217; execution of a job. Why is that important? Say you&#8217;ve got a job you really need to run today but it&#8217;s configured to skip &#8230; running it in adhoc will disregard the skip for you.<\/p>\n<p>The -A option allows you to specify specific overrides to actions. For instance, if I wanted to run a job workflow today from the command line as a&nbsp;<em>full<\/em> rather than an incremental, I might use something like the following:<\/p>\n<pre># <strong>nsrworkflow -p Gold -w Finance -A \"backup -l full\"<\/strong><\/pre>\n<p>The -A option there effectively allows me to specify overrides for individual actions &#8211; name the action (backup) and name the override (-l full).<\/p>\n<p>Another useful option is&nbsp;<em>-c component<\/em> which allows you to specify to run the job on just a single or a small list of components \u2013 e.g., clients. Extending from the above, if I wanted to run a full for a single client called <em>orilla<\/em>, it might look as follows:<\/p>\n<pre># <strong>nsrworkflow -p Gold -w Finance -c orilla -A \"backup -l full\"<\/strong><\/pre>\n<p>Note that specifying the action there doesn&#8217;t mean it&#8217;s the only action you&#8217;ll run &#8211; you&#8217;ll still run the other actions in the workflow (e.g., a clone operation, if it&#8217;s configured) &#8211; it just means you&#8217;re specifying an override for the nominated action.<\/p>\n<p>For virtual machines, the way I&#8217;ve found easiest to start an individual client is using the&nbsp;<em>vmid<\/em> flag &#8211; effectively what the saveset name is for a virtual machine started via a proxy.&nbsp;Now, to get that name, you have to do a bit of mminfo scripting:<\/p>\n<pre># <strong>mminfo -k -r vmname,name<\/strong>\n\n vm_name name\nvulcan vm:500f21cd-5865-dc0d-7fe5-9b93fad1a059:caprica.turbamentis.int\nvulcan vm:500f21cd-5865-dc0d-7fe5-9b93fad1a059:caprica.turbamentis.int\nwin01 vm:500f444e-4dda-d29d-6741-d23d6169f158:caprica.turbamentis.int\nwin01 vm:500f444e-4dda-d29d-6741-d23d6169f158:caprica.turbamentis.int\npicon vm:500f6871-2300-47d4-7927-f3c799ee200b:caprica.turbamentis.int\npicon vm:500f6871-2300-47d4-7927-f3c799ee200b:caprica.turbamentis.int\nwin02 vm:500ff33e-2f70-0b8d-e9b2-6ef7a5bf83ed:caprica.turbamentis.int\nwin02 vm:500ff33e-2f70-0b8d-e9b2-6ef7a5bf83ed:caprica.turbamentis.int\nvega vm:5029095d-965e-2744-85a4-70ab9efcc312:caprica.turbamentis.int\nvega vm:5029095d-965e-2744-85a4-70ab9efcc312:caprica.turbamentis.int\nkrell vm:5029e15e-3c9d-18be-a928-16e13839f169:caprica.turbamentis.int\nkrell vm:5029e15e-3c9d-18be-a928-16e13839f169:caprica.turbamentis.int\nkrell vm:5029e15e-3c9d-18be-a928-16e13839f169:caprica.turbamentis.int<\/pre>\n<p>What you&#8217;re looking for is the vm:a-b-c-d set, stripping out the :vcenter at the end of the ID.<\/p>\n<p>Now, I&#8217;m a big fan of not running extra commands unless I really need to, so I&#8217;ve actually got a&nbsp;<strong><em><a href=\"https:\/\/nsrd.info\/utils\/vmmap.zip\" target=\"_blank\" rel=\"noopener\">vmmap.pl<\/a><\/em><\/strong> Perl script which you&#8217;re free to download and adapt\/use as you need to streamline that process. Since my lab is pretty basic, the script is too, though I&#8217;ve done my best to make the code straight forward. You simply run vmmap.pl as follows:<\/p>\n<pre>[root@orilla bin]# <strong>vmmap.pl -c krell<\/strong>\nvm:5029e15e-3c9d-18be-a928-16e13839f169<\/pre>\n<p>With ID in hand, we can invoke nsrworkflow as follows:<\/p>\n<pre># <strong>nsrworkflow -p VMware -w \"Virtual Machines\" -c&nbsp;vm:5029e15e-3c9d-18be-a928-16e13839f169<\/strong><\/pre>\n<pre>133550:nsrworkflow: Starting Protection Policy 'VMware' workflow 'Virtual Machines'.\n123316:nsrworkflow: Starting action 'VMware\/Virtual Machines\/backup' with command: 'nsrvproxy_save -s orilla.turbamentis.int -j 705080 -L incr -p VMware -w \"Virtual Machines\" -A backup'.\n123321:nsrworkflow: Action 'VMware\/Virtual Machines\/backup's log will be in '\/nsr\/logs\/policy\/VMware\/Virtual Machines\/backup_705081.raw'.\n123325:nsrworkflow: Action 'VMware\/Virtual Machines\/backup' succeeded.\n123316:nsrworkflow: Starting action 'VMware\/Virtual Machines\/clone' with command: 'nsrclone -a \"*policy name=VMware\" -a \"*policy workflow name=Virtual Machines\" -a \"*policy action name=clone\" -s orilla.turbamentis.int -b BoostClone -y \"1 Months\" -o -F -S'.\n123321:nsrworkflow: Action 'VMware\/Virtual Machines\/clone's log will be in '\/nsr\/logs\/policy\/VMware\/Virtual Machines\/clone_705085.raw'.\n123325:nsrworkflow: Action 'VMware\/Virtual Machines\/clone' succeeded.\n133553:nsrworkflow: Workflow 'VMware\/Virtual Machines' succeeded.<\/pre>\n<p>Of course, if you are in front of NMC, you can start individual clients from the GUI if you want to:<\/p>\n<p><a href=\"https:\/\/nsrd.info\/blog\/2017\/08\/05\/basics-running-workflows-manually\/01_start_individual_client\/\" rel=\"attachment wp-att-6399\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6399\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/01_start_individual_client.png\" alt=\"Starting an Individual Client\" width=\"553\" height=\"359\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/01_start_individual_client.png 553w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/01_start_individual_client-300x195.png 300w\" sizes=\"auto, (max-width: 553px) 100vw, 553px\" \/><\/a><a href=\"https:\/\/nsrd.info\/blog\/2017\/08\/05\/basics-running-workflows-manually\/02_start_individual_client\/\" rel=\"attachment wp-att-6400\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6400\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client.png\" alt=\"Starting an Individual Client\" width=\"528\" height=\"533\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client.png 528w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-150x150.png 150w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-297x300.png 297w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-144x144.png 144w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-96x96.png 96w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-24x24.png 24w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-36x36.png 36w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-48x48.png 48w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2017\/08\/02_start_individual_client-64x64.png 64w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/p>\n<p>But it&#8217;s always worth knowing what your command line options are!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It may be something to do with my long Unix background, or maybe it&#8217;s because my first system administration job&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"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],"tags":[1380,1395,1201,1393,749,1223,1394,1379],"class_list":["post-6394","post","type-post","status-publish","format-standard","hentry","category-networker","tag-action","tag-adhoc","tag-command-line","tag-nsrworkflow","tag-policy","tag-savegrp","tag-start-workflow","tag-workflow"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-1F8","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/6394","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=6394"}],"version-history":[{"count":9,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/6394\/revisions"}],"predecessor-version":[{"id":7379,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/6394\/revisions\/7379"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=6394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=6394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=6394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}