# Monitoring platform events

## Requirements <a href="#monitoringzdarzenplatformowych-wymagania" id="monitoringzdarzenplatformowych-wymagania"></a>

* active Router2 application with EximeeEvents
  * application delivered with the Eximee platform starting from version 2.3167.0
* active WebformsRest application
  * application delivered with the Eximee platform
* active MonitoringLogProcessor application
  * application delivered with the Eximee platform 2.3019.0
* active database storing events
  * the application requires PostgreSQL version >=9.5 to run
* active Kafka instance
  * we recommend version >= 3.4
* active Grafana instance min 8.X.X
  * a sample monitoring dashboard is provided with the platform in the grafana.json file

Launching the functionality in the platform is controlled by adding the value "monitoring" to the COMPOSE\_PROFILES variable.

## Operating assumptions <a href="#monitoringzdarzenplatformowych-zalozeniadzialania" id="monitoringzdarzenplatformowych-zalozeniadzialania"></a>

The Webforms application generates events related to the state of applications.

Different implementations of event logging can be active at the same time. This depends on the configuration and deployment.\
EximeeEventsConnector (one of the possible implementations) collects events and sends them to EximeeEvents.

EximeeEvents saves them to the appropriate Kafka topic.

MonitoringEventProcessor reads events from Kafka, verifies them, and saves them to the database (PostgreSQL) in a form readable by Grafana.

Events in the database can be read by external applications for visualization or analysis.\
Grafana configuration for visualizing events will be provided together with the platform.

<figure><img src="/files/862b779e466d884cac749576a0e819aaf68c0d64" alt=""><figcaption><p><em><strong>Figure 1.</strong> Architecture of the event monitoring solution</em></p></figcaption></figure>

## Router2 application with EximeeEvents <a href="#monitoringzdarzenplatformowych-aplikacjarouter2zeximeeevents" id="monitoringzdarzenplatformowych-aplikacjarouter2zeximeeevents"></a>

### Purpose <a href="#monitoringzdarzenplatformowych-przeznaczenie" id="monitoringzdarzenplatformowych-przeznaczenie"></a>

EximeeEvents is a plugin for the Router2 application.\
It provides an endpoint that receives events, which are then saved to the appropriate Kafka topic.

{% hint style="warning" %}
The topic and message group passed to Kafka must be consistent with the MonitoringLogProcessor configuration.
{% endhint %}

### Configuration <a href="#monitoringzdarzenplatformowych-konfiguracja" id="monitoringzdarzenplatformowych-konfiguracja"></a>

Configuration and more information here \[Process event registration]

## MonitoringLogProcessor application <a href="#monitoringzdarzenplatformowych-aplikacjamonitoringlogprocessor" id="monitoringzdarzenplatformowych-aplikacjamonitoringlogprocessor"></a>

### Purpose <a href="#monitoringzdarzenplatformowych-przeznaczenie.1" id="monitoringzdarzenplatformowych-przeznaczenie.1"></a>

The application is responsible for filling the database (currently only PostgreSQL) with platform events.

The application reads events from the source (Kafka) and verifies whether it is a system event (coming from the platform).\
Then the system events are adapted for Grafana and saved to the database.

### Configuration <a href="#monitoringzdarzenplatformowych-konfiguracja.1" id="monitoringzdarzenplatformowych-konfiguracja.1"></a>

| Key                                            | Required | Example                                                      | Description                                   |
| ---------------------------------------------- | -------- | ------------------------------------------------------------ | --------------------------------------------- |
| Database - target location for storing events  |          |                                                              |                                               |
| MONITORING\_LOG\_PROCESSOR\_DATABASE\_DIALECT  | YES      | org.hibernate.dialect.PostgreSQL95Dialect                    | Database dialect intended for storing events. |
| MONITORING\_LOG\_PROCESSOR\_DATABASE\_URL      | YES      | jdbc:<postgresql://postgresql01.host:5432/monitoring_events> | Database address.                             |
| MONITORING\_LOG\_PROCESSOR\_DATABASE\_USERNAME | YES      | db\_user                                                     | User with permission to write events.         |
| MONITORING\_LOG\_PROCESSOR\_DATABASE\_PASSWORD | YES      | db\_pass                                                     | Password for the database access user.        |

#### Kafka <a href="#monitoringzdarzenplatformowych-kafka" id="monitoringzdarzenplatformowych-kafka"></a>

| Data source                              | Required |                                                   |                                            |
| ---------------------------------------- | -------- | ------------------------------------------------- | ------------------------------------------ |
| MONITORING\_LOG\_PROCESSOR\_KAFKA\_URL   | YES      | [http://kafka.host:9092](http://kafka.host:9092/) | Kafka address                              |
| MONITORING\_LOG\_PROCESSOR\_KAFKA\_TOPIC | YES      | all                                               | Topic to which event messages will be sent |
| MONITORING\_LOG\_PROCESSOR\_KAFKA\_GROUP | YES      | eximee-events                                     | Eximee event group                         |

### Saved events <a href="#monitoringzdarzenplatformowych-zapisywanezdarzenia" id="monitoringzdarzenplatformowych-zapisywanezdarzenia"></a>

Events must be of system origin (origin = SYSTEM).

Event types are modified to a business type.\
A type that does not have an equivalent in the business event receives an empty value.\
Information about the event type mapping is below:

| System event (eximee)                           | Business event       | Description                                                         |
| ----------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| FORM\_NEW\_STARTED                              | FORM\_ENTRY          | Entering the application                                            |
| <p>FORM\_NEXT\_PAGE<br>FORM\_PREVIOUS\_PAGE</p> | PAGE\_SAVE           | Saving the current page state - moving to the next or previous page |
| FORM\_CLIENT\_PAGE\_CHANGED                     | PAGE\_ENTRY          | Page change - entering another page.                                |
| FORM\_SAVE                                      | FORM\_SAVE           | Submitting the application                                          |
| FORM\_DRAFT\_SAVE                               | FORM\_DRAFT\_SAVE    | Saving a draft version of the application                           |
| FORM\_DRAFT\_RESTORE                            | FORM\_DRAFT\_RESTORE | Restoring a draft version of the application                        |

### Database structure (PostgreSQL) <a href="#monitoringzdarzenplatformowych-strukturabazydanych-postgresql" id="monitoringzdarzenplatformowych-strukturabazydanych-postgresql"></a>

Specified database structure with business events.

| Schema         |           |              | monitoring\_events                                    |
| -------------- | --------- | ------------ | ----------------------------------------------------- |
| **Table**      |           |              | **events**                                            |
| **Field name** | **Type**  | **nullable** | **Description**                                       |
| id             | bigserial | FALSE        | Sequential event identifiers                          |
| origin         | text      | FALSE        | Event origin (SYSTEM / BUSINESS)                      |
| type           | text      | FALSE        | Business event type (the event type table is above)   |
| timestamp      | timestamp | FALSE        | Time the event was triggered (date and time)          |
| payload        | jsonb     | TRUE         | Event data as JSON, if the event has additional data. |

### Migration scripts <a href="#monitoringzdarzenplatformowych-skryptymigracyjne" id="monitoringzdarzenplatformowych-skryptymigracyjne"></a>

Migration scripts for creating and modifying the table are stored in the archive to be delivered together with the platform.

## Webforms application with event logging <a href="#monitoringzdarzenplatformowych-aplikacjawebformszlogowaniemzdarzen" id="monitoringzdarzenplatformowych-aplikacjawebformszlogowaniemzdarzen"></a>

### Purpose <a href="#monitoringzdarzenplatformowych-przeznaczenie.2" id="monitoringzdarzenplatformowych-przeznaczenie.2"></a>

The event logging mechanism is responsible for collecting events related to changes in the state of applications across the entire platform.\
The events are sent in batches to Kafka using EximeeEvents.

### Configuration <a href="#monitoringzdarzenplatformowych-konfiguracja.2" id="monitoringzdarzenplatformowych-konfiguracja.2"></a>

To activate event collection, the configuration should be set appropriately *webforms.xml*.\
Below is a configuration fragment that is responsible for the active event collection flow.

{% hint style="info" %}
The connector to eximeeEvents is delivered in the eximee-events library
{% endhint %}

```
<?xml version="1.0" encoding="UTF-8" ?>
<webforms>
   ....
   <server>
      ...
      <features>
         ...
         <eventLog>
            <enabled>true</enabled>
            <coreExecutorPoolSize>5</coreExecutorPoolSize>
            <maxExecutorPoolSize>10</maxExecutorPoolSize>
            <eximeeEventsProcessor>
               <enabled>true</enabled>
               <url>http://localhost:9002</url>
            </eximeeEventsProcessor>
         </eventLog>
      </features>
   </server>
</webforms>
```

And a table showing the installation configuration.

<table><thead><tr><th width="187">Installation key</th><th>Configuration key</th><th width="187">Example value</th><th>Description</th></tr></thead><tbody><tr><td>Active event collection mechanism</td><td></td><td></td><td></td></tr><tr><td><br></td><td>server.features.eventLog.enabled</td><td>true</td><td>Activity of the event collection mechanism</td></tr><tr><td><br></td><td>server.features.eventLog.coreExecutorPoolSize</td><td>5</td><td>Number of threads within event processing</td></tr><tr><td><br></td><td>server.features.eventLog.maxExecutorPoolSize</td><td>10</td><td>Maximum number of threads within event processing</td></tr><tr><td>Active event logging mechanism</td><td></td><td></td><td></td></tr><tr><td><br></td><td>server.features.eventLog.eximeeEventsProcessor.enabled</td><td>true</td><td>Activity of the EximeeEvents mechanism</td></tr><tr><td><br></td><td>server.features.eventLog.eximeeEventsProcessor.url</td><td><a href="http://localhost:9002/">http://localhost:9002</a></td><td>Address of the EximeeEvents application for saving events to Kafka</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eximee.com/documentation/documentation-en/eksploatacja-aplikacji/monitorowanie/monitoring-zdarzen-platformowych.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
