<?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: Ambari rest api automation in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/289452#M214262</link>
    <description>&lt;P&gt;I have found a solution.&lt;/P&gt;&lt;P&gt;I have forgot to mention that before service is in Maintenance Mode.&lt;/P&gt;&lt;P&gt;To perform action with service in Maintenance Mode, it is needed to use one more parameter in rest API call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Community-Articles/How-to-manage-maintenance-mode-in-Ambari-using-APIs/ta-p/248327" target="_blank" rel="noopener"&gt;This article helped me describes all extra parameters.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 15:02:03 GMT</pubDate>
    <dc:creator>Ioann</dc:creator>
    <dc:date>2020-02-10T15:02:03Z</dc:date>
    <item>
      <title>Ambari rest api automation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288801#M213868</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have got strange permission problem with Ambari.&lt;/P&gt;&lt;P&gt;I have 2 stages, both have same configs.&lt;/P&gt;&lt;P&gt;Only difference in config are information about Postgres DB server.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to stop services with curl.&lt;/P&gt;&lt;P&gt;Curl command:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl -i -u admin:password -H "X-Requested-By: ambari" -X PUT -d "{"HostRoles": {"state": "INSTALLED"}}" https://ambari_server:8443/api/v1/clusters/DEV/hosts/slave01/host_components/NODEMANAGER&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Dev stage it all working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in test stage Ambari throws following message whet ansible triggers service stop:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;INFO [ambari-client-thread-1456334] HostComponentResourceProvider:668 - Ignoring ServiceComponentHost as operation is not allowed,&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What option in ambari is causing this "not allowed"?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 10:11:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288801#M213868</guid>
      <dc:creator>Ioann</dc:creator>
      <dc:date>2020-01-31T10:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari rest api automation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288803#M213870</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/73740"&gt;@Ioann&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your API call does not look correct... the JSON data which you are posting is not right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please try this kind of request.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# curl -k -i -u admin:password -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop NodeManager","operation_level":{"level":"HOST_COMPONENT","cluster_name":"DEV","host_name":"slave01","service_name":"YARN"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' https://ambari_server:8443/api/v1/clusters/DEV/hosts/slave01/host_components/NODEMANAGER&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;If it still fails in one of the env then please share the exact details about those envs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Exact ambari server version from both the Envs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# ambari-server --version
# ambari-server --hash&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. The Before making the API call on the failing cluster please make sure to put the ambari-server.log in "tail" mode so that we can see what kind of logging is appearing in amabri logs when you get&amp;nbsp; following kind of &lt;EM&gt;&lt;STRONG&gt;INFO message&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;Ignoring ServiceComponentHost as operation is not allowed,&lt;/PRE&gt;&lt;P&gt;3. Are you running this API call on both the envs as Ambari Admin user?&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 10:29:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288803#M213870</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2020-01-31T10:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari rest api automation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288819#M213882</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/50614"&gt;@jsensharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Ambari version is the same: 2.7.3.0-139&lt;BR /&gt;2) API call that you provided produces same message in ambari-server.log.&lt;BR /&gt;Here is log message that happens in while api call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;2020-01-31 13:03:03,939 WARN [ambari-client-thread-1469010] HostComponentResourceProvider:1014 - Can not determine request operation level. Operation level property should be specified for this request. 2020-01-31 13:03:03,940 INFO [ambari-client-thread-1469010] HostComponentResourceProvider:969 - Received a updateHostComponent request, clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, request={ clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, publicHostname=null, desiredState=INSTALLED, state=null, desiredStackId=null, staleConfig=null, adminState=null, maintenanceState=null} 
2020-01-31 13:03:03,940 INFO [ambari-client-thread-1469010] HostComponentResourceProvider:668 - Ignoring ServiceComponentHost as operation is not allowed, clusterName=DEV, serviceName=YARN, componentName=NODEMANAGER, hostname=slave01, currentState=STARTED, newDesiredState=INSTALLED 
2020-01-31 13:03:03,941 INFO [ambari-client-thread-1469010] AmbariManagementControllerImpl:2745 - Created 0 stages 
2020-01-31 13:03:04,336 INFO [ambari-client-thread-1469010] MetricsCollectorHAManager:63 - Adding collector host : ambari_server to cluster : DEV​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Yes, i'm using same command like i mentioned in my first message.&lt;BR /&gt;Only differences are cluster name, hostname for ambari server and slave hostname.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2020 13:10:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/288819#M213882</guid>
      <dc:creator>Ioann</dc:creator>
      <dc:date>2020-01-31T13:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari rest api automation</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/289452#M214262</link>
      <description>&lt;P&gt;I have found a solution.&lt;/P&gt;&lt;P&gt;I have forgot to mention that before service is in Maintenance Mode.&lt;/P&gt;&lt;P&gt;To perform action with service in Maintenance Mode, it is needed to use one more parameter in rest API call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.cloudera.com/t5/Community-Articles/How-to-manage-maintenance-mode-in-Ambari-using-APIs/ta-p/248327" target="_blank" rel="noopener"&gt;This article helped me describes all extra parameters.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:02:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Ambari-rest-api-automation/m-p/289452#M214262</guid>
      <dc:creator>Ioann</dc:creator>
      <dc:date>2020-02-10T15:02:03Z</dc:date>
    </item>
  </channel>
</rss>

