<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 29/03/2018 15:59, Rob Pomeroy wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMRdZXb2HfNrqEpxTyoyo75a9cYE2My5fBmr7TR1niYn8RZGZw@mail.gmail.com">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>This probably should be raised as a feature request/issue -
          but I wanted the views of those on this list first? (Also when
          I looked in the issue log, there are many pages of issues
          there, so no point adding another one if it wouldn't be a
          priority.) :-)</div>
        <div><br>
        </div>
        <div>I'd really like to be able to search by the compliant state
          of nodes. It'd be handy to be able to pull out just those
          nodes that require attention. I have dozens and dozens of
          managed nodes now and it's getting harder to find those that
          need to be fixed.</div>
        <div><br>
        </div>
        <div>So two things I'd be interested in:</div>
        <div><br>
        </div>
        <div>
          <ol>
            <li>A search/dynamic group based on whether a not a node is
              in a compliant state.</li>
            <li>A way of finding nodes based on a period between today's
              date and the last inventory received. You can of course
              search based on a fixed date, but I'm not sure what, if
              any, functions can be used in the search box. Something
              like last inventory date > now() - 1 day.</li>
          </ol>
          <div><br>
          </div>
          <div>I couldn't find anything like this in the online
            documentation or the interface. <span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">But
              perhaps I've overlooked something that already exists?</span></div>
          <div><span
style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>
            </span></div>
          <div>Cheers,</div>
          <div><br>
          </div>
          <div>Rob</div>
          <div>
            <div class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div dir="ltr">
                          <div dir="ltr">
                            <div dir="ltr">
                              <div><font color="#351c75"><br>
                                </font></div>
                              <div>
                                <div style="font-size:small"><span
                                    style="color:rgb(53,28,117)">-</span></div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Hello Rob, <br>
    <br>
    Firstly, just to be sure you didn't miss that: you can sort nodes in
    the "all node" list by compliance (click on the "Compliance" column
    header to do so), so that help put the one with red on top. <br>
    <br>
    Now, for your requests: <br>
    <br>
    1/ This one is interesting, but it's hard to get right in the
    "group" workflow. First, there is the semantic problem about what is
    the "compliance" number you want to match on. Global compliance ?
    One state in particular ? It can be sorted out, but with the current
    group search UI, our tests make it cumbersome. <br>
    But then, the real problem is in the feedback loop and
    hysteris/instabilities it may introduce in your system. Imagine you
    build such a group and make a rule on them. Now, the rule depends on
    its outcome, with a propagation travel time to take in account. Node
    may enter and get out fast ("fast" as in "not many tickes",
    considering a "tick" at rudder scale to be 5min). So that will
    multiply policy generation, but the time they reach the nodes,
    perhaps the dyn group already change again...<br>
    <br>
    So. To sum up, it is a not obvious problem to sort out cleanly, and
    we are not yet at the point where we can go there. <br>
    <br>
    So, in the meantime, we are solving the much more easier problem of
    getting nice custom reports on compliance (read-only, no feedback
    loop, nice graphs :). It will be through a "compliance report"
    plugin that allows to build custom reports with history of
    compliance evolution on selected nodes/groups/rules/etc. It will be
    ready in the very short term (coming weeks) and part of a commercial
    offer for Rudder. If you are interested to learn more, I can put you
    in touch with the relevant person. <br>
    <br>
    And in a hacky-already-work way of doing things, you can use API +
    jq (<a class="moz-txt-link-freetext" href="https://stedolan.github.io/jq">https://stedolan.github.io/jq</a>) to do what you want. For example,
    to get all nodes with global compliance < 80%, you can do:<br>
    <br>
    <blockquote><font size="-2">% curl -k -H "X-API-Token: xxxx" -H
        "Content-Type: application/json" -X GET
        '<a class="moz-txt-link-freetext" href="https://....rudder/api/latest/compliance/nodes?level=1">https://....rudder/api/latest/compliance/nodes?level=1</a>' |<b> jq
          '.data.nodes | sort_by(.compliance) | map(select(.compliance
          < 80))' </b><br>
        [<br>
        {<br>
          "id": "717b63d1-01fe-4d4f-a7e5-cfb7c0d47b4f",<br>
          "name": "debian-8-64.labo.normation.com",<br>
          "compliance": 0,<br>
          "mode": "full-compliance",<br>
          "complianceDetails": {<br>
            "unexpectedMissingComponent": 49.14,<br>
            "unexpectedUnknownComponent": 50.86<br>
          }<br>
        }<br>
        {<br>
          "id": "0c846655-cb06-486f-ace4-eaeb11372097",<br>
          "name": "centos-7-64.labo.normation.com",<br>
          "compliance": 69.57,<br>
          "mode": "full-compliance",<br>
          "complianceDetails": {<br>
            "successAlreadyOK": 30.43,<br>
            "successNotApplicable": 34.78,<br>
            "error": 30.43,<br>
            "successRepaired": 4.35<br>
          }<br>
        }<br>
        ...<br>
        ]</font></blockquote>
    <br>
    2/ There is no particular function in the search box appart from
    "is:" (for rule, node, group, parameter, directive, rule) and "in:"
    (for attributes), as explained in the doc here:
    <a class="moz-txt-link-freetext" href="https://orchestrateur-4.labo.normation.com/rudder-doc/search-nodes.html">https://orchestrateur-4.labo.normation.com/rudder-doc/search-nodes.html</a>
    . Having a more complexe search language for the quick search would
    be nice. Perhaps could you mind opening an user story for that?<br>
    <br>
    In the meantime, you can again rely on APIs (yeah, that's our swiss
    army knife ;). It will fullfill what I understand of your need, more
    or less. <br>
    More or less because medling with date format and date difference is
    a nightmare in any language, put it's even worse in the middle of a
    jq directive. So in place of "selected range date", I give you
    "sorted, and select a subsection of the resulting array". <br>
    <br>
    This command will give you the 3 nodes with the oldest last
    inventory date (you can choose any slice in the resulting array, of
    course): <br>
    <blockquote><tt>% curl -k -H "X-API-Token:
        dTxvl4eL8p3YqvwefVbaJLdy8DyEt7Vw" -H "Content-Type:
        application/json" -X GET
'<a class="moz-txt-link-freetext" href="https://orchestrateur-4.labo.normation.com/rudder/api/latest/nodes?include=minimal,lastInventoryDate">https://orchestrateur-4.labo.normation.com/rudder/api/latest/nodes?include=minimal,lastInventoryDate</a>'
        | <b>jq '.data.nodes | sort_by(.lastInventoryDate) | .[0:3]'</b></tt><tt><br>
      </tt><tt><br>
      </tt><tt>[</tt><tt><br>
      </tt><tt>  {</tt><tt><br>
      </tt><tt>    "id": "fc846655-cb06-486f-ace4-eaeb11372097",</tt><tt><br>
      </tt><tt>    "hostname": "sovma136",</tt><tt><br>
      </tt><tt>    "status": "accepted",</tt><tt><br>
      </tt><tt>    "lastInventoryDate": "2016-12-05 15:12"</tt><tt><br>
      </tt><tt>  },</tt><tt><br>
      </tt><tt>  {</tt><tt><br>
      </tt><tt>    "id": "8b168194-c0b4-41ab-b2b5-9571a8906d59",</tt><tt><br>
      </tt><tt>    "hostname": "debian-5-64.labo.normation.com",</tt><tt><br>
      </tt><tt>    "status": "accepted",</tt><tt><br>
      </tt><tt>    "lastInventoryDate": "2017-02-01 17:06"</tt><tt><br>
      </tt><tt>  },</tt><tt><br>
      </tt><tt>  {</tt><tt><br>
      </tt><tt>    "id": "94b6d33d-a23e-46b9-b5f8-971751bebcbb",</tt><tt><br>
      </tt><tt>    "hostname": "ubuntu-16-04-64",</tt><tt><br>
      </tt><tt>    "status": "accepted",</tt><tt><br>
      </tt><tt>    "lastInventoryDate": "2018-03-30 02:02"</tt><tt><br>
      </tt><tt>  }</tt><tt><br>
      </tt><tt>]</tt><br>
    </blockquote>
    <br>
    And here come the link toward jq manual:
    <a class="moz-txt-link-freetext" href="https://stedolan.github.io/jq/manual">https://stedolan.github.io/jq/manual</a><br>
    jq is globally hard, but you can get a lots of things done with it.
    <br>
    <br>
    Hope it helps, <br>
    <br>
    <div class="moz-signature">-- <br>
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <style type="text/css"><!--
    a.redlink:link { color: #1782E6; text-decoration: none; }
    a.redlink:visited { color: #1782E6; text-decoration: none; }
    .sig { font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: small; }
    .sigsmall { font-family: 'Century Gothic', CenturyGothic, AppleGothic, sans-serif; font-size: x-small; }
  --></style>
      <br>
      <br>
      <table width="380" cellspacing="2" cellpadding="0" border="0">
        <tbody>
          <tr>
            <td colspan="2">
              <hr></td>
          </tr>
          <tr>
            <td colspan="2"><b><img alt=""
                  src="cid:part1.807EE64B.7C2D9DF2@normation.com"
                  width="50" align="left" height="50" hspace="10"> <span
                  class="sig">François ARMAND</span></b><br>
              <span class="sig"><i>Co-founder & CTO</i></span><br>
              <span class="sig"><a class="redlink"
                  href="http://www.normation.com">Normation</a></span> </td>
          </tr>
          <tr>
            <td colspan="2">
              <hr></td>
          </tr>
          <tr>
            <td colspan="2"><span class="sigsmall"><b>87 rue de Turbigo,
                  75003 Paris, France</b></span></td>
          </tr>
          <tr>
            <td><span class="sigsmall">Telephone:</span></td>
            <td><span class="sigsmall">+33 (0)1 83 62 99 23</span></td>
          </tr>
          <tr>
            <td><span class="sigsmall">Mobile:</span></td>
            <td><span class="sigsmall">+33 (0)6 63 37 60 55</span></td>
          </tr>
          <tr>
            <td colspan="2">
              <hr></td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>