Contribute Code

You can contribute code to the OpenNMS Plugin for Grafana project via GitHub. This section describes the codebase and how to prepare your development environment.

Codebase

Plugin development is done in the project’s default GitHub branch (develop). Commits are automatically compiled, tested, and merged to the master branch. Releases are tagged from the master branch and submitted to the Grafana plugin repository.

Prepare development environment

Follow these steps to prepare your development environment:

  1. Download and install Node.js and Grafana.

  2. Edit grafana.ini and configure it to allow unsigned plugin development:

    app_mode = development
    ...
    [plugins]
    allow_loading_unsigned_plugins = opennms-opennms-app
  3. Use Git to check out the repository:

    git clone https://github.com/OpenNMS/grafana-plugin.git opennms-grafana-plugin
  4. Navigate to your plugin directory:

    cd opennnms-grafana-plugin
  5. Install the build and runtime dependencies:

    npm ci
  6. Build the plugin to prime your dist directory:

    npm run dev
  7. Symlink your dist directory to Grafana’s plugin path:

    ln -s /path/to/opennms-grafana-plugin/dist /var/lib/grafana/plugins/opennms-opennms-app
  8. Run a continuous build that watches for changes:

    npm run watch

    After you save a change to the plugin, refresh Grafana to load the updates.