...
- For starters the jobs to be used are explained with individual articles, see Summary.
- Next a job chain daily_report is created that serializes execution of the above jobs.
- Keep in mind that you will not need all reports as they provide redundant data, e.g. the Task History Report includes similar reporting data as the Job Stream History Report.
- The main purpose of the reports is to allow different perspectives on historic data, therefore make your choice which report you will need.
- The jobs job scripts are added three parameters,
report_date_from
,report_date_to
andreport_file_path
, that are provided by the order for the job chain, see below.
- Then a
send_mail
jobreport
job is added. - Finally an order is created to parameterize and to schedule execution of the job chain.
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="UTF-8" ?>
<job title="Send report by mail" order="yes" stop_on_error="false">
<params>
<param name="subject" value="JobScheduler Daily Report"/>
<param name="content_type" value="text/html"/>
<param name="body" value="<html><body><div><p>Hi,<br><br>please find attached report generated by JobScheduler for Order History, Task History, and Daily Plan.<br><br>Have a great day<br>JobScheduler Team</div></p></body></body></html>"/>
<param name="attachment" value="\${REPORT_FILE_PATH}"/>
</params>
<environment/>
<script language="java" java_class="sos.scheduler.managed.JobSchedulerManagedMailJob"/>
<monitor name="configuration_monitor" ordering="0">
<script language="java" java_class="com.sos.jitl.jobchainnodeparameter.monitor.JobchainNodeSubstituteMonitor"/>
</monitor>
<run_time/>
</job> |
Explanations:
- The
send_report
job is based on the JobSchedulerManagedMailJob template. - The job makes use of a number of parameters that are independent from the content of the report and from recipients of the report:
subject
: is mapped to the subject of the e-mail.content_type
: depends on the content of thebody
. When using HTML for the e-mail body then thecontent_type
istext/html
.body
: defines a few lines of HTML output for the e-mail body.attachment
: consider use of the syntax\${REPORT_FILE_PATH}
that indicates that the value of theattachment
parameter is thereport_file_path
parameter. The leading backslash is required to prevent the value to be substituted as an environment variable. Thereport_file_path
parameter is added by the order, see below.- No settings for the SMTP server, port, authentication etc. are used as such settings default to the configuration of the JobScheduler Master to send mail.
...
- The order carries the following parameters:
report_file_path
: the path - including the name - of the Excel report file. This parameter is forwarded to all jobs in the job chain that therefore will write to the same Excel report file.report_date_from
: a relative date specification for the begin of the reporting period is used. The above value-1d+TZ
translates to a date range starting 1 day ago at midnight in the timezone that is specified for dates in the Excel report file. The timezone is specified by the reporting jobs with the-Timezone
parameter for the respective reporting cmdletscmdlet.report_date_to
: a relative date specification for the end of the reporting period is used. The above value+1d+TZ
translates to a date range one day after the current date at midnight in the timezone that is specified for dates in the Excel report file. The timezone is specified by the reporting jobs with the-Timezone
parameter for the respective reporting cmdletscmdlet.to
: the recipient of the e-mail. Multiple recipients are separated by semicolon comma ";,".
- The above order can be added a run-time to specify automated execution, e.g. on a daily basis or more/less frequently.
- Additional orders can be created with different parameter sets for date range an recipients that use the same job chain.