# Scheduled Reports

## Contents
Overview Database Configuration Scheduled Report Configuration Advanced Options Configuring a Time Schedule

## Overview
You can schedule reports to run on a regular basis, and have the results emailed to the user in PDF format. These reports include summary values at the top (for example, the number of requests, SLA breaches, alerts triggered, and unique clients in a specific week) followed by a table of Web Services, and their aggregated usage data (for example, the number of requests on each Web Service). By default, the report data is for the current week of the report, which is compared to the week before. You can configure the current week of the report to be the actual current week or any previous week (provided there is corresponding data in the database). To configure scheduled reports, right-click the Service Monitor node on the Services tab, and select Database Archive.
## Database Configuration
You can configure the following database settings in the dialog: Name: Enter an appropriate name for the database archive. Database: Select an existing database connection from the drop-down list. Defaults to the `Default Database Connection`. For details on creating database connections, see the Database Connection topic.
## Scheduled Report Configuration
You can configure the following scheduled report settings: Send weekly scheduled report: Select whether to enable scheduled reports. When selected, by default, this runs a scheduled weekly report on Monday morning at 0:01. For details on configuring a different time schedule, see Configuring a Time Schedule. Metrics time window: Select the time window for metrics data in the database used when generating reports. You can select `5 seconds`, `5 minutes`, or `1 hour` from the drop-down list. Defaults to `5 seconds`. You must configure all Enterprise Gateways that store metrics in the database to use the same time window. Email Recipient (To): Enter the recipient of the automatically generated report email. Use a semicolon-separated list of email addresses to send alerts to multiple recipients. Email Sender (From): The generated report emails appear from the sender email address specified here. It is important to note that some mail servers do not allow relaying mail when the sender in the From field is not recognized by the server. SMTP Server Settings: Specify the following fields:
Outgoing Mail Server (SMTP) | Specify the SMTP server that the Enterprise Gateway uses to relay the report email.
Port | Specify the SMTP server port to connect to. Defaults to port 25.
Connection Security | Select the connection security used to send the report email (`SSL`, `TLS`, or `NONE`). Defaults to `NONE`.
Log on Using: If you are required to authenticate to the SMTP server, specify the following fields:
User Name: | Enter the user name for authentication.
Password: | Enter the password for the user name specified.
## Advanced Options
You can configure the following advanced options: Email Debugging: You can select this setting to find out more information about errors encountered by the Enterprise Gateway when attempting to send email alerts. All trace files are written to the `/trace` directory of your Enterprise Gateway installation. Don’t delete intermediary report files: This option is for debugging scheduled reports. PDF reports are generated through several stages. When this setting is enabled, the temporary files used in the process are not deleted when the report is sent. These files are stored in the system temporary directory. There are two files for each report: an XML file with metrics data for the report, and a generated PDF report.
## Configuring a Time Schedule
You can configure additional report schedule settings using the Entity Explorer tool. For example, you can specify exactly when the reports are scheduled to run, and how many weeks back from the current time the current week is in the reports. To configure these settings, perform the following steps: To start the Entity Explorer tool, enter the `esexplorer.bat` command from your Service Monitor installation directory. From the main menu, select Store -> Connect. Click Browse, and open the following file in your Service Monitor installation: `InstallDir/conf/fed/PrimaryStore.xml` On the Entities tab on the left, expand the `Entity Stores` tree, and select the `Reporter` node. In the panel on right, double-click the `reportScheduledTime` field in the Value column. Enter a cron expression that specifies when you wish the report to run. For example, the default expression is `0 1 0 ? * MON`, which specifies to run the report each Monday morning at 0:01. For more details on how to use this syntax, see the section on Cron Expressions in the Policy Execution Scheduling topic. You can also use the `reportEndWeekOffset` setting to specify how many weeks back from the current time that the current week is in the report. The default value is `1`, which generates a report for the full previous week from the current time that the report is run, and compares with the values from the week before that. For example, if the report is scheduled to run on Monday morning, it includes the previous week, not only those few hours of the current week. If the value is `0`, the report only includes data from the current week until now, and compares with the values from the previous week. You can use values higher than `1` to generate a report for any previous week for which there is corresponding data in the database. Click Update when finished.