<?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: how to print the hosts and IP address for each host By API in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228919#M67353</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@uri ben-ari&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please try something like following:&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | awk '{print $NF}' &amp;gt; /tmp/hosts_details.txt;  sed -e '1,2d' -e s'/--//g'  -e 's/\n//g' -e 's/"//g' -e '/^$/d' /tmp/hosts_details.txt | awk 'NR%2{printf "%s ",$0;next;}1&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | awk '{print $NF}' &amp;gt; /tmp/hosts_details.txt;  sed -e '1,2d' -e s'/--//g'  -e 's/\n//g' -e 's/"//g' -e '/^$/d' /tmp/hosts_details.txt | awk 'NR%2{printf "%s ",$0;next;}1'

amb25101.example.com 172.10.116.149
amb25102.example.com 172.10.116.148
amb25103.example.com 172.10.116.151
amb25104.example.com 172.10.116.150&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;&lt;/A&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 28 Aug 2017 13:08:28 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2017-08-28T13:08:28Z</dc:date>
    <item>
      <title>how to print the hosts and IP address for each host By API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228916#M67350</link>
      <description>&lt;P&gt;the following API give only the hosts from the amabri server&lt;/P&gt;&lt;P&gt;curl -sH "X-Requested-By: ambari" -u admin:admin -i  &lt;A href="http://localhost:8080/api/v1/hosts" target="_blank"&gt;http://localhost:8080/api/v1/hosts&lt;/A&gt;&lt;/P&gt;&lt;P&gt;is it possible to change the API in way that we can get also the IP address for each host?&lt;/P&gt;&lt;P&gt;the following example print only the hosts :&lt;/P&gt;&lt;P&gt;curl -sH "X-Requested-By: ambari" -u admin:admin -i  &lt;A href="http://localhost:8080/api/v1/hosts" target="_blank"&gt;http://localhost:8080/api/v1/hosts&lt;/A&gt; | grep host_name | sed s'/"//g' | awk '{print $NF}' &lt;/P&gt;&lt;P&gt;master01&lt;/P&gt;&lt;P&gt;master02&lt;/P&gt;&lt;P&gt;master03&lt;/P&gt;&lt;P&gt;worker01&lt;/P&gt;&lt;P&gt;worker02&lt;/P&gt;&lt;P&gt;expected results&lt;/P&gt;&lt;P&gt;master01 192.9.200.12&lt;/P&gt;&lt;P&gt;master02 192.9.200.13&lt;/P&gt;&lt;P&gt;master03 192.9.200.14&lt;/P&gt;&lt;P&gt;worker01 192.9.200.15&lt;/P&gt;&lt;P&gt;worker02 192.9.200.16&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 12:09:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228916#M67350</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2017-08-28T12:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to print the hosts and IP address for each host By API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228917#M67351</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@uri ben-ari&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can try something like following:&lt;/P&gt;&lt;PRE&gt;# curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | sed s'/"//g' | awk '{print $NF}' &lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;# curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | sed s'/"//g' | awk '{print $NF}' 


&lt;A href="http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt;,
[
--
amb25101.example.com,
172.10.116.149
--
amb25102.example.com,
172.10.116.148
--
amb25103.example.com,
172.10.116.151
--
amb25104.example.com,
172.10.116.150&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 12:31:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228917#M67351</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-08-28T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to print the hosts and IP address for each host By API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228918#M67352</link>
      <description>&lt;P&gt;is it possible to print as the following order  &lt;/P&gt;&lt;P&gt;amb25101.example.com  172.10.116.149&lt;/P&gt;&lt;P&gt;amb25102.example.com  172.10.116.15&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 12:41:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228918#M67352</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2017-08-28T12:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to print the hosts and IP address for each host By API</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228919#M67353</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@uri ben-ari&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please try something like following:&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://localhost:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | awk '{print $NF}' &amp;gt; /tmp/hosts_details.txt;  sed -e '1,2d' -e s'/--//g'  -e 's/\n//g' -e 's/"//g' -e '/^$/d' /tmp/hosts_details.txt | awk 'NR%2{printf "%s ",$0;next;}1&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip" target="_blank"&gt;http://amb25101.example.com:8080/api/v1/hosts?fields=Hosts/host_name,Hosts/ip&lt;/A&gt; | grep -A 1 host_name | awk '{print $NF}' &amp;gt; /tmp/hosts_details.txt;  sed -e '1,2d' -e s'/--//g'  -e 's/\n//g' -e 's/"//g' -e '/^$/d' /tmp/hosts_details.txt | awk 'NR%2{printf "%s ",$0;next;}1'

amb25101.example.com 172.10.116.149
amb25102.example.com 172.10.116.148
amb25103.example.com 172.10.116.151
amb25104.example.com 172.10.116.150&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2017 13:08:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-print-the-hosts-and-IP-address-for-each-host-By-API/m-p/228919#M67353</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-08-28T13:08:28Z</dc:date>
    </item>
  </channel>
</rss>

