Support Questions

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

getting completed jobs using cloudera manager API

avatar
Master 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='$STA...)'`

6 REPLIES 6

avatar
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(...)

avatar
Explorer

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,

 

 

 

 

avatar
Master 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

avatar
Explorer

Great .your suggestion worked. It worked.

 

Thanks,

avatar
Explorer
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

avatar
Master Collaborator

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