Reply
Highlighted
Expert Contributor
Posts: 334
Registered: ‎01-25-2017

getting completed jobs using cloudera manager API

[ Edited ]

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)'`

New Contributor
Posts: 1
Registered: ‎06-20-2018

Re: getting completed jobs using cloudera manager API

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

 

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

New Contributor
Posts: 4
Registered: ‎01-15-2018

Re: getting completed jobs using cloudera manager API

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,

 

 

 

 

Expert Contributor
Posts: 334
Registered: ‎01-25-2017

Re: getting completed jobs using cloudera manager API

[ Edited ]

@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

New Contributor
Posts: 4
Registered: ‎01-15-2018

Re: getting completed jobs using cloudera manager API

Great .your suggestion worked. It worked.

 

Thanks,

New Contributor
Posts: 4
Registered: ‎01-15-2018

Re: getting completed jobs using cloudera manager API

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
Announcements