<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: jason and jq help in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207365#M169326</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt; If you need the value just for "Host/host_status/UNHEALTHY" you can use this one:&lt;/P&gt;&lt;PRE&gt;jq '.items[0].Clusters.health_report."Host/host_status/UNHEALTHY"'&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 Jun 2018 04:04:08 GMT</pubDate>
    <dc:creator>falbani</dc:creator>
    <dc:date>2018-06-01T04:04:08Z</dc:date>
    <item>
      <title>jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207363#M169324</link>
      <description>&lt;P&gt; I need jason jq help.  I have the health status, but I need to grep the few field only using jq&lt;/P&gt;&lt;P&gt;{
  "href" : "&lt;A href="http://xxxx:8080/api/v1/clusters/?fields=Clusters/health_report" target="_blank"&gt;http://xxxx:8080/api/v1/clusters/?fields=Clusters/health_report&lt;/A&gt;",
  "items" : [
    {
      "href" : "&lt;A href="http://xxxxx:8080/api/v1/clusters/xxxxx" target="_blank"&gt;http://xxxxx:8080/api/v1/clusters/xxxxx&lt;/A&gt;",
      "Clusters" : {
        "cluster_name" : "xxxx",
        "health_report" : {
          "Host/stale_config" : 0,
          "Host/maintenance_state" : 13,
          "Host/host_state/HEALTHY" : 13,
          "Host/host_state/UNHEALTHY" : 0,
          "Host/host_state/HEARTBEAT_LOST" : 0,
          "Host/host_state/INIT" : 0,
          "Host/host_status/HEALTHY" : 12,
          "Host/host_status/UNHEALTHY" : 1,
          "Host/host_status/UNKNOWN" : 0,
          "Host/host_status/ALERT" : 0
        },
        "version" : "HDP-2.6"
      }
    }
  ]&lt;/P&gt;&lt;P&gt;I only want to grep Host/host_status/UNHEALTHY and it's value.  How can I do using jq command&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:17:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207363#M169324</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2022-09-16T13:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207364#M169325</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt; What about this:&lt;/P&gt;&lt;PRE&gt;jq '.items[0].Clusters.health_report'&lt;/PRE&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:01:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207364#M169325</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-01T04:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207365#M169326</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt; If you need the value just for "Host/host_status/UNHEALTHY" you can use this one:&lt;/P&gt;&lt;PRE&gt;jq '.items[0].Clusters.health_report."Host/host_status/UNHEALTHY"'&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:04:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207365#M169326</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-01T04:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207366#M169327</link>
      <description>&lt;PRE&gt;jq '.items[].Clusters.health_report."Host/host_status/UNHEALTHY"'&lt;/PRE&gt;&lt;P&gt;should work. The key name Host/host_status/UNHEALTHY should be quoted to escape the forward slashes in the name.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:09:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207366#M169327</guid>
      <dc:creator>wcbdata</dc:creator>
      <dc:date>2018-06-01T04:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207367#M169328</link>
      <description>&lt;P&gt;Thank  you, I am getting null value.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:10:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207367#M169328</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-06-01T04:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207368#M169329</link>
      <description>&lt;P&gt;thanks a lot , but here is the output&lt;/P&gt;&lt;P&gt;]$ cat file1  | jq '.items[].Clusters.health_report."Host/host_status/UNHEALTHY" '&lt;/P&gt;&lt;P&gt;
jq: error (at &amp;lt;stdin&amp;gt;:19): Cannot iterate over null (null)
]&lt;/P&gt;&lt;P&gt;$ cat file1  | jq '.items[0].Clusters.health_report."Host/host_status/UNHEALTHY" '&lt;/P&gt;&lt;P&gt;
null&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:18:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207368#M169329</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-06-01T04:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207369#M169330</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt; could you share the content of file1? I have run the following successfully&lt;/P&gt;&lt;PRE&gt;curl -u admin:admin -X GET 'http://localhost:8080/api/v1/clusters/?fields=Clusters/health_report' | jq '.items[0].Clusters.health_report."Host/host_status/UNHEALTHY"'&lt;/PRE&gt;&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:21:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207369#M169330</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-01T04:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207370#M169331</link>
      <description>&lt;P&gt;Wow working, thank you so much   what is the diffrence between putting in the file and trying directly through curl&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:35:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207370#M169331</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-06-01T04:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207371#M169332</link>
      <description>&lt;P&gt;Is it possible that something in your original redirection to the file is removing a character or two? As pasted into your original question, it's invalid JSON, which would also give you an error (since jq would be trying to parse a non-parseable string).&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:36:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207371#M169332</guid>
      <dc:creator>wcbdata</dc:creator>
      <dc:date>2018-06-01T04:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207372#M169333</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/81211/ananthankathiramalai.html" nodeid="81211"&gt;@Anpan K&lt;/A&gt; Please  take a moment to login and click the "accept" link on my answer answer.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:37:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207372#M169333</guid>
      <dc:creator>falbani</dc:creator>
      <dc:date>2018-06-01T04:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207373#M169334</link>
      <description>&lt;P&gt;Is it possible that something in your original redirection to the file was removing a character or two? As pasted into your original question, it's invalid JSON, which would also give you an error (since jq would be trying to parse a non-parseable string). Just to be thorough, could you attach the original file?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 04:38:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207373#M169334</guid>
      <dc:creator>wcbdata</dc:creator>
      <dc:date>2018-06-01T04:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: jason and jq help</title>
      <link>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207374#M169335</link>
      <description>&lt;P&gt;one of them shows as unhealthy, how do I find out which component or service is unhealthy in command line.&lt;/P&gt;&lt;P&gt;  "Host/stale_config" : 0,
          "Host/maintenance_state" : 13,
          "Host/host_state/HEALTHY" : 13,
          "Host/host_state/UNHEALTHY" : 0,
          "Host/host_state/HEARTBEAT_LOST" : 0,
          "Host/host_state/INIT" : 0,
          "Host/host_status/HEALTHY" : 12,
          "Host/host_status/UNHEALTHY" : 1,
          "Host/host_status/UNKNOWN" : 0,
          "Host/host_status/ALERT" : 0&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 03:24:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/jason-and-jq-help/m-p/207374#M169335</guid>
      <dc:creator>ananthan_kathir</dc:creator>
      <dc:date>2018-06-06T03:24:33Z</dc:date>
    </item>
  </channel>
</rss>

