{"id":1729,"date":"2010-01-08T14:25:00","date_gmt":"2010-01-08T04:25:00","guid":{"rendered":"http:\/\/nsrd.info\/blog\/?p=1729"},"modified":"2010-01-08T14:25:00","modified_gmt":"2010-01-08T04:25:00","slug":"jobquery-finally-gets-the-duct-tape-removed","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2010\/01\/08\/jobquery-finally-gets-the-duct-tape-removed\/","title":{"rendered":"Jobquery finally gets the duct tape removed"},"content":{"rendered":"<p>Some time ago, I posted that <a title=\"Getting jobquery to talk to you\" href=\"https:\/\/nsrd.info\/blog\/2009\/02\/19\/getting-jobquery-to-talk-to-you\/\" target=\"_blank\">EMC had added a <\/a><em><a title=\"Getting jobquery to talk to you\" href=\"https:\/\/nsrd.info\/blog\/2009\/02\/19\/getting-jobquery-to-talk-to-you\/\" target=\"_blank\">jobquery<\/a><\/em><a title=\"Getting jobquery to talk to you\" href=\"https:\/\/nsrd.info\/blog\/2009\/02\/19\/getting-jobquery-to-talk-to-you\/\" target=\"_blank\"> utility<\/a> to allow probing of the NetWorker jobs database (the one created\/maintained by\u00a0<em>nsrjobd<\/em>). Unfortunately, at the time, jobquery had been somewhat muzzled \u2013 you could give it commands, and it would spit output back to you, but it would never give you any indication that it was waiting for you. No prompting, no nothing. It made working with jobquery somewhat of a hassle.<\/p>\n<p>Thankfully though, as of NetWorker 7.6, the duct tape has been fully removed and jobquery will happily give you that meta-information:<\/p>\n<pre>\n<div id=\"_mcePaste\">[root@nox ~]# jobquery<\/div>\n<div id=\"_mcePaste\">NetWorker jobs query utility.<\/div>\n<div id=\"_mcePaste\">Use the \"help\" command for help.<\/div>\n<div id=\"_mcePaste\">jobquery&gt; help<\/div>\n<div id=\"_mcePaste\">Legal commands are:<\/div>\n<div id=\"_mcePaste\">          print [query] (set current query)<\/div>\n<div id=\"_mcePaste\">           show [attrlist]<\/div>\n<div id=\"_mcePaste\">          types<\/div>\n<div id=\"_mcePaste\">            all<\/div>\n<div id=\"_mcePaste\">           quit<\/div>\n<div id=\"_mcePaste\">           help [command]<\/div>\n<div id=\"_mcePaste\">              . [query]<\/div>\n<div id=\"_mcePaste\">              ? [command]<\/div>\n<div id=\"_mcePaste\">Where:<\/div>\n<div id=\"_mcePaste\">        query ::= attrlist<\/div>\n<div id=\"_mcePaste\">        attrlist ::= attribute [; attribute]*<\/div>\n<div id=\"_mcePaste\">        attribute ::= name [: [value [, value]* ]<\/div>\n<div id=\"_mcePaste\">jobquery&gt; types<\/div>\n<div id=\"_mcePaste\">     Known types: job indication, save job, probe job,<\/div>\n<div id=\"_mcePaste\">                  savegroup job, session info, index save job,<\/div>\n<div id=\"_mcePaste\">                  savefs job, bootstrap save job, utility job,<\/div>\n<div id=\"_mcePaste\">                  active job db;<\/div><\/pre>\n<p>Now sure, in previous versions you could type commands in and get output, but not having the prompt to tell you when jobquery was waiting, or when it was working, or when (as I originally thought) it was hanging on startup, is a fairly critical part in having a useful user interface.<\/p>\n<p>Having a responsive user interface makes jobquery a little nicer to work with. For instance, let&#8217;s look at the &#8220;save job&#8221; type and run a backup. There&#8217;s a lot of fields in the &#8220;save job&#8221; resource type, so I&#8217;m going to limit it as follows:<\/p>\n<pre>jobquery&gt; show command:; group name:; host:; job state:; level:\njobquery&gt; print type: save job\n                     command: \n\"save -s nox.anywebdb.com -g \"Staging Servers\" -LL -f - -m nox\n -t 1262601936 -l incr -q -W 78 -N \/d\/nsr\/01 \/d\/nsr\/01\";\n                  group name: Staging Servers;\n                        host: nox;\n                   job state: COMPLETED;\n                       level: incr;<\/pre>\n<div><span style=\"font-family: Consolas, Monaco, 'Courier New', Courier, monospace; font-size: small;\"><span style=\"line-height: 18px; white-space: pre;\">&#8230;<\/span><\/span><\/div>\n<p>Then, once the backup starts, if I run (and abbreviate the output, remembering it shows all jobs in the database!), I can see:<\/p>\n<pre>                     command: \nsavepnpc -s nox.anywebdb.com -g archon -LL -f - -m archon -t 1262818820 -l in\ncr -q -W 78 -N \/ \/;\n                  group name: archon;\n                        host: archon;\n                   job state: ACTIVE;\n                       level: incr;<\/pre>\n<p>However, the &#8220;ACTIVE&#8221; state simply means that the job is actively queued, not that it&#8217;s actually sending data. If you want to only see jobs that are actively backing up rather than just simply active, you&#8217;d look for a job state of &#8220;SESSION ACTIVE&#8221;:<\/p>\n<pre>jobquery&gt; print type: save job; job state: SESSION ACTIVE\n                     command: \nsavepnpc -s nox.anywebdb.com -g archon -LL -f - -m archon -t 1262818820 -l in\ncr -q -W 78 -N \/ \/;\n                  group name: archon;\n                        host: archon;\n                   job state: SESSION ACTIVE;\n                       level: incr;\n\n                     command: \nsavepnpc -s nox.anywebdb.com -g archon -LL -f - -m archon -t 1262818814 -l in\ncr -q -W 78 -N \/Volumes\/Yu \/Volumes\/Yu;\n                  group name: archon;\n                        host: archon;\n                   job state: SESSION ACTIVE;\n                       level: incr;<\/pre>\n<div>What does this mean? For a start, it provides a way of checking (outside of NMC) which jobs are currently queued to run, and which jobs are actually running. As is always the case, the better you can monitor regardless of circumstance, the more likely you are to be able to understand your server state. Now that jobquery however at least tells us when it&#8217;s waiting for input, I&#8217;m looking forward to properly exploring what it can do. I previously said that I anticipated it being a useful tool. Now I know it&#8217;s going to be a useful tool, and will do some further digging\/testing and do a future posting on using it further to track activities.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Some time ago, I posted that EMC had added a jobquery utility to allow probing of the NetWorker jobs database&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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,9,16,20],"tags":[511],"class_list":["post-1729","post","type-post","status-publish","format-standard","hentry","category-architecture","category-databases","category-networker","category-scripting","tag-jobquery"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-rT","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/1729","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=1729"}],"version-history":[{"count":0,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/1729\/revisions"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=1729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=1729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=1729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}