{"id":5640,"date":"2015-08-03T08:45:18","date_gmt":"2015-08-02T22:45:18","guid":{"rendered":"http:\/\/nsrd.info\/blog\/?p=5640"},"modified":"2018-12-11T12:04:07","modified_gmt":"2018-12-11T02:04:07","slug":"sampling-device-performance","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2015\/08\/03\/sampling-device-performance\/","title":{"rendered":"Sampling device performance"},"content":{"rendered":"<p>Data Protection Advisor is an excellent tool for producing information about your backup environment, but not everyone has it in their&nbsp;environment.&nbsp;So if you&#8217;re needing to go back to basics to monitor device performance unattended&nbsp;without DPA in your environment, you need to look at&nbsp;<em>nsradmin<\/em>.<\/p>\n<p><a href=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2012\/02\/high-performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3616\" src=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2012\/02\/high-performance.png\" alt=\"High Performance\" width=\"403\" height=\"162\" srcset=\"https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2012\/02\/high-performance.png 403w, https:\/\/nsrd.info\/blog\/wp-content\/uploads\/2012\/02\/high-performance-300x120.png 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/a><\/p>\n<p>Of course, if you&#8217;ve got realtime access to the NetWorker environment you can simply run&nbsp;<em>nsrwatch<\/em> or&nbsp;<em>NMC.<\/em>&nbsp;In either of those systems, you&#8217;ll see&nbsp;device performance information such as, say:<\/p>\n<p>writing at 154 MB\/s, 819 MB<\/p>\n<p>It&#8217;s that same information that you can get by running <em>nsradmin<\/em>.&nbsp;At its most basic, the command will look like the following:<\/p>\n<pre>nsradmin&gt;&nbsp;<strong>show name:; message:<\/strong>\nnsradmin&gt; <strong>print type: NSR device<\/strong><\/pre>\n<p>Now, <em>nsradmin<\/em> itself isn&#8217;t&nbsp;intended to be a full scripting language aka bash, Perl, PowerShell or even (heaven forbid) the DOS batch processing system. So&nbsp;if you&#8217;re going to gather monitoring details about device performance from your NetWorker server, you&#8217;ll need to wrap your own local operating system scripting skills around the process.<\/p>\n<p>You start with your <em>nsradmin<\/em> script. For&nbsp;easy recognition, I always name them with a .nsri extension. I saved mine at \/tmp\/monitor.nsri, and it looked like the following:<\/p>\n<pre>show name:; message:\nprint type: NSR device<\/pre>\n<p>I then created a basic bash script. Now, the thing to be aware of here is that you shouldn&#8217;t run this sort of script too regularly.&nbsp;While NetWorker&nbsp;can sustain a lot of&nbsp;interactions with administrators while it&#8217;s running without an issue, why add to it by polling too frequently? My general feeling is that polling every 5 minutes is more than enough to get a&nbsp;view of how&nbsp;devices are performing overnight.<\/p>\n<p>If I wanted to monitor for 12 hours with a five minute pause between checks, that would be 12 checks an hour &#8211; 144 checks overall. To accomplish this, I&#8217;d use a bash&nbsp;script like the following:<\/p>\n<pre>#!\/bin\/bash\nfor i in `\/usr\/bin\/seq 1 144`\ndo\n        \/bin\/date\n&nbsp; &nbsp; &nbsp; &nbsp; \/usr\/sbin\/nsradmin -i \/tmp\/monitor.nsri\n        \/bin\/echo\n        \/bin\/sleep 300\ndone &gt;&gt; \/tmp\/monitor.log<\/pre>\n<p>You&#8217;ll note from the commands above that I&#8217;m writing to a file called \/tmp\/monitor.log, using &gt;&gt; to append to the file each time.<\/p>\n<p>When executed, this will produce output like the following:<\/p>\n<pre>Sun Aug 02 10:40:32 AEST 2015\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Backup;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"reading, data \";\n&nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Clone;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"writing at 94 MB\/s, 812 MB\";\n&nbsp;\n&nbsp;\nSun Aug 02 10:45:32 AEST 2015\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Backup;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"reading, data \";\n&nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Clone;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"writing at 22 MB\/s, 411 MB\";\n&nbsp;\n&nbsp;\nSun Aug 02 10:50:32 AEST 2015\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Backup;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"reading, data \";\n&nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Clone;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"writing at 38 MB\/s, 81 MB\";\n&nbsp;\n&nbsp;\nSun Aug 02 10:55:02 AEST 2015\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Clone;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"writing at 8396 KB\/s, 758 MB\";\n&nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name: Backup;\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; message: \"reading, data \";<\/pre>\n<p>There you have it. In actual fact, this was the easy bit.&nbsp;The next challenge you&#8217;ll have will be to&nbsp;extract the data from&nbsp;the log file. That&#8217;s scriptable too, but I&#8217;ll leave that to you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data Protection Advisor is an excellent tool for producing information about your backup environment, but not everyone has it in&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,20],"tags":[1238,598,653,732],"class_list":["post-5640","post","type-post","status-publish","format-standard","hentry","category-networker","category-scripting","tag-device","tag-monitoring","tag-nsradmin","tag-performance"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-1sY","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/5640","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=5640"}],"version-history":[{"count":6,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/5640\/revisions"}],"predecessor-version":[{"id":7427,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/5640\/revisions\/7427"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=5640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=5640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=5640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}