Install from Source

This section describes how to install the OpenNMS Plugin for Grafana from source.

These instructions assume that you already have Grafana installed on your target system. If you do not have an existing Grafana instance, see Install from Package.

Build the plugin

Follow these steps to build the plugin:

  1. Download the source tree into a subfolder called opennms-opennms-app in Grafana’s plugin directory:

    mkdir -p /var/lib/grafana/plugins
    cd /var/lib/grafana/plugins
    git clone https://github.com/OpenNMS/grafana-plugin.git opennms-opennms-app
  2. Compile the plugin:

    cd /var/lib/grafana/plugins/opennms-opennms-app
    npm install
    npm run build
  3. Restart Grafana:

    systemctl restart grafana-server

Build Docker image

We use the following conventions for build arguments in this procedure:

  • GRAFANA_VERSION: The version number for Grafana (default: latest).

  • OPENNMS_GRAFANA_PLUGIN_VERSION: Used as a label in org.opennms.grafana-plugin.version to identify the running plugin version.

Follow these steps to build a Docker image from source:

  1. Create a tarball artifact from the compiled source code:

    mkdir -p ./artifacts
    tar --exclude='.git' \
        --exclude='.circleci' \
        --exclude='./artifacts' \
        -czf "./artifacts/opennms-grafana-plugin.tar.gz" .
  2. Build the Docker image and install the plugin from the tarball artifact:

    docker build \
        --build-arg GRAFANA_VERSION=latest \
        --build-arg OPENNMS_GRAFANA_PLUGIN_VERSION=SNAPSHOT \
        -t mygrafana-plugin:snapshot .
  3. Run Docker:

    docker run -p 3000:3000 mygrafanaplugin:snapshot

Next steps

After you install Grafana and the OpenNMS Plugin for Grafana, you can create your first dashboard.