Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Users might be interested to in automatically create creating reports about planning and execution of job scheduling.
  • Such reports can be created by use of using JS7 cmdlets , - see the following use cases:
  • Use cases include to customize customizing the ordering and format formatting of reporting data. This includes the use of output formats such as .csv, .xml, .json, .xlsx and individual formats. As Excel® is a frequent output format the use cases here introduce a solution to create which creates .xlsx files with Windows and with a number of Unix platforms. Reports can be added to individual worksheets of an Excel® report file.
  • This article explains how to automate the creation of reports and how to send reports by mail.

...

  • Download the sample workflow (.json upload)jdDailyReport.workflow.json
  • For use with in Unix environments you can use the sample workflow, however. However, you have to replace the first line of each job to make use of a Unix shebang.

    Code Block
    languagebash
    titleShebang for PowerShell Job with Unix
    #!/usr/bin/env pwsh

    Explanation:

    • Use of a shebang allows to invoke the pwsh PowerShell executable. 

Example

The jdDailyReport sample workflow jdDailyReport workflow is used thatwhich:

  • serializes execution of the above jobs,
  • stores reporting output of each job to the same in an Excel® file each with a separate worksheet for each job.


Explanation:

  • The reporting jobs to be used are explained with the respective articles , - see the Introdution section above.
  • The workflow jdDailyReport serializes workflow serializes execution of the above jobs.
    • Keep in mind that you might not need all reports as they provide redundant data, for example the Task History Report partially includes similar reporting data as to the Order History Report.
    • The main purpose of the reports is to allow different perspectives on historic data , therefore make your choice and therefore you are free to choose which report you will need.
    • The workflow makes use of three variables, that .These are provided with a default value that which can be modified by any order:
      • report_file: The path to the Excel® file that which holds the reports. Each report is stored to a separate worksheet. The path is determined from the Agent's working directory.
      • report_past_period: This period is applied to reports that which consider the past, for example, the Task History Report.
      • report_future_period: This period is applied to reports that consider the future, for example, the Daily Plan Report.
  • A final send-mail job is added that forwards the report_file by mail.
  • Finally an order is created to parameterize and to schedule execution of the workflow.

Job: send-mail

The send-mail job makes use of uses the following arguments:


Explanation:

  • The send-mail job is based on the JS7 - JITL MailJob template.
  • This job is assigned a Job Resource with the name eMailDefault, see JS7 - Job Resources.
    • No settings for the SMTP server, port, authentication etc. are used as such settings are used settingscome from the Job Resource , see as described below.
  • This job makes use of uses a number of parameters that which are independent from of the content of the report and from recipients of the report recipients:
    • to: is effectively the recipient's mail address.
    • subject: is mapped to the subject of the mail.
    • content_type: depends on the content of the body. When using HTML for the mail body then the content_type should be text/html.
    • body: determines the mail boy body from a few lines of plain text or HTML code.
    • attachment: consider note the assigned value that which is the variable $report_file declared with variable, which is declared for the workflow that holds holding the resulting report file.

...

  • The screenshot shows the configuration of the eMailDefault Job Resource, see JS7 - Job Resources.
    • Mail parameters are specific for to a user's environment.
    • Check the JS7 - JITL MailJob for applicable parameters, such as host, port, use of TLS protocols etc.

...

  • The order carries the following parameters:
    • report_file: the path - including the name - of the Excel report file. This parameter is forwarded to all jobs in the job chain that which will therefore will write to the same Excel report file.
    • report_past period: 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 by the reporting jobs with the -Timezone parameter for the respective reporting cmdlet.
    • report_future_period: 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 by the reporting jobs with the -Timezone parameter for the respective reporting cmdlet.
    • to: the recipient of the e-mail. Multiple recipients are separated by comma commas ",".
  • The above order can be added a at run-time to specify automated execution, e.g. on a daily basis or more/less frequently.
  • Additional orders which use the same job chain can be created with different parameter sets for date range an recipients that  use the same job chainand recipients.