Grafana dashboard: Rancher Hosts and Services Monitoring
Description: Hosts and Services Monitoring from Prometheus Rancher Exporter

Monitor Rancher Hosts, Stack and Services states with alerting (require prometheus-rancher-exporter)

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "4.6.3"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "singlestat",
      "name": "Singlestat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Hosts and Services Monitoring from Prometheus Rancher Exporter",
  "editable": true,
  "gnetId": 4095,
  "graphTooltip": 0,
  "hideControls": false,
  "id": null,
  "links": [],
  "refresh": "10s",
  "rows": [
    {
      "collapse": false,
      "height": 94,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "rgba(245, 54, 54, 0.63)",
            "rgba(237, 129, 40, 0.43)",
            "rgba(50, 172, 45, 0)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "100px",
          "id": 80,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "repeat": "host",
          "span": 4,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": true,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "max(rancher_host_state{name=~\"$host\",state=\"active\"})*100 + max(rancher_host_state{name=~\"$host\",state=\"activating\"})*95 + max(rancher_host_state{name=~\"$host\",state=\"registering\"})*90 + max(rancher_host_state{name=~\"$host\",state=\"provisioned\"})*85 + max(rancher_host_state{name=~\"$host\",state=\"requested\"})*80 + max(rancher_host_state{name=~\"$host\",state=\"updating_active\"})*75 + max(rancher_host_state{name=~\"$host\",state=\"restoring\"})*70 + max(rancher_host_state{name=~\"$host\",state=\"removing\"})*50 + max(rancher_host_state{name=~\"$host\",state=\"deactivating\"})*45 + max(rancher_host_state{name=~\"$host\",state=\"updating_inactive\"})*40 + max(rancher_host_state{name=~\"$host\",state=\"purging\"})*35 + max(rancher_host_state{name=~\"$host\",state=\"purged\"})*30 + max(rancher_host_state{name=~\"$host\",state=\"provisioned\"})*25 + max(rancher_host_state{name=~\"$host\",state=\"erroring\"})*20 + max(rancher_host_state{name=~\"$host\",state=\"removed\"})*15 + max(rancher_host_state{name=~\"$host\",state=\"error\"})*10 +  max(rancher_host_state{name=~\"$host\",state=\"inactive\"})*5",
              "format": "time_series",
              "intervalFactor": 2,
              "metric": "ran",
              "refId": "A",
              "step": 4
            }
          ],
          "thresholds": "30,80",
          "title": "$host",
          "transparent": false,
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [
            {
              "op": "=",
              "text": "",
              "value": "100"
            },
            {
              "op": "=",
              "text": "activating",
              "value": "95"
            },
            {
              "op": "=",
              "text": "registering",
              "value": "90"
            },
            {
              "op": "=",
              "text": "provisioned",
              "value": "85"
            },
            {
              "op": "=",
              "text": "requested",
              "value": "80"
            },
            {
              "op": "=",
              "text": "updating_active",
              "value": "75"
            },
            {
              "op": "=",
              "text": "restoring",
              "value": "70"
            },
            {
              "op": "=",
              "text": "removing",
              "value": "50"
            },
            {
              "op": "=",
              "text": "deactivating",
              "value": "45"
            },
            {
              "op": "=",
              "text": "updating_inactive",
              "value": "40"
            },
            {
              "op": "=",
              "text": "purging",
              "value": "35"
            },
            {
              "op": "=",
              "text": "purged",
              "value": "30"
            },
            {
              "op": "=",
              "text": "provisioned",
              "value": "25"
            },
            {
              "op": "=",
              "text": "erroring",
              "value": "20"
            },
            {
              "op": "=",
              "text": "removed",
              "value": "15"
            },
            {
              "op": "=",
              "text": "error",
              "value": "10"
            },
            {
              "op": "=",
              "text": "inactive",
              "value": "5"
            }
          ],
          "valueName": "current"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "Hosts",
      "titleSize": "h4"
    },
    {
      "collapse": false,
      "height": 101,
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": true,
          "colorValue": false,
          "colors": [
            "#bf1b00",
            "#c15c17",
            "rgba(50, 172, 45, 0)"
          ],
          "datasource": "${DS_PROMETHEUS}",
          "format": "none",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "height": "",
          "id": 41,
          "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"
            }
          ],
          "repeat": "service",
          "span": 2,
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": true,
            "lineColor": "rgb(31, 120, 193)",
            "show": true
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "max(rancher_service_state{name=\"$service\",state=\"active\"})*100 + max(rancher_service_state{name=\"$service\",state=\"upgraded\"})*95 + max(rancher_service_state{name=\"$service\",state=\"finishing_upgrade\"})*90 + max(rancher_service_state{name=\"$service\",state=\"upgrading\"})*85 + max(rancher_service_state{name=\"$service\",state=\"updating_active\"})*80 + max(rancher_service_state{name=\"$service\",state=\"activating\"})*75 + max(rancher_service_state{name=\"$service\",state=\"requested\"})*70 + max(rancher_service_state{name=\"$service\",state=\"canceled_upgrade\"})*65 + max(rancher_service_state{name=\"$service\",state=\"restarting\"})*60 + max(rancher_service_state{name=\"$service\",state=\"registering\"})*55 + max(rancher_service_state{name=\"$service\",state=\"canceling_upgrade\"})*50 + max(rancher_service_state{name=\"$service\",state=\"rolling_back\"})*45 + max(rancher_service_state{name=\"$service\",state=\"removing\"})*25 + max(rancher_service_state{name=\"$service\",state=\"removed\"})*20 + max(rancher_service_state{name=\"$service\",state=\"updating_inactive\"})*15 + max(rancher_service_state{name=\"$service\",state=\"deactivating\"})*10 + max(rancher_service_state{name=\"$service\",state=\"inactive\"})*5",
              "format": "time_series",
              "intervalFactor": 2,
              "metric": "ran",
              "refId": "A",
              "step": 4
            }
          ],
          "thresholds": "30,80",
          "title": "$service",
          "type": "singlestat",
          "valueFontSize": "50%",
          "valueMaps": [
            {
              "op": "=",
              "text": "",
              "value": "100"
            },
            {
              "op": "=",
              "text": "upgraded",
              "value": "95"
            },
            {
              "op": "=",
              "text": "finishing_upgrade",
              "value": "90"
            },
            {
              "op": "=",
              "text": "upgrading",
              "value": "85"
            },
            {
              "op": "=",
              "text": "updating_active",
              "value": "80"
            },
            {
              "op": "=",
              "text": "activating",
              "value": "75"
            },
            {
              "op": "=",
              "text": "requested",
              "value": "70"
            },
            {
              "op": "=",
              "text": "canceled_upgrade",
              "value": "65"
            },
            {
              "op": "=",
              "text": "restarting",
              "value": "60"
            },
            {
              "op": "=",
              "text": "registering",
              "value": "55"
            },
            {
              "op": "=",
              "text": "canceling_upgrade",
              "value": "50"
            },
            {
              "op": "=",
              "text": "rolling_back",
              "value": "45"
            },
            {
              "op": "=",
              "text": "removing",
              "value": "25"
            },
            {
              "op": "=",
              "text": "removed",
              "value": "20"
            },
            {
              "op": "=",
              "text": "updating_inactive",
              "value": "15"
            },
            {
              "op": "=",
              "text": "deactivating",
              "value": "10"
            },
            {
              "op": "=",
              "text": "inactive",
              "value": "5"
            }
          ],
          "valueName": "current"
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "Services",
      "titleSize": "h4"
    },
    {
      "collapse": false,
      "height": 347,
      "panels": [
        {
          "alert": {
            "conditions": [
              {
                "evaluator": {
                  "params": [
                    1
                  ],
                  "type": "lt"
                },
                "operator": {
                  "type": "and"
                },
                "query": {
                  "params": [
                    "A",
                    "1m",
                    "now"
                  ]
                },
                "reducer": {
                  "params": [],
                  "type": "last"
                },
                "type": "query"
              }
            ],
            "executionErrorState": "alerting",
            "frequency": "60s",
            "handler": 1,
            "name": " alert",
            "noDataState": "no_data",
            "notifications": []
          },
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "fill": 0,
          "id": 59,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 1,
          "points": false,
          "renderer": "flot",
          "repeat": null,
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 4,
          "stack": false,
          "steppedLine": true,
          "targets": [
            {
              "expr": "rancher_host_state{state=\"active\"}",
              "format": "time_series",
              "intervalFactor": 2,
              "legendFormat": "{{ name }}",
              "refId": "A",
              "step": 2
            }
          ],
          "thresholds": [
            {
              "colorMode": "critical",
              "fill": true,
              "line": true,
              "op": "lt",
              "value": 1
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "-0.1",
              "show": false
            },
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "0",
              "show": false
            }
          ]
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "fill": 0,
          "id": 60,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 1,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 4,
          "stack": false,
          "steppedLine": true,
          "targets": [
            {
              "expr": "rancher_stack_state{state=\"active\"}",
              "format": "time_series",
              "intervalFactor": 2,
              "legendFormat": "{{ name }}",
              "metric": "",
              "refId": "A",
              "step": 2
            }
          ],
          "thresholds": [
            {
              "colorMode": "critical",
              "fill": false,
              "line": false,
              "op": "lt",
              "value": 1
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "-0.1",
              "show": false
            },
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "0",
              "show": false
            }
          ]
        },
        {
          "alert": {
            "conditions": [
              {
                "evaluator": {
                  "params": [
                    1
                  ],
                  "type": "lt"
                },
                "operator": {
                  "type": "and"
                },
                "query": {
                  "params": [
                    "A",
                    "5m",
                    "now"
                  ]
                },
                "reducer": {
                  "params": [],
                  "type": "last"
                },
                "type": "query"
              }
            ],
            "executionErrorState": "alerting",
            "frequency": "60s",
            "handler": 1,
            "name": " alert",
            "noDataState": "alerting",
            "notifications": [
              {
                "id": 1
              }
            ]
          },
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "${DS_PROMETHEUS}",
          "decimals": 0,
          "fill": 0,
          "id": 61,
          "legend": {
            "alignAsTable": true,
            "avg": false,
            "current": true,
            "hideEmpty": false,
            "hideZero": false,
            "max": false,
            "min": false,
            "rightSide": true,
            "show": true,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "links": [],
          "nullPointMode": "null",
          "percentage": false,
          "pointradius": 1,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "span": 4,
          "stack": false,
          "steppedLine": true,
          "targets": [
            {
              "expr": "rancher_service_state{state=\"active\"}",
              "format": "time_series",
              "instant": false,
              "intervalFactor": 2,
              "legendFormat": "{{ name }}",
              "metric": "",
              "refId": "A",
              "step": 2
            }
          ],
          "thresholds": [
            {
              "colorMode": "critical",
              "fill": true,
              "line": true,
              "op": "lt",
              "value": 1
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "transparent": false,
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "-0.1",
              "show": true
            },
            {
              "format": "percentunit",
              "label": "",
              "logBase": 1,
              "max": "1",
              "min": "0",
              "show": false
            }
          ]
        }
      ],
      "repeat": null,
      "repeatIteration": null,
      "repeatRowId": null,
      "showTitle": true,
      "title": "Alerting",
      "titleSize": "h4"
    }
  ],
  "schemaVersion": 14,
  "style": "dark",
  "tags": [
    "rancher",
    "services",
    "docker",
    "prometheus"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "host",
        "options": [],
        "query": "label_values(rancher_host_state, name)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "stack",
        "options": [],
        "query": "label_values(rancher_stack_state, name)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "hide": 2,
        "includeAll": true,
        "label": null,
        "multi": true,
        "name": "service",
        "options": [],
        "query": "label_values(rancher_service_state, name)",
        "refresh": 1,
        "regex": "",
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "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": "Rancher Hosts and Services Monitoring",
  "version": 35
}