JavaPlugin-Exporter

  • Linux

  • Windows

With the Virtimo JavaPlugin-Exporter, you can program your own plugins with Java without having to worry about the technical integration into the VIMON. The following plugins are currently available and can be added to the JavaPlugin-Exporter:

Configuration

In the basic version of the exporter, only the HelloWorldExporter is available, which should only be active during the setup of the exporter and is used for test purposes. All other exporters are stored as .jar files in the exporter folder (vimon/exporter/javaplugin_exporter/) and must be activated via the configuration.

The configuration for the JavaPlugin exporter is located in the file vimon/config/javaplugin_exporter/javaplugin_exporter.yml.

Here you can specify which of the available plugins should be started on which Ports. The JavaPlugin-Exporter is not executable on its own, but only serves as a basis for the specific plugins.

logLevel: FINE # ALL, CONFIG, FINE, FINER, FINEST, INFO, SEVERE, WARNING, OFF
host: localhost

plugins:
  - name: HelloWorldExporter
    active: true
    port: 9106

  - name: AnotherExporter
    active: false
    port: 9103

This configuration would result in the plugin HelloWorldExporter being provided on Port 9106. AnotherExporter is not required here, is set to active: false and is therefore not started.

Configuration of the plugins

In addition to the configurations for the JavaPlugin-Exporter, each plugin receives its own individual configuration file. The configurations of all plugins are stored in the directory vimon/config/javaplugin_exporter/plugins and named helloworld_exporter.yml in the example of the HelloWorldExporter. The plugin configurations are described in the respective subpages of the plugins.

Prometheus configuration

The JavaPlugin-Exporter opens a separate Port on the server for each plugin. Therefore, the Prometheus Scrape Config is described in the subpages of the respective exporters.

Logging

The JavaPlugin-Exporter writes its logs to the file vimon/data/logs/javaplugin_exporter.log. As with the configurations, each started plugin receives its own log file in the folder vimon/data/logs/javaplugins/.

Custom development of plugins

The JavaPlugin-Exporter allows you to build your own plugins for use cases that cannot be covered by other exporters. Here is a brief description of how these plugins can be built.

Preparation

The following items are required to develop your own plugins:

  • javaplugin_exporter.jar

  • JDK 11

  • Maven

  • Development environment (e.g. IntelliJ)

  • CustomPluginTemplate Repository

The path to javaplugin_exporter.jar must be specified in the pom.xml of the CustomPluginTemplate so that the dependencies can be resolved.

Development

  1. Rename classes, folders and configuration files.
    It is advisable to adhere to the existing naming conventions for the new plugin, as the JavaPlugin exporter requires these in some places in order to start the self-developed plugin.

  2. The class CustomPluginTemplate (which now has a different name) contains a function execute. This method is executed with every request to the exporter; the specialist logic is implemented within this function. It is important that the method always returns a set of Prometheus metrics.

  3. Test the new plugin via the Main method.
    A suitable RunConfiguration is available in the repository (for IntelliJ). To start, the path to the Config and Log folder must be passed as an argument.

Deployment of the plugin

Once development is complete, the plugin is built using the command mvn clean package. The jar created must be renamed in accordance with the naming convention and can then be stored with the corresponding configuration on a server on which the Java plugin exporter is already installed.