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. Want to know more about what has changed? Check out the Community News blog.

Getting notification on failed and killed applications

Highlighted

Getting notification on failed and killed applications

Super Collaborator

 

Hi Guys,

 

I'm working on a script that will send notification on the failed,killed application.

 

I'm using the Yarn histrory API and getting the the failed application in the last hour also i'm parsing the output.

 

I need ideas how to present this in the notification, for example: HTML table, json or free text.

 

If anyone who already did this and can advise or share how he did this, also i will appreciate if anyone can advise how i can get the failed and killed in the same request, i tried to use the OR operation with no success.

 

Thanks in advance, Below what i did so far:

 

 

 

#!/bin/bash

STARTDATE=`date -d " -1 hour " +%s%N | cut -b1-13`
ENDDATE=`date +%s%N | cut -b1-13`

result=`curl -s 'http://ropr-mhc102:8088/ws/v1/cluster/apps?finishedTimeBegin='$STARTDATE'&finishedTimeEnd='$ENDDATE'&finalStatus=FAILED&user=dataaccess'`
echo $result | python -m json.tool | sed 's/["|,]//g' | grep -E "id|name|finalStatus|amContainerLogs|trackingUrl|diagnostics"

 

 

Sample ouput:

 

id: application_1504684651566_19320
name: dataaccessLE-engagement
trackingUrl: http://ropr-mhc102.lpdomain.com:8088/proxy/application_1504684651566_19320/history/application_15046...
amContainerLogs: http://ropr-dhc034:8042/node/containerlogs/container_e43_1504684651566_19321_02_000001/dataaccess
diagnostics: User class threw exception: java.io.FileNotFoundException: File hdfs://CAProd/liveperson/data/storage_Shared/data_Platform/dallas/output/VisitorSession/acc_id=88 does not exist.
finalStatus: FAILED