You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

you can define a monitor for a specific job which sends emails in case of

  • error
    success
  • job start

Please add the monitor as a pre/postprocessing to the job. The language is java and the class is com.sos.jitl.mail.smtp.SmtpMailMonitor

Please define the required parameters

  • The email on error will be sent when the paramteter MailOnError_to is set
  • The email on success will be sent when the paramteter MailOnSuccess_to is set
  • The email on job start will be sent when the paramteter MailOnJobStart_to is set

When you have a html body for your email, you must specify the parameter MailOnJobStart_content_type=text/html

An example job configuration with a html body

        <job  title="Dies ist der Titel des Jobs" stop_on_error="no" order="yes" name="email_monitor">
            <settings >
                <log_level ><![CDATA[debug9]]></log_level>
            </settings>
  
            <params >
                <param  name="host" value="smtp.sos"/>
                <param  name="port" value="25"/>
                <param  name="from" value="scheduler@ur"/>
                <param  name="MailOnJobStart_to" value="uwe.risse@sos-berlin.com"/>
                <param  name="MailOnJobStart_subject" value="Job: %\{SCHEDULER_JOB_NAME\}  Task: %\{SCHEDULER_TASK_ID\}"/>
                <param  name="MailOnJobStart_body" value="&lt;html&gt;   &lt;head&gt;      &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=ISO-8859-15&quot;&gt;     &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body text=&quot;#000000&quot; bgcolor=&quot;#FFFFFF&quot;&gt;     &lt;b&gt;Scheduler ID:&lt;/b&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_ID\}&lt;br&gt;     &lt;b&gt;Scheduler&lt;/b&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_HOST\}:%\{SCHEDULER_TCP_PORT\}&lt;br&gt;     &lt;b&gt;Configuration in:&lt;/b&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_CONFIGURATION_DIRECTORY\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Task:&lt;/b&gt; %\{SCHEDULER_TASK_ID\}&lt;br&gt;     &lt;b&gt;Job: &amp;nbsp; &lt;/b&gt;%\{SCHEDULER_JOB_NAME\}&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;     %\{SCHEDULER_JOB_TITLE\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Job_chain:&lt;/b&gt;&amp;nbsp; %\{SCHEDULER_JOB_CHAIN_NAME\}&lt;br&gt;     %\{SCHEDULER_JOB_CHAIN_TITLE\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Order&lt;/b&gt;:&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     &amp;nbsp;&amp;nbsp;&amp;nbsp; %\{SCHEDULER_ORDER_ID\}&lt;br&gt;     &lt;b&gt;in Node:&lt;/b&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_NODE_NAME\}&lt;br&gt;     &lt;b&gt;next Node:&lt;/b&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; %\{SCHEDULER_NEXT_NODE_NAME\}&lt;br&gt;     &lt;br&gt;     &lt;font color=&quot;#999999&quot; face=&quot;Calibri&quot;&gt;&lt;small&gt;&lt;small&gt;&lt;font size=&quot;-1&quot;&gt;&lt;small&gt;&lt;small&gt;&lt;/small&gt;&lt;/small&gt;&lt;/font&gt;&lt;/small&gt;&lt;/small&gt;&lt;/font&gt;     &lt;div class=&quot;moz-signature&quot;&gt; &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; "/>
                <param  name="MailOnJobStart_content_type" value="text/html"/>
                <param  name="MailOnError_to" value="uwe.risse@sos-berlin.com"/>
                <param  name="MailOnError_subject" value="An error occurred in Job: %\{SCHEDULER_JOB_NAME\}  Task: %\{SCHEDULER_TASK_ID\}"/>
                <param  name="MailOnError_content_type" value="text/html"/>
                <param  name="MailOnError_body" value="&lt;html&gt;   &lt;head&gt;      &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=ISO-8859-15&quot;&gt;      &lt;title&gt;&lt;/title&gt;   &lt;/head&gt;   &lt;body text=&quot;#000000&quot; bgcolor=&quot;#FFFFFF&quot;&gt;     &lt;b&gt;Scheduler ID:&lt;/b&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_ID\}&lt;br&gt;     &lt;b&gt;Scheduler&lt;/b&gt;:&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_HOST\}:%\{SCHEDULER_TCP_PORT\}&lt;br&gt;     &lt;b&gt;Configuration in:&lt;/b&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_CONFIGURATION_DIRECTORY\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Task:&lt;/b&gt; %\{SCHEDULER_TASK_ID\}&lt;br&gt;     &lt;b&gt;Job: &amp;nbsp; &lt;/b&gt;%\{SCHEDULER_JOB_NAME\}&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;     %\{SCHEDULER_JOB_TITLE\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Job_chain:&lt;/b&gt;&amp;nbsp; %\{SCHEDULER_JOB_CHAIN_NAME\}&lt;br&gt;     %\{SCHEDULER_JOB_CHAIN_TITLE\}&lt;br&gt;     &lt;br&gt;     &lt;b&gt;Order&lt;/b&gt;:&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     &amp;nbsp;&amp;nbsp;&amp;nbsp; %\{SCHEDULER_ORDER_ID\}&lt;br&gt;     &lt;b&gt;in Node:&lt;/b&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;     %\{SCHEDULER_NODE_NAME\}&lt;br&gt;     &lt;b&gt;next Node:&lt;/b&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; %\{SCHEDULER_NEXT_NODE_NAME\}&lt;br&gt;     &lt;br&gt;     &lt;font color=&quot;#999999&quot; face=&quot;Calibri&quot;&gt;&lt;small&gt;&lt;small&gt;&lt;font size=&quot;-1&quot;&gt;&lt;small&gt;&lt;small&gt;&lt;/small&gt;&lt;/small&gt;&lt;/font&gt;&lt;/small&gt;&lt;/small&gt;&lt;/font&gt;     &lt;div class=&quot;moz-signature&quot;&gt; &lt;/div&gt;   &lt;/body&gt; &lt;/html&gt; "/>
            </params>
 
            <script  language="shell">
                <![CDATA[
 dir
 exit 1
                ]]>
            </script>
 
            <monitor  name="process0" ordering="0">
                <script  language="java" java_class="com.sos.jitl.mail.smtp.SmtpMailMonitor"/>
            </monitor>
 
            <run_time />
        </job>
  • No labels