Configure Sysdig with Grafana

Sysdig enables Grafana users to query metrics from Sysdig and visualize them in Grafana dashboards. In order to integrate Sysdig with Grafana, you configure a data source. There are two types of data sources supported:

  • Prometheus

    Prometheus data source comes with Grafana and is natively compatible with PromQL. Sysdig provides a Prometheus-compatible API to achieve API-only integration with Grafana.

  • Sysdig

    Sysdig data source requires additional settings and is more compatible with the simple “form-based” data configuration. Use the Sysdig native API instead of the Prometheus API. See Sysdig Grafana datasource for more information.

Using the Prometheus API on Grafana v6.7 and Above

You use the Sysdig Prometheus API to set up the datasource to use with Grafana. Before Grafana can consume Sysdig metrics, Grafana must authenticate itself to Sysdig. To do so, you must set up an HTTP authentication by using the Sysdig API Token because no UI support is currently available on Grafana.

  1. Assuming that you are not using Grafana, spin up a Grafana container as follows:

    $ docker run --rm -p 3000:3000 --name grafana grafana/grafana
  2. Login to Grafana as administrator and create a new datasource by using the following information:

    grafana.png
    • URL: https://<Monitor URL for Your Region>/prometheus

      See SaaS Regions and IP Ranges and identify the correct URLs associated with your Sysdig application and region.

    • Authentication: Do not select any authentication mechanisms.

    • Access: Server (default)

    • Custom HTTP Headers:

      • Header: Authorization

      • Value:  Bearer <Your Sysdig API Token>

        API Token is available through Settings > User Profile > Sysdig Monitor API.

Using the Grafana API on Grafana v6.6 and Below

You use the Grafana API to set up the Sysdig datasource.

  1. Download and run Grafana in a container.

    docker run --rm -p 3000:3000 --name grafana grafana/grafana
  2. Create a JSON file.

    cat grafana-stg-ds.json
    {
        "name": "Sysdig staging PromQL",
        "orgId": 1,
        "type": "prometheus",
        "access": "proxy",
        "url": "https://app-staging.sysdigcloud.com/prometheus",
        "basicAuth": false,
        "withCredentials": false,
        "isDefault": false,
        "editable": true,
        "jsonData": {
            "httpHeaderName1": "Authorization",
            "tlsSkipVerify": true
        },
        "secureJsonData": {
            "httpHeaderValue1": "Bearer your-Sysdig-API-token"
        }
    }
  3. Get your Sysdig API Token and plug it in the JSON file above.

    “httpHeaderValue1”: “Bearer your_Sysdig_API_Token”
  4. Add the datasource to Grafana.

    curl -u admin:admin -H "Content-Type: application/json" http://localhost:3000/api/datasources -XPOST -d @grafana-stg-ds.json
  5. Run Grafana.

    http://localhost:3000
  6. Use the default credentials, admin: admin, to sign in to Grafana.

  7. Open the Data Source tab under Configuration on Grafana and confirm that the one you have added is listed on the page.

    grafana_config.png