After reading this doc, you will know...

... how to run MoSKito-Central, embedded into your application

On this page

Why Embedded Mode?

Normally, MoSKito-Central is deployed as a separate application (Standalone mode), offering connection endpoints to be accessed by other applications via RMI, HTTP or other data transfer protocols.

However, in some cases it may be a good idea to embed MoSKito-Central into your app. In case you:

  1. ... only have a single-node application (with one JVM & one MoSKito-Essential instance), 
  2. ... want to save performance data, taken by MoSKito-Essential, in the app server's filesystem (meaning you have direct access to the storage resource from which your app is running), 

having additional remote application is unneeded overhead. In this situation, the Embedded Mode is the most optimal, resource- and time-saving solution.

Embedded Mode Overview

To get a better idea of how the data flows to MoSKito-Central in Embedded Mode, see the diagram below.

The data transfer stages are the following:

  1. MoSKito plug-in, initiated on a app server (like Tomcat), fetches performance data from MoSKito-Essential, which resides in the target (monitored) web application.
  2. When started, the Embedded Connector instantiates MoSKito-Control.
  3. The collected data arrives directly to MoSKito-Central via Embedded Connector.
  4. The data is processed and stored in application memory, file system (json, xml or csv files) or database. 

Thus, the first thing we need is the Embedded Connector which instantiates MoSKito-Central. 

Set up Instructions

The setup process involves 3 main stages:

  1. Declare dependencies.
  2. Enable MoSKito-Central.
  3. Configure storages.

Declare Dependencies

In pom.xml of your project you will need to refer to moskito-central:

pom.xml
<dependency>
    <groupId>org.moskito</groupId>
    <artifactId>moskito-central-embedded-connector</artifactId>
    <version>1.1.4</version>
</dependency>

Please refer to maven for the latest version: http://search.maven.org/#search%7Cga%7C1%7Cmoskito-central

If you use another build tool you will need to put moskito-central.jar and other libs in your project.

Enable MoSKito-Central

To enable MoSKito-Central, add the following plugin to moskito.json configuration file:

"@pluginsConfig": {
	"@plugins": [
    	{
        	"name": "EmbeddedCentralConnector",
            "configurationName": "none",
            "className": "org.moskito.central.connectors.embedded.EmbeddedConnector"
        }
	]
},

The EmbeddedConnector will start a local MoSKito-Central instance.

Configure Storage

Storage configuration is the same for both Embedded and Remote Modes.

That is why it is fully described in Configure MoSKito-Central Storage section.

Demo Project

For a working example of embedded Central configuration, please refer to our open-source GitHub MoSKito-Demo Project.