Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Resource Manager API ?

avatar

I want to get application id, type , memory usage and start time for running applications using resource manager rest api ?

1 ACCEPTED SOLUTION

avatar
Super Guru
@Anurag Mishra

you need to run following command, it will return json output,you need to parse json output and get the required details

curl --compressed -X GET http://hdp26:8088/ws/v1/cluster/apps?state=RUNNING

{"apps":{"app":[{"id":"application_1499066924486_0010","user":"hive","name":"HIVE-971ad1b1-b8c8-425a-a0df-ad50f6cb4798","queue":"llap","state":"RUNNING","finalStatus":"UNDEFINED","progress":0.0,"trackingUI":"ApplicationMaster","trackingUrl":"http://hdp26.hdp.local:8088/proxy/application_1499066924486_0010/","diagnostics":"","clusterId":1499066924486,"applicationType":"TEZ","applicationTags":"","priority":0,"startedTime":1499750778877,"finishedTime":0,"elapsedTime":190496298,"amContainerLogs":"http://hdp26.hdp.local:8042/node/containerlogs/container_e05_1499066924486_0010_01_000001/hive","amHostHttpAddress":"hdp26.hdp.local:8042","allocatedMB":1024,"allocatedVCores":1,"runningContainers":1,"memorySeconds":195067899,"vcoreSeconds":190495,"queueUsagePercentage":16.666668,"clusterUsagePercentage":10.0,"preemptedResourceMB":0,"preemptedResourceVCores":0,"numNonAMContainerPreempted":0,"numAMContainerPreempted":0,"resourceRequests":[{"capability":{"memory":1024,"memorySize":1024,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":0},"relaxLocality":true,"resourceName":"*"}],"logAggregationStatus":"NOT_START","unmanagedApplication":false,"amNodeLabelExpression":""},{"id":"application_1499066924486_0009","user":"hive","name":"llap0","queue":"llap","state":"RUNNING","finalStatus":"UNDEFINED","progress":100.0,"trackingUI":"ApplicationMaster","trackingUrl":"http://hdp26.hdp.local:8088/proxy/application_1499066924486_0009/","diagnostics":"","clusterId":1499066924486,"applicationType":"org-apache-slider","applicationTags":"name: llap,version: 11jul2017,description: llap is a daemon service that works with a cache and works on sql constructs.","priority":1,"startedTime":1499750705675,"finishedTime":0,"elapsedTime":190569500,"amContainerLogs":"http://hdp26.hdp.local:8042/node/containerlogs/container_e05_1499066924486_0009_01_000001/hive","amHostHttpAddress":"hdp26.hdp.local:8042","allocatedMB":4096,"allocatedVCores":2,"runningContainers":2,"memorySeconds":780521363,"vcoreSeconds":381124,"queueUsagePercentage":66.66667,"clusterUsagePercentage":40.0,"preemptedResourceMB":0,"preemptedResourceVCores":0,"numNonAMContainerPreempted":0,"numAMContainerPreempted":0,"resourceRequests":[{"capability":{"memory":512,"memorySize":512,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":0},"relaxLocality":true,"resourceName":"*"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":true,"resourceName":"hdp26.hdp.local"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":false,"resourceName":"/default-rack"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":false,"resourceName":"*"}],"logAggregationStatus":"RUNNING","unmanagedApplication":false,"amNodeLabelExpression":""}]}}

View solution in original post

2 REPLIES 2

avatar
Super Guru
@Anurag Mishra

you need to run following command, it will return json output,you need to parse json output and get the required details

curl --compressed -X GET http://hdp26:8088/ws/v1/cluster/apps?state=RUNNING

{"apps":{"app":[{"id":"application_1499066924486_0010","user":"hive","name":"HIVE-971ad1b1-b8c8-425a-a0df-ad50f6cb4798","queue":"llap","state":"RUNNING","finalStatus":"UNDEFINED","progress":0.0,"trackingUI":"ApplicationMaster","trackingUrl":"http://hdp26.hdp.local:8088/proxy/application_1499066924486_0010/","diagnostics":"","clusterId":1499066924486,"applicationType":"TEZ","applicationTags":"","priority":0,"startedTime":1499750778877,"finishedTime":0,"elapsedTime":190496298,"amContainerLogs":"http://hdp26.hdp.local:8042/node/containerlogs/container_e05_1499066924486_0010_01_000001/hive","amHostHttpAddress":"hdp26.hdp.local:8042","allocatedMB":1024,"allocatedVCores":1,"runningContainers":1,"memorySeconds":195067899,"vcoreSeconds":190495,"queueUsagePercentage":16.666668,"clusterUsagePercentage":10.0,"preemptedResourceMB":0,"preemptedResourceVCores":0,"numNonAMContainerPreempted":0,"numAMContainerPreempted":0,"resourceRequests":[{"capability":{"memory":1024,"memorySize":1024,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":0},"relaxLocality":true,"resourceName":"*"}],"logAggregationStatus":"NOT_START","unmanagedApplication":false,"amNodeLabelExpression":""},{"id":"application_1499066924486_0009","user":"hive","name":"llap0","queue":"llap","state":"RUNNING","finalStatus":"UNDEFINED","progress":100.0,"trackingUI":"ApplicationMaster","trackingUrl":"http://hdp26.hdp.local:8088/proxy/application_1499066924486_0009/","diagnostics":"","clusterId":1499066924486,"applicationType":"org-apache-slider","applicationTags":"name: llap,version: 11jul2017,description: llap is a daemon service that works with a cache and works on sql constructs.","priority":1,"startedTime":1499750705675,"finishedTime":0,"elapsedTime":190569500,"amContainerLogs":"http://hdp26.hdp.local:8042/node/containerlogs/container_e05_1499066924486_0009_01_000001/hive","amHostHttpAddress":"hdp26.hdp.local:8042","allocatedMB":4096,"allocatedVCores":2,"runningContainers":2,"memorySeconds":780521363,"vcoreSeconds":381124,"queueUsagePercentage":66.66667,"clusterUsagePercentage":40.0,"preemptedResourceMB":0,"preemptedResourceVCores":0,"numNonAMContainerPreempted":0,"numAMContainerPreempted":0,"resourceRequests":[{"capability":{"memory":512,"memorySize":512,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":0},"relaxLocality":true,"resourceName":"*"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":true,"resourceName":"hdp26.hdp.local"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":false,"resourceName":"/default-rack"},{"capability":{"memory":3584,"memorySize":3584,"virtualCores":1},"nodeLabelExpression":"","numContainers":0,"priority":{"priority":1},"relaxLocality":false,"resourceName":"*"}],"logAggregationStatus":"RUNNING","unmanagedApplication":false,"amNodeLabelExpression":""}]}}

avatar

can you tell me how to filter details from above output like i want to get application id, aplication type, state, &startedTime, memory usage