Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save olegbukatchuk/2c0fb03b642624b41b1acf4252bc7619 to your computer and use it in GitHub Desktop.
Save olegbukatchuk/2c0fb03b642624b41b1acf4252bc7619 to your computer and use it in GitHub Desktop.

Revisions

  1. @mr-jstraub mr-jstraub revised this gist May 27, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,7 @@ Service Checks can be started via the Ambari API and it is also possible to star
    curl -ivk -H "X-Requested-By: ambari" -u <user>:<password> -X POST -d @payload http://<ambari-server>:8080/api/v1/clusters/<clustername>/requests
    ```

    *Note: Since Ambari 2.2 the endpoint has changed! Now it is ..../<clustername>/request_schedules*
    *Note: Since Ambari 2.2 the endpoint has changed! Now it is .../request_schedules*

    **Payload:**
    ```json
  2. @mr-jstraub mr-jstraub revised this gist May 27, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,8 @@ Service Checks can be started via the Ambari API and it is also possible to star
    curl -ivk -H "X-Requested-By: ambari" -u <user>:<password> -X POST -d @payload http://<ambari-server>:8080/api/v1/clusters/<clustername>/requests
    ```

    *Note: Since Ambari 2.2 the endpoint has changed! Now it is ..../<clustername>/request_schedules*

    **Payload:**
    ```json
    {
  3. @mr-jstraub mr-jstraub revised this gist Jan 26, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ Service Checks can be started via the Ambari API and it is also possible to star
    | SmartSense | SMARTSENSE | SMARTSENSE_SERVICE_CHECK |
    | Ranger | RANGER | RANGER_SERVICE_CHECK |

    *Note: Make sure you replace <user>,<password>,<clustername> and <ambari-server> with the actual values*
    *Note: Make sure you replace user, password, clustername and ambari-server with the actual values*

    ##Start single service check via Ambari API (e.g. HDFS Service Check):
    ```shell
  4. @mr-jstraub mr-jstraub revised this gist Jan 26, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #Ambari API - Run all Service Checks
    In order to check the status and stability of your cluster it makes sense to run the service checks that are included in Ambari. Usually each Ambari Service provides its own service check, but their might be services that wont include any service check at all. To run a service check you have to select the service (e.g. HDFS) in Ambari and click "Run Service Check" in the "Actions" dropdown menu.

    Service Checks can be started via the Ambari API and it is also possible to start all available service checks with a single API command. To bulk run these checks it is necessary to use the same API/method that is used to trigger a rolling restart of Datanodes (request_schedules). The "request_schedules" API starts all defined commands in the specified order, its even possible to specify a pause between the commands.
  5. @mr-jstraub mr-jstraub revised this gist Jan 26, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,7 @@ In order to check the status and stability of your cluster it makes sense to run
    Service Checks can be started via the Ambari API and it is also possible to start all available service checks with a single API command. To bulk run these checks it is necessary to use the same API/method that is used to trigger a rolling restart of Datanodes (request_schedules). The "request_schedules" API starts all defined commands in the specified order, its even possible to specify a pause between the commands.

    **Available Service Checks:**

    | Service Name | service_name | Command |
    | ------------- | ------------- | ------------- |
    | HDFS | HDFS | HDFS_SERVICE_CHECK |
  6. @mr-jstraub mr-jstraub created this gist Jan 26, 2016.
    481 changes: 481 additions & 0 deletions ambari_api_bulk_service_checks.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,481 @@
    In order to check the status and stability of your cluster it makes sense to run the service checks that are included in Ambari. Usually each Ambari Service provides its own service check, but their might be services that wont include any service check at all. To run a service check you have to select the service (e.g. HDFS) in Ambari and click "Run Service Check" in the "Actions" dropdown menu.

    Service Checks can be started via the Ambari API and it is also possible to start all available service checks with a single API command. To bulk run these checks it is necessary to use the same API/method that is used to trigger a rolling restart of Datanodes (request_schedules). The "request_schedules" API starts all defined commands in the specified order, its even possible to specify a pause between the commands.

    **Available Service Checks:**
    | Service Name | service_name | Command |
    | ------------- | ------------- | ------------- |
    | HDFS | HDFS | HDFS_SERVICE_CHECK |
    | YARN | YARN | YARN_SERVICE_CHECK |
    | MapReduce2 | MAPREDUCE2 | MAPREDUCE2_SERVICE_CHECK |
    | HBase | HBASE | HBASE_SERVICE_CHECK |
    | Hive | HIVE | HIVE_SERVICE_CHECK |
    | WebHCat | WEBHCAT | WEBHCAT_SERVICE_CHECK |
    | Pig | PIG | PIG_SERVICE_CHECK |
    | Falcon | FALCON | FALCON_SERVICE_CHECK |
    | Storm | STORM | STORM_SERVICE_CHECK |
    | Oozie | OOZIE | OOZIE_SERVICE_CHECK |
    | ZooKeeper | ZOOKEEPER | ZOOKEEPER_QUORUM_SERVICE_CHECK |
    | Tez | TEZ | TEZ_SERVICE_CHECK |
    | Sqoop | SQOOP | SQOOP_SERVICE_CHECK |
    | Ambari Metrics | AMBARI_METRICS | AMBARI_METRICS_SERVICE_CHECK |
    | Atlas | ATLAS | ATLAS_SERVICE_CHECK |
    | Kafka | KAFKA | KAFKA_SERVICE_CHECK |
    | Knox | KNOX | KNOX_SERVICE_CHECK |
    | Spark | SPARK | SPARK_SERVICE_CHECK |
    | SmartSense | SMARTSENSE | SMARTSENSE_SERVICE_CHECK |
    | Ranger | RANGER | RANGER_SERVICE_CHECK |

    *Note: Make sure you replace <user>,<password>,<clustername> and <ambari-server> with the actual values*

    ##Start single service check via Ambari API (e.g. HDFS Service Check):
    ```shell
    curl -ivk -H "X-Requested-By: ambari" -u <user>:<password> -X POST -d @payload http://<ambari-server>:8080/api/v1/clusters/<clustername>/requests
    ```

    **Payload:**
    ```json
    {
    "RequestInfo":{
    "context":"HDFS Service Check",
    "command":"HDFS_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"HDFS"
    }
    ]
    }
    ```

    ##Start bulk Service checks via Ambari API (e.g. HDFS, Yarn, MapReduce2 Service Checks):
    ```shell
    curl -ivk -H "X-Requested-By: ambari" -u <user>:<password> -X POST -d @payload http://<ambari-server>:8080/api/v1/clusters/<clustername>/request_schedules
    ```

    **Payload:**
    ```json
    [
    {
    "RequestSchedule":{
    "batch":[
    {
    "requests":[
    {
    "order_id":1,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"HDFS Service Check (batch 1 of 3)",
    "command":"HDFS_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"HDFS"
    }
    ]
    }
    },
    {
    "order_id":2,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"YARN Service Check (batch 2 of 3)",
    "command":"YARN_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"YARN"
    }
    ]
    }
    },
    {
    "order_id":3,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"MapReduce Service Check (batch 3 of 3)",
    "command":"MAPREDUCE2_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"MAPREDUCE2"
    }
    ]
    }
    }
    ]
    },
    {
    "batch_settings":{
    "batch_separation_in_seconds":1,
    "task_failure_tolerance":1
    }
    }
    ]
    }
    }
    ]
    ```

    **This is returned by the api**
    ```json
    {
    "resources" : [
    {
    "href" : "http://<ambari-server>:8080/api/v1/clusters/<clustername>/request_schedules/68",
    "RequestSchedule" : {
    "id" : 68
    }
    }
    ]
    }
    ```

    ##Payload to run all Service Checks
    ```json
    [
    {
    "RequestSchedule":{
    "batch":[
    {
    "requests":[
    {
    "order_id":1,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"HDFS Service Check (batch 1 of 20)",
    "command":"HDFS_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"HDFS"
    }
    ]
    }
    },
    {
    "order_id":2,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"YARN Service Check (batch 2 of 20)",
    "command":"YARN_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"YARN"
    }
    ]
    }
    },
    {
    "order_id":3,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"MapReduce Service Check (batch 3 of 20)",
    "command":"MAPREDUCE2_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"MAPREDUCE2"
    }
    ]
    }
    },
    {
    "order_id":4,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"HBase Service Check (batch 4 of 20)",
    "command":"HBASE_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"HBASE"
    }
    ]
    }
    },
    {
    "order_id":5,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Hive Service Check (batch 5 of 20)",
    "command":"HIVE_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"HIVE"
    }
    ]
    }
    },
    {
    "order_id":6,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"WebHCat Service Check (batch 6 of 20)",
    "command":"WEBHCAT_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"WEBHCAT"
    }
    ]
    }
    },
    {
    "order_id":7,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"PIG Service Check (batch 7 of 20)",
    "command":"PIG_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"PIG"
    }
    ]
    }
    },
    {
    "order_id":8,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Falcon Service Check (batch 8 of 20)",
    "command":"FALCON_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"FALCON"
    }
    ]
    }
    },
    {
    "order_id":9,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Storm Service Check (batch 9 of 20)",
    "command":"STORM_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"STORM"
    }
    ]
    }
    },
    {
    "order_id":10,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Oozie Service Check (batch 10 of 20)",
    "command":"OOZIE_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"OOZIE"
    }
    ]
    }
    },
    {
    "order_id":11,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Zookeeper Service Check (batch 11 of 20)",
    "command":"ZOOKEEPER_QUORUM_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"ZOOKEEPER"
    }
    ]
    }
    },
    {
    "order_id":12,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Tez Service Check (batch 12 of 20)",
    "command":"TEZ_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"TEZ"
    }
    ]
    }
    },
    {
    "order_id":13,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Sqoop Service Check (batch 13 of 20)",
    "command":"SQOOP_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"SQOOP"
    }
    ]
    }
    },
    {
    "order_id":14,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Ambari Metrics Service Check (batch 14 of 20)",
    "command":"AMBARI_METRICS_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"AMBARI_METRICS"
    }
    ]
    }
    },
    {
    "order_id":15,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Atlas Service Check (batch 15 of 20)",
    "command":"ATLAS_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"ATLAS"
    }
    ]
    }
    },
    {
    "order_id":16,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Kafka Service Check (batch 16 of 20)",
    "command":"KAFKA_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"KAFKA"
    }
    ]
    }
    },
    {
    "order_id":17,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Knox Service Check (batch 17 of 20)",
    "command":"KNOX_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"KNOX"
    }
    ]
    }
    },
    {
    "order_id":18,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Spark Service Check (batch 18 of 20)",
    "command":"SPARK_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"SPARK"
    }
    ]
    }
    },
    {
    "order_id":19,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"SmartSense Service Check (batch 19 of 20)",
    "command":"SMARTSENSE_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"SMARTSENSE"
    }
    ]
    }
    },
    {
    "order_id":20,
    "type":"POST",
    "uri":"/api/v1/clusters/<clustername>/requests",
    "RequestBodyInfo":{
    "RequestInfo":{
    "context":"Ranger Service Check (batch 20 of 20)",
    "command":"RANGER_SERVICE_CHECK"
    },
    "Requests/resource_filters":[
    {
    "service_name":"RANGER"
    }
    ]
    }
    }
    ]
    },
    {
    "batch_settings":{
    "batch_separation_in_seconds":1,
    "task_failure_tolerance":1
    }
    }
    ]
    }
    }
    ]
    ```