Grafana dashboard: icinga2-influxdb-host
Description: Icinga2 with InfluxDB showing all configured services.

# Icinga2 Automatic Dashboard

This dashboard will show all services for a selected host. 

Setup Icinga2 with InfluxDB feature as described in the [docs](https://docs.icinga.com/icinga2/latest/doc/module/icinga2/chapter/object-types#objecttype-influxdbwriter).


Do not use this with the icingaweb2-module-grafana!

{
  "__inputs": [
    {
      "name": "DS_ICINGA2-INFLUXDB",
      "label": "icinga2-influxdb",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.1.2"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    }
  ],
  "annotations": {
    "list": []
  },
  "editable": true,
  "gnetId": 1572,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "refresh": false,
  "rows": [
    {
      "collapse": false,
      "height": 250,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "rgba(50, 172, 45, 0.97)",
            "rgb(255, 0, 0)",
            "rgb(255, 0, 0)"
          ],
          "datasource": "${DS_ICINGA2-INFLUXDB}",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "id": 28,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "minSpan": 2,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false
          },
          "targets": [
            {
              "dsType": "influxdb",
              "groupBy": [],
              "measurement": "hostalive",
              "policy": "default",
              "query": "SELECT last(\"state\") FROM \"hostalive\" WHERE \"hostname\" =~ /^$hostname$/ AND $timeFilter",
              "rawQuery": false,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "state"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "last"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "hostname",
                  "operator": "=~",
                  "value": "/^$hostname$/"
                }
              ]
            }
          ],
          "thresholds": "1",
          "title": "Host Status",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "UP",
              "value": "0"
            },
            {
              "op": "=",
              "text": "DOWN",
              "value": "1"
            },
            {
              "op": "=",
              "text": "DOWN",
              "value": "2"
            }
          ],
          "valueName": "avg"
        },
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_ICINGA2-INFLUXDB}",
          "fill": 1,
          "id": 32,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": false,
            "min": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "alias": "pl",
              "yaxis": 2
            }
          ],
          "span": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "pl",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "none"
                  ],
                  "type": "fill"
                }
              ],
              "measurement": "hostalive",
              "policy": "default",
              "query": "SELECT mean(\"value\") FROM \"hostalive\" WHERE \"hostname\" =~ /^$hostname$/ AND \"metric\" = 'rta' AND $timeFilter GROUP BY time($interval) fill(none)",
              "rawQuery": false,
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "hostname",
                  "operator": "=~",
                  "value": "/^$hostname$/"
                },
                {
                  "condition": "AND",
                  "key": "metric",
                  "operator": "=",
                  "value": "pl"
                }
              ]
            },
            {
              "alias": "rta",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "none"
                  ],
                  "type": "fill"
                }
              ],
              "measurement": "hostalive",
              "policy": "default",
              "query": "SELECT mean(\"value\") FROM \"hostalive\" WHERE \"hostname\" =~ /^$hostname$/ AND \"metric\" = 'rta' AND $timeFilter GROUP BY time($interval) fill(none)",
              "rawQuery": false,
              "refId": "B",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "hostname",
                  "operator": "=~",
                  "value": "/^$hostname$/"
                },
                {
                  "condition": "AND",
                  "key": "metric",
                  "operator": "=",
                  "value": "rta"
                }
              ]
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "HostAlive",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "s",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "percent",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    },
    {
      "collapse": false,
      "height": "250px",
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "datasource": "${DS_ICINGA2-INFLUXDB}",
          "fill": 1,
          "id": 1,
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": true,
            "max": true,
            "min": true,
            "rightSide": false,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "minSpan": null,
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 5,
          "points": false,
          "renderer": "flot",
          "repeat": null,
          "seriesOverrides": [],
          "span": 12,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "alias": "$tag_metric",
              "dsType": "influxdb",
              "groupBy": [
                {
                  "params": [
                    "$interval"
                  ],
                  "type": "time"
                },
                {
                  "params": [
                    "metric"
                  ],
                  "type": "tag"
                },
                {
                  "params": [
                    "service"
                  ],
                  "type": "tag"
                },
                {
                  "params": [
                    "none"
                  ],
                  "type": "fill"
                }
              ],
              "hide": false,
              "measurement": "/^*$/",
              "policy": "autogen",
              "refId": "A",
              "resultFormat": "time_series",
              "select": [
                [
                  {
                    "params": [
                      "value"
                    ],
                    "type": "field"
                  },
                  {
                    "params": [],
                    "type": "mean"
                  }
                ]
              ],
              "tags": [
                {
                  "key": "hostname",
                  "operator": "=~",
                  "value": "/^$hostname$/"
                },
                {
                  "condition": "AND",
                  "key": "service",
                  "operator": "=~",
                  "value": "/^$service$/"
                },
                {
                  "condition": "AND",
                  "key": "metric",
                  "operator": "=~",
                  "value": "/^*$/"
                }
              ]
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeShift": null,
          "title": "$service",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "none",
              "label": "",
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ]
        }
      ],
      "repeat": "service",
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": false,
      "title": "Dashboard Row",
      "titleSize": "h6"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_ICINGA2-INFLUXDB}",
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "hostname",
        "options": [],
        "query": "SHOW TAG VALUES  WITH KEY = \"hostname\"",
        "refresh": 1,
        "regex": "",
        "sort": 1,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_ICINGA2-INFLUXDB}",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": false,
        "name": "service",
        "options": [],
        "query": "SHOW TAG VALUES  WITH KEY = \"service\" where hostname =~ /^$hostname$/",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "service.$tag",
        "tags": [],
        "tagsQuery": "SHOW MEASUREMENTS where hostname =~ /^$hostname$/ and service =~ /^$service$/",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-12h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "timezone": "browser",
  "title": "icinga2-influxdb-host",
  "version": 20,
  "description": "Icinga2 with InfluxDB showing all configured services."
}