<?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 know if API succeeded to restart all services in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179058#M83005</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can make the following API call to check whether the "Restart all required services" got successfully COMPLETD or not? Or it got failed? By keep tracking the "request_status".&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context&lt;/A&gt; | grep -A2 -B3 "Restart all required services"
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;      "Requests" : {
        "cluster_name" : "TestCluster",
        "id" : 789,
        "request_context" : "Restart all required services",
        "request_status" : "COMPLETED"
      }&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If you want to know what got failed then you have the request id (789) to find out what went wrong:&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In order to get more fine grained output like&lt;/STRONG&gt; which Task got failed on which Host during "Restart all required services" operation, you can make the following kind of API call once you know the request id from above calls.&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789/tasks?fields=Tasks/command_detail,Tasks/host_name,Tasks/status" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789/tasks?fields=Tasks/command_detail,Tasks/host_name,Tasks/status&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Sep 2018 07:15:39 GMT</pubDate>
    <dc:creator>jsensharma</dc:creator>
    <dc:date>2018-09-03T07:15:39Z</dc:date>
    <item>
      <title>how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179057#M83004</link>
      <description>&lt;P&gt;with the following API I restart all services in ambari that required restart&lt;/P&gt;&lt;PRE&gt;curl -sH "X-Requested-By: ambari" -u USER:$PASSWD -i &lt;A href="http://$SERVER:8080/api/v1/clusters/$CLUSTER_NAME/requests?fields=Requests/request_status" target="_blank"&gt;http://$SERVER:8080/api/v1/clusters/$CLUSTER_NAME/requests?fields=Requests/request_status&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;how to know if API succeeded to restart all services ?&lt;/P&gt;&lt;P&gt;for example&lt;/P&gt;&lt;P&gt;we get true in case all services restart succsfuly&lt;/P&gt;&lt;P&gt;we get false when one or more services are failed &lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 00:24:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179057#M83004</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-09-03T00:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179058#M83005</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can make the following API call to check whether the "Restart all required services" got successfully COMPLETD or not? Or it got failed? By keep tracking the "request_status".&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context&lt;/A&gt; | grep -A2 -B3 "Restart all required services"
&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output Example:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;      "Requests" : {
        "cluster_name" : "TestCluster",
        "id" : 789,
        "request_context" : "Restart all required services",
        "request_status" : "COMPLETED"
      }&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If you want to know what got failed then you have the request id (789) to find out what went wrong:&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In order to get more fine grained output like&lt;/STRONG&gt; which Task got failed on which Host during "Restart all required services" operation, you can make the following kind of API call once you know the request id from above calls.&lt;/P&gt;&lt;PRE&gt;#  curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789/tasks?fields=Tasks/command_detail,Tasks/host_name,Tasks/status" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests/789/tasks?fields=Tasks/command_detail,Tasks/host_name,Tasks/status&lt;/A&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 07:15:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179058#M83005</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-09-03T07:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179059#M83006</link>
      <description>&lt;P&gt;@Jay I think the following syntax is more fit for my case&lt;/P&gt;&lt;PRE&gt; curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://$SERVER:8080/api/v1/clusters/$cluster_name/requests?fields=Requests/request_status" target="_blank"&gt;http://$SERVER:8080/api/v1/clusters/$cluster_name/requests?fields=Requests/request_status&lt;/A&gt; |  awk '/request_status/' | tail -1  | egrep -iq "FAILED|ABORTED"&lt;/PRE&gt;&lt;P&gt;it will capture the last status , and if this fail or abort then the status is fail&lt;/P&gt;&lt;P&gt;what you think?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 15:11:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179059#M83006</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-09-03T15:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179060#M83007</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If you simply wants to know if the&lt;STRONG&gt; "Restart all required services" &lt;/STRONG&gt;was successfully completed or not then you can simply make the same old API call as following:&lt;/P&gt;&lt;PRE&gt;# curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context&lt;/A&gt; | grep -A2 -B3 "Restart all required services" | grep 'request_status'&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Either the operation will be COMPLETED or FAILED|ABORTED.&lt;/P&gt;&lt;PRE&gt;# curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context" target="_blank"&gt;http://hdfcluster1.example.com:8080/api/v1/clusters/TestCluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context&lt;/A&gt; | grep -A2 -B3 "Restart all required services" | grep 'request_status'
        "request_status" : "COMPLETED"&lt;/PRE&gt;&lt;P&gt;.&lt;BR /&gt;&lt;A nodeid="26229" rel="user" href="#"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 15:22:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179060#M83007</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-09-03T15:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179061#M83008</link>
      <description>&lt;P&gt;@Jay in my case we get the following &lt;/P&gt;&lt;P&gt;and  the expected results should be only the last line ( last restart results )&lt;/P&gt;&lt;PRE&gt;curl -sH "X-Requested-By: ambari" -u admin:admin -X GET &lt;A href="http://$server:8080/api/v1/clusters/$cluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context" target="_blank"&gt;http://$server:8080/api/v1/clusters/$cluster/requests?fields=Requests/id,Requests/request_status,Requests/request_context&lt;/A&gt; | grep -A2 -B3 "Restart all required services" | grep 'request_status'&lt;/PRE&gt;&lt;PRE&gt;        "request_status" : "COMPLETED"
        "request_status" : "COMPLETED"
        "request_status" : "COMPLETED"
        "request_status" : "FAILED"
        "request_status" : "COMPLETED"&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Sep 2018 16:00:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179061#M83008</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-09-03T16:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179062#M83009</link>
      <description>&lt;P&gt;@Jay see also what are the real latest restart status&lt;/P&gt;&lt;PRE&gt;      "href" : "http://master:8080/api/v1/clusters/HDP/requests/186",
      "Requests" : {
        "cluster_name" : "HDP",
        "id" : 186,
        "request_context" : "Restart all components for ZooKeeper",
        "request_status" : "ABORTED"
      }
    },
    {
      "href" : "http://master:8080/api/v1/clusters/HDP/requests/187",
      "Requests" : {
        "cluster_name" : "HDP",
        "id" : 187,
        "request_context" : "Restart all components for Kafka",
        "request_status" : "COMPLETED"
      }
    },
    {
      "href" : "http://master:8080/api/v1/clusters/HDP/requests/188",
      "Requests" : {
        "cluster_name" : "HDP",
        "id" : 188,
        "request_context" : "Restart all components for Kafka",
        "request_status" : "COMPLETED"
      }
    }
  ]&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Sep 2018 16:42:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179062#M83009</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-09-03T16:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179063#M83010</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/26229/uribarih.html" nodeid="26229"&gt;@Michael Bronson&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;By "latest restart status" do you mean a particular "Component" restart (like NameNode, DataNode..etc)   Or a particular Service Restart ("HDFS" service / Yarn Service restart status?)&lt;/P&gt;&lt;P&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, 03 Sep 2018 16:49:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179063#M83010</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2018-09-03T16:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179064#M83011</link>
      <description>&lt;P&gt;@Jay,&lt;/P&gt;&lt;P&gt;as you know we run the API that restart all req services,&lt;/P&gt;&lt;P&gt;and what we mean is that we want to capture only
the last status from restart action , ( so the req ID should be only the last )
,&lt;/P&gt;&lt;P&gt;for example , if now the last req id is 187 ,
then on the next restart it will be 188 , so we want to capture only the status
of req id - 188 ( fail / ok )&lt;/P&gt;&lt;P&gt;but as I mentioned my syntax is give this&lt;/P&gt;&lt;PRE&gt;curl -sH "X-Requested-By: ambari" -u admin:admin -i &lt;A href="http://$SERVER:8080/api/v1/clusters/$cluster_name/requests?fields=Requests/request_status" target="_blank"&gt;http://$SERVER:8080/api/v1/clusters/$cluster_name/requests?fields=Requests/request_status&lt;/A&gt; | awk '/request_status/' | tail -1 | egrep -iq "FAILED|ABORTED"
[[ $? -eq 0 ]] &amp;amp;&amp;amp; echo fail || echo ok&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Sep 2018 17:34:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179064#M83011</guid>
      <dc:creator>mike_bronson7</dc:creator>
      <dc:date>2018-09-03T17:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to know if API succeeded to restart all services</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179065#M83012</link>
      <description>&lt;P&gt;Is there any way to restart an &lt;STRONG&gt;ABORTED&lt;/STRONG&gt; or&lt;STRONG&gt; FAILED &lt;/STRONG&gt;request?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 03:20:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-know-if-API-succeeded-to-restart-all-services/m-p/179065#M83012</guid>
      <dc:creator>Nick</dc:creator>
      <dc:date>2019-06-13T03:20:47Z</dc:date>
    </item>
  </channel>
</rss>

