<?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: Is there a way to execute Ambari service checks in bulk? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107293#M15929</link>
    <description>&lt;P&gt;I've published a CLI tool to handle all of this more easily including auto-generating the payload, inferring the cluster name and services to check etc. It has --help with lots of options, including features for --wait which tracks the progress status of the request and returns only when complete, and --cancel to stop any outstanding service checks if you accidentally launch too many by playing with the tool &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can find it on my github here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/harisekhon/pytools" target="_blank"&gt;https://github.com/harisekhon/pytools&lt;/A&gt;&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --help&lt;/P&gt;&lt;P&gt;examples:&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --all&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --cancel&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --services hdfs,yarn --wait&lt;/P&gt;</description>
    <pubDate>Wed, 28 Sep 2016 01:20:36 GMT</pubDate>
    <dc:creator>fluxdude</dc:creator>
    <dc:date>2016-09-28T01:20:36Z</dc:date>
    <item>
      <title>Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107286#M15922</link>
      <description>&lt;P&gt;
	I'd like Ambari to execute a service check for all installed components that are not in maintenance mode.&lt;/P&gt;&lt;P&gt;
	I couldn't find such an option in the UI so I tried the REST API.  I ran the below command and got back an "Accepted" status, but when I look in Ambari UI for a list of executed background operations I only see a single service check when I expected two service checks.  &lt;/P&gt;
&lt;PRE&gt;curl -v -u $LOGIN:$PASSWORD -H "X-Requested-By:X-Requested-By" -X POST  "http://$AMBARI_HOST:8080/api/v1/clusters/$cluster_name/requests" --data '[ {"RequestInfo":{"context":"HIVE Service Check","command":"HIVE_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"HIVE"}]}, {"RequestInfo":{"context":"MAPREDUCE2 Service Check","command":"MAPREDUCE2_SERVICE_CHECK"},"Requests/resource_filters":[{"service_name":"MAPREDUCE2"}]} ]'&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jan 2016 01:37:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107286#M15922</guid>
      <dc:creator>vzlatkin</dc:creator>
      <dc:date>2016-01-22T01:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107287#M15923</link>
      <description>&lt;P&gt;Below is a sample script with out batching.  It would be really nice if someone could figure out how to get Ambari to accept a bulk request for a Service Check, as described &lt;A href="https://github.com/apache/ambari/blob/trunk/ambari-server/docs/api/v1/index.md#batch-requests"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;#!/usr/bin/env bash

AMBARI_HOST=${1:-sandbox.hortonworks.com}
LOGIN=admin
PASSWORD=admin
if [ -e "~/.ambari_login" ]; then
    . ~/.ambari_login
fi

cluster_name=$(curl -s -u $LOGIN:$PASSWORD "http://$AMBARI_HOST:8080/api/v1/clusters"  | python -mjson.tool | perl -ne '/"cluster_name":.*?"(.*?)"/ &amp;amp;&amp;amp; print "$1\n"')
if [ -z "$cluster_name" ]; then
    exit
fi
echo "Got cluster name: $cluster_name"

running_services=$(curl -s -u $LOGIN:$PASSWORD "http://$AMBARI_HOST:8080/api/v1/clusters/$cluster_name/services?fields=ServiceInfo/service_name&amp;amp;ServiceInfo/maintenance_state=OFF" | python -mjson.tool | perl -ne '/"service_name":.*?"(.*?)"/ &amp;amp;&amp;amp; print "$1\n"')
if [ -z "$running_services" ]; then
    exit
fi
echo "Got running services:
$running_services"

post_body=
for s in $running_services; do
    if [ "$s" == "ZOOKEEPER" ]; then
        post_body="{\"RequestInfo\":{\"context\":\"$s Service Check\",\"command\":\"${s}_QUORUM_SERVICE_CHECK\"},\"Requests/resource_filters\":[{\"service_name\":\"$s\"}]}"

    else
        post_body="{\"RequestInfo\":{\"context\":\"$s Service Check\",\"command\":\"${s}_SERVICE_CHECK\"},\"Requests/resource_filters\":[{\"service_name\":\"$s\"}]}"
    fi
    curl -s -u $LOGIN:$PASSWORD -H "X-Requested-By:X-Requested-By" -X POST --data "$post_body"  "http://$AMBARI_HOST:8080/api/v1/clusters/$cluster_name/requests"
done&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jan 2016 09:39:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107287#M15923</guid>
      <dc:creator>vzlatkin</dc:creator>
      <dc:date>2016-01-22T09:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107288#M15924</link>
      <description>&lt;P&gt;
 . &lt;A rel="user" href="https://community.cloudera.com/users/379/vzlatkin.html" nodeid="379" target="_blank"&gt;@Vladimir Zlatkin&lt;/A&gt; I just found a way to execute all service checks with one call &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;
 To bulk start service checks we have to use the same API/method that is used to trigger a rolling restart of Datanodes. The "&lt;EM&gt;request_schedules&lt;/EM&gt;" api starts all defined commands in the specified order, we can even specify a pause between the commands.&lt;/P&gt;&lt;P&gt;
 &lt;STRONG&gt;Start bulk Service checks:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;curl -ivk -H "X-Requested-By: ambari" -u &amp;lt;user&amp;gt;:&amp;lt;password&amp;gt; -X POST -d @payload.json &lt;A href="http://myexample.com:8080/api/v1/clusters/bigdata/request_schedules" target="_blank" rel="nofollow noopener noreferrer"&gt;http://myexample.com:8080/api/v1/clusters/bigdata/request_schedules&lt;/A&gt;
&lt;/PRE&gt;&lt;P&gt;
 &lt;STRONG&gt;Payload.json&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;[
   {
      "RequestSchedule":{
         "batch":[
            {
               "requests":[
                  {
                     "order_id":1,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"HDFS Service Check (batch 1 of 11)",
                           "command":"HDFS_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"HDFS"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":2,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"YARN Service Check (batch 2 of 11)",
                           "command":"YARN_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"YARN"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":3,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"MapReduce Service Check (batch 3 of 11)",
                           "command":"MAPREDUCE2_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"MAPREDUCE2"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":4,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"HBase Service Check (batch 4 of 11)",
                           "command":"HBASE_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"HBASE"
                           }
                        ]
                     }
                  },{
                     "order_id":5,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"Hive Service Check (batch 5 of 11)",
                           "command":"HIVE_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"HIVE"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":6,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"WebHCat Service Check (batch 6 of 11)",
                           "command":"WEBHCAT_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"WEBHCAT"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":7,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"PIG Service Check (batch 7 of 11)",
                           "command":"PIG_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"PIG"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":8,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"Falcon Service Check (batch 8 of 11)",
                           "command":"FALCON_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"FALCON"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":9,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"Storm Service Check (batch 9 of 11)",
                           "command":"STORM_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"STORM"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":10,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"Oozie Service Check (batch 10 of 11)",
                           "command":"OOZIE_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"OOZIE"
                           }
                        ]
                     }
                  },
                  {
                     "order_id":11,
                     "type":"POST",
                     "uri":"/api/v1/clusters/bigdata/requests",
                     "RequestBodyInfo":{
                        "RequestInfo":{
                           "context":"Zookeeper Service Check (batch 11 of 11)",
                           "command":"ZOOKEEPER_QUORUM_SERVICE_CHECK"
                        },
                        "Requests/resource_filters":[
                           {
                              "service_name":"ZOOKEEPER"
                           }
                        ]
                     }
                  }
               ]
            },
            {
               "batch_settings":{
                  "batch_separation_in_seconds":1,
                  "task_failure_tolerance":1
               }
            }
         ]
      }
   }
]
&lt;/PRE&gt;&lt;P&gt;
 &lt;STRONG&gt;Result&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;
 This is returned by the api&lt;/P&gt;
&lt;PRE&gt;{
  "resources" : [
    {
      "href" : "http://myexample.com:8080/api/v1/clusters/bigdata/request_schedules/68",
      "RequestSchedule" : {
        "id" : 68
      }
    }
  ]
}
&lt;/PRE&gt;&lt;P&gt;
 Ambari operations&lt;/P&gt;&lt;P&gt;
 &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1502-screen-shot-2016-01-23-at-94120-am.png" style="width: 1864px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/23469i035B1074BA4D9610/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1502-screen-shot-2016-01-23-at-94120-am.png" alt="1502-screen-shot-2016-01-23-at-94120-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2019 11:46:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107288#M15924</guid>
      <dc:creator>jstraub</dc:creator>
      <dc:date>2019-08-19T11:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107289#M15925</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt; needs to be converted to article!&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2016 20:41:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107289#M15925</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-01-23T20:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107290#M15926</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/393/aervits.html" nodeid="393"&gt;@Artem Ervits&lt;/A&gt; &lt;A rel="user" href="https://community.cloudera.com/users/379/vzlatkin.html" nodeid="379"&gt;@Vladimir Zlatkin&lt;/A&gt; I have created an article for this solution. Please see this &lt;A href="https://community.hortonworks.com/articles/11852/ambari-api-run-all-service-checks-bulk.html"&gt;https://community.hortonworks.com/articles/11852/ambari-api-run-all-service-checks-bulk.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I have also added 9 more Services to the payload, that should cover almost every service of the cluster now.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 05:22:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107290#M15926</guid>
      <dc:creator>jstraub</dc:creator>
      <dc:date>2016-01-27T05:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107291#M15927</link>
      <description>&lt;P&gt;Vlad, do we need to run this service script on admin account?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jul 2016 15:11:54 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107291#M15927</guid>
      <dc:creator>Vijayakumar_Ram</dc:creator>
      <dc:date>2016-07-17T15:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107292#M15928</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2902/vijayakumarramdoss.html" nodeid="2902"&gt;@vijayakumar Ramdoss&lt;/A&gt; yes. Need an Ambari I'd with admin / super user access. &lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2016 01:46:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107292#M15928</guid>
      <dc:creator>grajagopal</dc:creator>
      <dc:date>2016-07-18T01:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107293#M15929</link>
      <description>&lt;P&gt;I've published a CLI tool to handle all of this more easily including auto-generating the payload, inferring the cluster name and services to check etc. It has --help with lots of options, including features for --wait which tracks the progress status of the request and returns only when complete, and --cancel to stop any outstanding service checks if you accidentally launch too many by playing with the tool &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can find it on my github here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/harisekhon/pytools" target="_blank"&gt;https://github.com/harisekhon/pytools&lt;/A&gt;&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --help&lt;/P&gt;&lt;P&gt;examples:&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --all&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --cancel&lt;/P&gt;&lt;P&gt;./ambari_trigger_service_checks.py --services hdfs,yarn --wait&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 01:20:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107293#M15929</guid>
      <dc:creator>fluxdude</dc:creator>
      <dc:date>2016-09-28T01:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to execute Ambari service checks in bulk?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107294#M15930</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/113/jstraub.html" nodeid="113"&gt;@Jonas Straub&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks for the article.&lt;/P&gt;&lt;P&gt;Is there any way to figure out weather service check has passed or failed from API output(and not from Ambari GUI)?I'm getting the below output but not sure how to interpret the request output.&lt;/P&gt;&lt;P&gt;API o/p :&lt;/P&gt;&lt;P&gt;{
  "href" : "http://&amp;lt;host ip&amp;gt;:8080/api/v1/clusters/DEMO/requests/11",
  "Requests" : {
    "id" : 11,
    "status" : "Accepted"
  } &lt;/P&gt;</description>
      <pubDate>Sat, 09 Sep 2017 15:18:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Is-there-a-way-to-execute-Ambari-service-checks-in-bulk/m-p/107294#M15930</guid>
      <dc:creator>vaibhav44</dc:creator>
      <dc:date>2017-09-09T15:18:09Z</dc:date>
    </item>
  </channel>
</rss>

