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.

How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Solved Go to solution
Highlighted

How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Explorer

I need to capture the job status, Start time and End Time of the work and mail it using the mail action in Oozie.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Super Guru
@Sai ram

There are no direct variables to get start time and end time in oozie. '${timestamp()}' can return current timestamp in UTC. I would suggest to use another approach, start and end your oozie workflow with an email action, in this way, you will receive 2 emails, one when your oozie workflow will start and another when your job will end. If you want more better solution then I would suggest to write a script which will fetch start time, end time from oozie commands or from oozie database and have script to send an email for multiple jobs at once in a tabular format.

Hope this information helps.

View solution in original post

7 REPLIES 7
Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Explorer
Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Super Guru

You can do this by setting a parameter with start and end time.

For example

<property>
<name>the_timestamp</name>
<value>${timestamp()}</value>
<property>

Set that to start time and another to end time when you hit a action.

For information on oozie emails here:

https://oozie.apache.org/docs/3.3.0/DG_EmailActionExtension.html

Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Explorer

Thanks, but I am not looking for timestamp, I need the job status and execution time. In short, I need to mail the output of this command, oozie job -oozie {SERVER_DETAILS} -info ${job_id}

Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Super Guru
@Sai ram

There are no direct variables to get start time and end time in oozie. '${timestamp()}' can return current timestamp in UTC. I would suggest to use another approach, start and end your oozie workflow with an email action, in this way, you will receive 2 emails, one when your oozie workflow will start and another when your job will end. If you want more better solution then I would suggest to write a script which will fetch start time, end time from oozie commands or from oozie database and have script to send an email for multiple jobs at once in a tabular format.

Hope this information helps.

View solution in original post

Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Explorer

@Kuldeep Kulkarni Is there a way where I can execute this command inside the mail action in oozie ?

oozie job -oozie {SERVER_DETAILS} -info ${job_id}

Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Super Guru

@Sai ram - No you cann't. But you can write a shell action and in shell script you can execute this command as well as mail command

Highlighted

Re: How do I send a mail in Oozie by mentioning the Start Time and End Time in the mail body ?

Explorer

I need to capture the highlighted fields in the screenshot.

6056-capture.png

Don't have an account?
Coming from Hortonworks? Activate your account here