{"id":46,"date":"2009-02-01T10:03:12","date_gmt":"2009-01-31T23:03:12","guid":{"rendered":"http:\/\/nsrd.wordpress.com\/?p=46"},"modified":"2018-12-12T16:37:21","modified_gmt":"2018-12-12T06:37:21","slug":"basics-mminfo-savetime","status":"publish","type":"post","link":"https:\/\/nsrd.info\/blog\/2009\/02\/01\/basics-mminfo-savetime\/","title":{"rendered":"Basics &#8211; mminfo, savetime and greater than\/less than"},"content":{"rendered":"<p>Take a basic mminfo query, add someone not familiar with how NetWorker stores and works with dates\/times, and you have instant chaos*. In this post I want to help people who are just starting out with mminfo understand how it works with dates.<\/p>\n<p>So let&#8217;s look at a basic query that tends to cause a lot of confusion:<\/p>\n<pre># mminfo -q \"client=archon,savetime&lt;=2 weeks ago\"<\/pre>\n<p>As a long-term NetWorker user, and implementation consultant\/support consultant, not to mention a long term member of the NetWorker mailing list, this question seems to come up fairly frequently. The output appears &#8220;broken&#8221; &#8211; rather than being &#8220;savetime less than or equal to two weeks ago&#8221;, we instead get all backups for the client archon where the savetime is <em>greater than or equal to<\/em> two weeks ago.<\/p>\n<p><em>&#8216;Huh?&#8217;<\/em> I hear you ask.<\/p>\n<p>Indeed, this is oft-used as an example of how &#8220;broken&#8221; NetWorker is. In fact, the real state is far more prosaic.<\/p>\n<p>NetWorker stores and works with times as seconds since the(\/an) epoch. When you supply dates to NetWorker &#8211; either in the fuzzy format above, or as a literal date string, it converts that date into a timestamp of seconds since the(\/an) epoch. (You can if you want find out what a savetime is in seconds, rather than an interpreted date any time you wish in mminfo by choosing a report specification of &#8216;nsavetime&#8217;.)<\/p>\n<p>So if you then think of the query:<\/p>\n<pre># mminfo -q \"client=archon,savetime&lt;=2 weeks ago\"<\/pre>\n<p>It has a different meaning. You&#8217;re actually asking NetWorker:<\/p>\n<ul>\n<li>Convert &#8216;2 weeks ago&#8217; into seconds offset from &#8216;now&#8217;. Let&#8217;s call that <em>Z<\/em>.<\/li>\n<li>Give me all the backups for the client &#8216;archon&#8217; where the savetime is less than or equal to <em>Z<\/em>.<\/li>\n<\/ul>\n<p>If you don&#8217;t like to think of it as all referring to seconds since an epoch, there&#8217;s another, perhaps simpler way of thinking about it &#8211; that being:<\/p>\n<ul>\n<li>Treat &#8220;&lt;&#8221; as meaning <em><strong>before<\/strong><\/em>.<\/li>\n<li>Treat &#8220;&gt;&#8221; as meaning <em><strong>after<\/strong><\/em>.<\/li>\n<\/ul>\n<p>Thus, in this scenario, the query:<\/p>\n<pre># mminfo -q \"client=archon,savetime&lt;=2 weeks ago\"<\/pre>\n<p>Can be interpreted to mean, &#8220;give me all backups of the client archon taken <em>before<\/em> two weeks ago&#8221;.<\/p>\n<p>You&#8217;re obviously welcome to use whichever interpretation you feel makes more sense &#8211; seconds\/math or before\/after &#8211; it doesn&#8217;t really matter which. Once you get the hang of this though mminfo will make a lot more sense.<\/p>\n<p>&#8212;<\/p>\n<p>* I&#8217;ve unfortunately seen someone who got &lt; and &gt; wrong (and didn&#8217;t check their results) relabel all tapes in a tape library that had backups younger than 3 months, rather than older than 3 months. Hence, &#8216;chaos&#8217; is an appropriate term.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Take a basic mminfo query, add someone not familiar with how NetWorker stores and works with dates\/times, and you have&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":[16,20],"tags":[594,861,1253],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-networker","category-scripting","tag-mminfo","tag-savetime","tag-scripting"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pKpIN-K","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/46","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=46"}],"version-history":[{"count":1,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":7698,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions\/7698"}],"wp:attachment":[{"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nsrd.info\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}