Skip to content

Instantly share code, notes, and snippets.

@spetersson
Created April 4, 2018 07:39
Show Gist options
  • Select an option

  • Save spetersson/0297751484657b21d6609b39118d1f4f to your computer and use it in GitHub Desktop.

Select an option

Save spetersson/0297751484657b21d6609b39118d1f4f to your computer and use it in GitHub Desktop.
{
"__inputs": [
{
"name": "DS_ICINGA2-IDO",
"label": "icinga2-ido",
"description": "",
"type": "datasource",
"pluginId": "mysql",
"pluginName": "MySQL"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "5.0.3"
},
{
"type": "datasource",
"id": "mysql",
"name": "MySQL",
"version": "5.0.0"
},
{
"type": "panel",
"id": "singlestat",
"name": "Singlestat",
"version": "5.0.0"
},
{
"type": "panel",
"id": "table",
"name": "Table",
"version": "5.0.0"
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"links": [],
"panels": [
{
"columns": [],
"datasource": "${DS_ICINGA2-IDO}",
"description": "",
"fontSize": "200%",
"gridPos": {
"h": 12,
"w": 18,
"x": 0,
"y": 0
},
"id": 2,
"links": [],
"pageSize": 5,
"scroll": true,
"showHeader": true,
"sort": {
"col": 0,
"desc": true
},
"styles": [
{
"alias": "State",
"colorMode": "row",
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(245, 54, 54, 0.9)",
"rgba(245, 54, 54, 0.9)"
],
"decimals": 0,
"link": false,
"pattern": "last_hard_state",
"thresholds": [
"1"
],
"type": "number",
"unit": "short"
},
{
"alias": "Last state change",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"pattern": "last_hard_state_change",
"thresholds": [],
"type": "date",
"unit": "short"
},
{
"alias": "Hostname",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"link": true,
"linkTargetBlank": true,
"linkTooltip": "",
"linkUrl": "https://my-icinga-system/icingaweb2/monitoring/host/show?host=$__cell",
"pattern": "name1",
"preserveFormat": false,
"sanitize": false,
"thresholds": [],
"type": "string",
"unit": "short"
},
{
"alias": "Check output",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"pattern": "output",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT name1,output,last_hard_state FROM icinga_hoststatus JOIN icinga_objects ON object_id = host_object_id WHERE last_hard_state IN (1,2) AND problem_has_been_acknowledged = '0' AND is_active = 1",
"refId": "A"
}
],
"title": "Unhandled host alerts",
"transform": "table",
"transparent": false,
"type": "table"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_ICINGA2-IDO}",
"decimals": 0,
"format": "short",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 6,
"w": 6,
"x": 18,
"y": 0
},
"id": 4,
"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": "70%",
"prefix": "Host alerts:",
"prefixFontSize": "100%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "COUNT(*)",
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT COUNT(*) FROM icinga_hoststatus JOIN icinga_objects ON object_id = host_object_id WHERE last_hard_state IN (1,2) AND problem_has_been_acknowledged = '0' AND is_active = 1 LIMIT 3",
"refId": "A"
}
],
"thresholds": "3,10",
"title": "",
"type": "singlestat",
"valueFontSize": "200%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_ICINGA2-IDO}",
"decimals": 0,
"format": "short",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 6,
"w": 6,
"x": 18,
"y": 6
},
"id": 5,
"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": "70%",
"prefix": "Service alerts:",
"prefixFontSize": "100%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "COUNT(*)",
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT COUNT(*) FROM icinga_servicestatus JOIN icinga_objects ON object_id = service_object_id WHERE last_hard_state IN (1,2) AND problem_has_been_acknowledged = '0' AND is_active = 1",
"refId": "A"
}
],
"thresholds": "10,20",
"title": "",
"type": "singlestat",
"valueFontSize": "200%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"columns": [],
"datasource": "${DS_ICINGA2-IDO}",
"description": "",
"fontSize": "200%",
"gridPos": {
"h": 12,
"w": 18,
"x": 0,
"y": 12
},
"id": 6,
"links": [],
"pageSize": 5,
"scroll": true,
"showHeader": true,
"sort": {
"col": 2,
"desc": true
},
"styles": [
{
"alias": "State",
"colorMode": "row",
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"decimals": 0,
"link": false,
"pattern": "last_hard_state",
"thresholds": [
"1",
"2"
],
"type": "number",
"unit": "short"
},
{
"alias": "Oldest alert",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"pattern": "last_hard_state_change",
"thresholds": [],
"type": "date",
"unit": "short"
},
{
"alias": "Hostname",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"link": true,
"linkTargetBlank": true,
"linkTooltip": "",
"linkUrl": "https://my-icinga-system/icingaweb2/monitoring/host/show?host=$__cell",
"pattern": "name1",
"preserveFormat": false,
"sanitize": false,
"thresholds": [],
"type": "string",
"unit": "short"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"pattern": "output",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT name1,output,last_hard_state FROM icinga_servicestatus JOIN icinga_objects ON object_id = service_object_id WHERE last_hard_state IN (1,2) AND problem_has_been_acknowledged = 0 AND is_active = 1",
"refId": "A"
}
],
"title": "Unhandled service alerts",
"transform": "table",
"transparent": false,
"type": "table"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_ICINGA2-IDO}",
"decimals": 0,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 6,
"w": 6,
"x": 18,
"y": 12
},
"id": 8,
"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": "70%",
"prefix": "Active hosts: ",
"prefixFontSize": "100%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "COUNT(*)",
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT COUNT(*) FROM icinga_objects WHERE objecttype_id = 1 AND is_active = 1",
"refId": "A"
}
],
"thresholds": "3,10",
"title": "",
"type": "singlestat",
"valueFontSize": "200%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
},
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": false,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": "${DS_ICINGA2-IDO}",
"decimals": null,
"format": "none",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 6,
"w": 6,
"x": 18,
"y": 18
},
"id": 7,
"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": "70%",
"prefix": "Active services: ",
"prefixFontSize": "100%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": true,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "COUNT(*)",
"targets": [
{
"alias": "",
"format": "table",
"rawSql": "SELECT COUNT(*) FROM icinga_objects WHERE objecttype_id = 2 AND is_active = 1",
"refId": "A"
}
],
"thresholds": "3,10",
"title": "",
"type": "singlestat",
"valueFontSize": "200%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "current"
}
],
"refresh": "5s",
"schemaVersion": 16,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"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": "",
"title": "Alert statistics",
"uid": "LOTafNmiz",
"version": 18
}
@l13t
Copy link
Copy Markdown

l13t commented May 3, 2018

Hi

Great dashboard. I've small update for it.
From my point of view it's better to use next query for services:
SELECT name1,name2,output,last_hard_state FROM icinga_servicestatus JOIN icinga_objects ON object_id = service_object_id WHERE last_hard_state IN (1,2) AND problem_has_been_acknowledged = 0 AND is_active = 1 order by last_hard_state, last_check

@tobiasvdk
Copy link
Copy Markdown

Great work.

To hide services/hosts which are in a downtime, add scheduled_downtime_depth = 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment