# Setting Up Monitoring

Monitoring is a new feature of Exago v2017.1 that allows you to track report management, execution, and performance statistics for the web application and schedulers. Monitoring data is stored in local sqlite database files, and can be reported on using Exago.

When you install the Exago web application, the monitoring system is automatically installed, but it is disabled by default. You must configure and enable it manually. Many actions in the application can be tracked:

- Report management
  - Edit
  - Execute (begin & end)
  - Save
  - Delete
  - Rename
  - Duplicate
- Report designer usage
  - Gauge Wizard
  - Google Map Wizard
  - GeoChart Wizard
  - Map Wizard
- Scheduling
  - Scheduled report
  - Schedule Manager

Monitoring for these components can be toggled on or off depending on your needs.

Additionally, you can track track CPU and memory load for each scheduler application so you can fine-tune your load balancing setup.

To set up monitoring, you need to configure the monitoring application, set your options for which data to collect, and then set the monitoring service to run automatically.

# Configuring monitoring

The monitoring system is located in a folder `MonitoringService`, in the same folder as where the web application is installed. The web application stores its monitoring data in a `Monitoring` subfolder of the installation. So you should have the following folders:

- ExagoWeb
- Monitoring
- MonitoringService

Windows: Ensure that the IIS user has Full Control permissions for the `ExagoWeb\Monitoring` and `MonitoringService` folders. See Configuring IIS for instructions.

To configure monitoring:

1. In `MonitoringService`, open the file `Monitoring.exe.config` in a text or xml editor. For each of the following keys in the `<appSettings>` element, set the values as follows:
   - `exagoAppPath, value="path"` where `path` is the file path to the web app
     Format: `"C:\file\path\"` (Windows), `"/file/path/"` (Linux)
     A trailing slash (\) or (/) is required
   - `userConfig, value="config"` where `config` is the application config file
     Format: `"filename.xml"
     `Use extension `.xml` for either the encrypted or unencrypted version
   - `webAppUri, value="uri"` where `uri` is the url virtual path to the web app
     Format: `"http://local/path/"
     `A trailing backslash (/) is required
   - Optional: `ExtractionIntervalMinutes, value="i"` where `i` is the number of minutes between updates to the core database. The default is 3.
   - Optional: `StatisticsIntervalMinutes, value="j"` where `j` is the number of minutes between when each scheduler is polled for performance statistics. The default is 1.

   ### Example

       <appSettings>
       <add key="ExtractionIntervalMinutes" value="3" />
       <add key="StatisticsIntervalMinutes" value="1" />
       <add key="exagoAppPath" value="C:\ExagoWeb\" />
       <add key="userConfig" value="WebReports.xml" />
       <add key="webAppUri" value="http://localhost/monitoring/" />
       </appSettings>

2. In `ExagoWeb`, open the file `appSettings.config` in a text or xml editor. In the `<appSettings>` element, set the `Monitoring.DbPath` key to the folder where your web application's monitoring data file is. The default location is `ExagoWeb\Monitoring`.

   ### Example

       <appSettings>
       <add key="Monitoring.DbPath" value="C:\Exago\ExagoWeb\Monitoring\" />
       ...
       </appSettings>

3. In the same file, set the options for which types of usage data you want to collect. To turn on monitoring for a specific action, set the value for the key to "true". Available options are as follows:

   Note. Keys are formatted as `"Monitoring.Option"`; The `"Monitoring."` prefix is omitted below.

   - CollectDeleteReportUsage
   - CollectRenameReportUsage
   - CollectDuplicateReportUsage
   - CollectExecuteReportUsage
   - CollectSaveReportUsage
   - CollectSaveReportXmlUsage
   - CollectDesignReportUsage
   - CollectGaugeControlUsage
   - CollectGoogleMapControlUsage
   - CollectMapControlUsage
   - CollectChartControlUsage
   - CollectScheduleReportControlUsage
   - CollectScheduleReportManagerControlUsage

   ### Example

       <appSettings>
       ...
       <add key="Monitoring.CollectDeleteReportUsage" value="true" />
       <add key="Monitoring.CollectRenameReportUsage" value="false" />
       <add key="Monitoring.CollectDuplicateReportUsage" value="true" />
       <add key="Monitoring.CollectExecuteReportUsage" value="true" />
       ...
       </appSettings>

4. Restart your web server for the changes to be applied.

# Configuring scheduler monitoring

If you want to track scheduled report execution, do the following for each scheduler application:

Open the eWebReportsScheduler.exe.config file in a text or xml editor. Add the following key to the `<appSettings>` element:

    <add key="Monitoring.CollectExecuteReportUsage" value="true" />

# Enabling the polling service

The monitoring system uses a Windows or Linux service that updates the core database with data from the web application and schedulers at specified intervals. This way you have the data from every component in a single location.

The service is installed automatically, but it is not enabled by default.

To enable the service:

## Windows

1. As an administrator, open the Services manager:
   1. Click Start>Run.
   2. Type `services.msc`.
   3. Press Enter.
2. Locate the service `Exago Monitoring Service vX.X.X.X`, where `vX.X.X.X` is your Exago version. Right-click the service and select Properties.
3. In the Properties window:
   1. From the Startup Type list, select Automatic.
   2. Click Start to start the service.
   3. Click OK.

# Using the monitoring database with Exago

Before using monitoring data in reports, you need to add the core database file `MonitoringService/Monitoring.sqlite` as an Exago data source. See Using SQLite Data Sources for instructions.