... how to run MoSKito-Central in Remote Mode
Why Remote Mode?
There are 2 modes for MoSKito-Central deployment:
- Remote (Standalone app).
- Embedded.
In Remote mode, MoSKito-Central is working as a separate application and uses:
- DistributeMe and REST EndPoints for receiving data from other applications.
- Dedicated machine's filesystem for processing and storing the received performance data.
The Remote (Standalone) Mode is useful when you need to monitor multiple application instances (multiple JVM's) and consolidate the obtained performance data in one place.
The Embedded mode cannot be used here, since we gather info from multiple servers (not a single JVM), and MoSKito-Central needs to have a separate space for data storage.
How Remote Mode Works
The flowchart below shows how the process is set up, step by step.
The workflow stages are the following:
- MoSKito-Central is instantiated on a remote (dedicated) machine.
- MoSKito plug-in, initiated on a app server (like Tomcat), fetches performance data from MoSKito-Essential, which resides in the target (monitored) web application.
- The collected data is transferred to MoSKito-Central in one of the following ways:
- directly, through EmbeddedConnector,
- via RMI, through DistributeMeConnector, or
- via HTTP, through RESTConnector.
- The data is processed and stored in application memory, file system (json, xml or csv files) or database.
How to Set It Up
To set up MoSKito-Central in Remote mode, you'll need to:
Declare dependencies.
- Enable MoSKito-Central.
- Configure storages.
Declare Dependencies
Make a reference to MoSKito-Central in pom.xml of your project:
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
Transferring data via HTTP with REST Connector
Setting up remote HTTP server:
Clone our MoSKiTo-Central repository and build moskito-central-rest-webapp module. Now moskito-central-rest-webapp-${version}.war from target directory can be deployed.
You may want to configure your moskito-central instance storages. To do this follow this article.
Setting up HTTP client:
Declaring dependencies:
First add following in your project pom file:
<dependency> <groupId>org.moskito</groupId> <artifactId>moskito-central-rest-connector</artifactId> <version>1.1.4</version> </dependency>
Configuring connector:
To enable MoSKito-Central HTTP connector, add the corresponding plug-in to moskito.json configuration file.
"@pluginsConfig": { "@plugins": [ { "name": "RESTRemoteCentralConnector", "configurationName": "rest-connector", "className": "org.moskito.central.connectors.rest.RESTConnector" } ] },
Next create configuration json file named as it set in plugin incude config property configurationName (file name should be rest-connector.json assuming example above):
{ "host": "localhost", "port": 8080, "resourcePath": "/central/addSnapshot", "basicAuthEnabled" : true, "login" : "moskito", "password" : "central" }
Configuration contains following properties:
- host - required. Host of MoSKiTo-Central remote instance;
- port - required. Port of remote instance;
- resourcePath - required. Url path to snapshot receiving method. Should be /central/addSnapshot if remote Central container deployed as ROOT;
- basicAuthEnabled - boolean. Enables HTTP Basic authentication if set to true;
- login - authentication login;
- password - authentication password;
- hostVerificationEnabled - boolean. Enables host verification by certificate.
- trustSefSigned - boolean. All self-signed certificates are trusted if set to true (even if they not from TrustStore);
- trustStoreFilePath - path to TrustStore file;
- trustStorePassword - TrustStore password;
Visit this page to learn more about HTTP Connector authentication mechanism
Transferring data via RMI with DistributeMe Connector:
Setting up DistributeMe MoSKiTo-Central server:
Clone our MoSKiTo-Central repository and build moskito-central-dime-server module. Now moskito-central-dime-server-${version}-jar-with-dependencies.jar is available in your target directory.
Now you can run server by following command:
java -jar moskito-central-dime-server-${version}-jar-with-dependencies.jar -DlocalRmiRegistryPort=9255
Where localRmiRegistryPort is port of RMI connector. Also server supports other DistributeMe configuration options.
You may want to configure your moskito-central instance storages. To do this follow this article.
Setting up DistributeMe MoSKiTo-Central client:
Declaring dependencies:
First add dependencies to your project pom file:
<dependency> <groupId>org.moskito</groupId> <artifactId>moskito-central-distributeme-connector</artifactId> <version>1.1.4</version> </dependency>
Configuring connector:
To enable MoSKito-Central RMI connector, add the corresponding plug-in to moskito.json configuration file.
"@pluginsConfig": { "@plugins": [ { "name": "DiMeRemoteCentralConnector", "configurationName": "dime-connector", "className": "org.moskito.central.connectors.dime.DiMeCentralConnector" } ] },
Next create configuration file for plugin. Name should be same as property configurationName of plugin include config with .json file extension (Be dime-connector.json applying config above).
{ "connectorHost" : "localhost", "connectorPort" : 9249 }
This config contains host and port of remote Moskito-Central storage with RMI connector.
Storage Configuration
Storage configuration is the same for both Embedded and Remote Modes.
That is why it is fully described in Configure MoSKito-Central Storage section.