Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

getting completed jobs using cloudera manager API

Highlighted

getting completed jobs using cloudera manager API

Super Collaborator

Hi Guys,

 

I trying to get all the finished applications ( which is not running, it may killed, success etc ...), and using the cloudera manager API, but with no success, can anyone help what i'm missing in the below command, i'm collecting the metrics each 5 minutes

 

STARTDATE=`date -d " -5 minute" "+%FT%T"`


result=`curl -u 'admin' : 'admin' 'http://cloudera_manager_host:7180/api/v11/clusters/cluster/services/yarn/yarnApplications?from='$STARTDATE'&limit=1000&filters(state!=RUNNING)'`

6 REPLIES 6

Re: getting completed jobs using cloudera manager API

New Contributor

You've probably figured it out, but for other readers: just remove the single quotes ' ' around $STARTDATE in the url.

 

(...)yarnApplications?from=${STARTDATE}&filters(...)

Re: getting completed jobs using cloudera manager API

New Contributor

Hello Sir,

 

I used the following command in the UI

 

https://<HOSTNAME:PORT> /api/v16/clusters/cluster/services/yarn/yarnApplications?from=2018-09-22T00:00:01Z&to=2018-09-22T23:59:59Z&filter(user=xxxx)

 

The result does not get filtered by user. I always the result for all users

 

I appreciate your suggestions on this.

 

Thanks,

 

 

 

 

Re: getting completed jobs using cloudera manager API

Super Collaborator

@anrama try using filter=user=xxxx

 

STARTDATE=`date -d " -5 minute" "+%FT%T"`


result=`curl -u 'admin' : 'admin' 'cloudera_manager_host:port/api/v11/clusters/cluster/services/yarn/yarnApplications?from='$STARTDATE'&limit=1000&filter=user=xxx'`
echo $result

Re: getting completed jobs using cloudera manager API

New Contributor

Great .your suggestion worked. It worked.

 

Thanks,

Re: getting completed jobs using cloudera manager API

New Contributor
1. How to provide complex filter like
ex: filter= state = FINISHED and filter =state = SUCCEEDED
2. Can I use NOT EQUAL
ex: filter = state != RUNNING

I appreciate your help

Re: getting completed jobs using cloudera manager API

Super Collaborator

@anrama You can user the filter=status!=Running