grafana面板
{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "datasource", "uid": "grafana" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { "limit": 100, "matchAny": false, "tags": [], "type": "dashboard" }, "type": "dashboard" } ] }, "description": "Dashboard for alertsnitch。https://gitlab.com/yakshaving.art/alertsnitch", "editable": true, "fiscalYearStartMonth": 0, "gnetId": 15833, "graphTooltip": 0, "id": 2, "links": [], "liveNow": false, "panels": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 6, "w": 6, "x": 0, "y": 0 }, "id": 16, "options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "textMode": "auto" }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n COUNT(1)\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n AND status=\"firing\"", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "total number of alert sended", "transformations": [], "type": "stat" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "center", "cellOptions": { "type": "auto" }, "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "description" }, "properties": [ { "id": "custom.width", "value": 436 } ] }, { "matcher": { "id": "byName", "options": "severity" }, "properties": [ { "id": "custom.width", "value": 104 } ] }, { "matcher": { "id": "byName", "options": "env" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "startsAt" }, "properties": [ { "id": "custom.width", "value": 156 } ] }, { "matcher": { "id": "byName", "options": "严重性" }, "properties": [ { "id": "custom.width", "value": 98 } ] } ] }, "gridPos": { "h": 6, "w": 6, "x": 6, "y": 0 }, "id": 22, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "frameIndex": 1, "showHeader": true, "sortBy": [] }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n startsAt AS time,\n status,\n ID\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"firing\"\nORDER BY startsAt", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"severity\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"firing\"\n\t)\n\tAND Label=\"severity\"", "refId": "D", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "alert statistics", "transformations": [ { "id": "merge", "options": {} }, { "id": "groupBy", "options": { "fields": { "ID": { "aggregations": [ "count" ], "operation": "aggregate" }, "severity": { "aggregations": [], "operation": "groupby" } } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": {}, "renameByName": { "ID (count)": "次数", "severity": "严重性" } } } ], "type": "table" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "green", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 6, "w": 6, "x": 12, "y": 0 }, "id": 18, "options": { "colorMode": "value", "graphMode": "area", "justifyMode": "auto", "orientation": "auto", "reduceOptions": { "calcs": [ "lastNotNull" ], "fields": "", "values": false }, "textMode": "auto" }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n COUNT(1)\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"resolved\"", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "total number of alert resolved", "transformations": [], "type": "stat" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "center", "cellOptions": { "type": "auto" }, "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "description" }, "properties": [ { "id": "custom.width", "value": 436 } ] }, { "matcher": { "id": "byName", "options": "severity" }, "properties": [ { "id": "custom.width", "value": 104 } ] }, { "matcher": { "id": "byName", "options": "env" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "startsAt" }, "properties": [ { "id": "custom.width", "value": 156 } ] } ] }, "gridPos": { "h": 6, "w": 6, "x": 18, "y": 0 }, "id": 24, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "frameIndex": 1, "showHeader": true, "sortBy": [ { "desc": false, "displayName": "startsAt" } ] }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n startsAt AS time,\n status,\n ID\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"resolved\"\nORDER BY startsAt", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"severity\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"severity\"", "refId": "D", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "resolved statistics", "transformations": [ { "id": "merge", "options": {} }, { "id": "groupBy", "options": { "fields": { "ID": { "aggregations": [ "count" ], "operation": "aggregate" }, "severity": { "aggregations": [], "operation": "groupby" } } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": {}, "renameByName": { "ID (count)": "次数", "severity": "严重性" } } } ], "type": "table" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 1, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, "scaleDistribution": { "type": "linear" }, "showPoints": "auto", "spanNulls": false, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 6 }, "id": 12, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "single", "sort": "none" } }, "pluginVersion": "8.3.3", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n startsAt AS time,\n ID\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"firing\"\nORDER BY startsAt", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "alert triggered", "transformations": [ { "id": "groupBy", "options": { "fields": { "ID": { "aggregations": [ "count" ], "operation": "aggregate" }, "time": { "aggregations": [], "operation": "groupby" } } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": {}, "renameByName": { "ID (count)": "告警触发次数" } } } ], "type": "timeseries" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "palette-classic" }, "custom": { "axisCenteredZero": false, "axisColorMode": "text", "axisLabel": "", "axisPlacement": "auto", "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, "gradientMode": "none", "hideFrom": { "legend": false, "tooltip": false, "viz": false }, "lineInterpolation": "linear", "lineWidth": 1, "pointSize": 10, "scaleDistribution": { "type": "linear" }, "showPoints": "auto", "spanNulls": false, "stacking": { "group": "A", "mode": "none" }, "thresholdsStyle": { "mode": "off" } }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, "x": 12, "y": 6 }, "id": 20, "options": { "legend": { "calcs": [], "displayMode": "list", "placement": "bottom", "showLegend": true }, "tooltip": { "mode": "single", "sort": "none" } }, "pluginVersion": "8.3.3", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n startsAt AS time,\n ID\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"resolved\"\nORDER BY startsAt", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "resolved triggered", "transformations": [ { "id": "groupBy", "options": { "fields": { "ID": { "aggregations": [ "count" ], "operation": "aggregate" }, "time": { "aggregations": [], "operation": "groupby" } } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": {}, "renameByName": { "ID (count)": "恢复触发次数" } } } ], "type": "timeseries" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "cellOptions": { "type": "auto" }, "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "description" }, "properties": [ { "id": "custom.width", "value": 436 } ] }, { "matcher": { "id": "byName", "options": "severity" }, "properties": [ { "id": "custom.width", "value": 104 } ] }, { "matcher": { "id": "byName", "options": "env" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "持续时间" }, "properties": [ { "id": "unit", "value": "s" }, { "id": "custom.width", "value": 86 } ] }, { "matcher": { "id": "byName", "options": "ID" }, "properties": [ { "id": "custom.width", "value": 68 } ] }, { "matcher": { "id": "byName", "options": "名称" }, "properties": [ { "id": "custom.width", "value": 185 } ] }, { "matcher": { "id": "byName", "options": "结束时间" }, "properties": [ { "id": "custom.width", "value": 124 } ] }, { "matcher": { "id": "byName", "options": "开始时间" }, "properties": [ { "id": "custom.width", "value": 145 } ] } ] }, "gridPos": { "h": 15, "w": 12, "x": 0, "y": 14 }, "id": 10, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "frameIndex": 2, "showHeader": true, "sortBy": [ { "desc": false, "displayName": "ID" } ] }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n ID,\n status,\n startsAt,\n endsAt,\n TIMESTAMPDIFF(SECOND, startsAt, endsAt) AS duration,\n fingerprint\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n AND status=\"resolved\"\nORDER BY startsAt", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"alertname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"alertname\"", "refId": "B", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"env\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"idc\"", "refId": "C", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"severity\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"severity\"", "refId": "D", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"az\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"az\"", "refId": "E", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"hostname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"namehost\"", "refId": "F", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"project\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Label=\"group\"", "refId": "G", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"description\"\nFROM\n\tAlertAnnotation\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t AND status=\"resolved\"\n\t)\n\tAND Annotation=\"short\"", "refId": "H", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "alert resolved", "transformations": [ { "id": "merge", "options": {} }, { "id": "filterFieldsByName", "options": { "include": { "names": [ "ID", "alertname", "hostname", "description", "startsAt", "endsAt", "duration" ] } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": { "ID": 0, "alertname": 1, "description": 6, "duration": 4, "endsAt": 3, "hostname": 5, "startsAt": 2 }, "renameByName": { "ID": "ID", "alertname": "名称", "description": "描述", "duration": "持续时间", "endsAt": "结束时间", "hostname": "主机名", "startsAt": "开始时间" } } } ], "type": "table" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "left", "cellOptions": { "type": "auto" }, "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "description" }, "properties": [ { "id": "custom.width", "value": 436 } ] }, { "matcher": { "id": "byName", "options": "severity" }, "properties": [ { "id": "custom.width", "value": 104 } ] }, { "matcher": { "id": "byName", "options": "env" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "startsAt" }, "properties": [ { "id": "custom.width", "value": 156 } ] }, { "matcher": { "id": "byName", "options": "ID (last)" }, "properties": [ { "id": "custom.width", "value": 106 } ] }, { "matcher": { "id": "byName", "options": "持续时间" }, "properties": [ { "id": "unit", "value": "s" }, { "id": "custom.width", "value": 185 } ] }, { "matcher": { "id": "byName", "options": "ID" }, "properties": [ { "id": "custom.width", "value": 64 } ] } ] }, "gridPos": { "h": 15, "w": 12, "x": 12, "y": 14 }, "id": 26, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "frameIndex": 2, "showHeader": true, "sortBy": [] }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n ID,\n status,\n startsAt,\n endsAt,\n TIMESTAMPDIFF(SECOND, startsAt, NOW()) AS duration,\n fingerprint\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\nORDER BY ID", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"alertname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"alertname\"", "refId": "B", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"env\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"idc\"", "refId": "C", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"severity\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"severity\"", "refId": "D", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"az\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND \tFROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"az\"", "refId": "E", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"hostname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\nstartsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t)\n\tAND Label=\"namehost\"", "refId": "F", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"project\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t)\n\tAND Label=\"idc\"", "refId": "G", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"description\"\nFROM\n\tAlertAnnotation\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds}) \n\t)\n\tAND Annotation=\"detail\"", "refId": "H", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "alert not resolved", "transformations": [ { "id": "merge", "options": {} }, { "id": "groupBy", "options": { "fields": { "ID": { "aggregations": [ "last" ], "operation": "aggregate" }, "alertname": { "aggregations": [ "last" ], "operation": "aggregate" }, "az": { "aggregations": [ "last" ], "operation": "aggregate" }, "description": { "aggregations": [ "last" ], "operation": "aggregate" }, "duration": { "aggregations": [ "last" ], "operation": "aggregate" }, "endsAt": { "aggregations": [ "last" ], "operation": "aggregate" }, "env": { "aggregations": [ "last" ], "operation": "aggregate" }, "fingerprint": { "aggregations": [], "operation": "groupby" }, "hostname": { "aggregations": [ "last" ], "operation": "aggregate" }, "project": { "aggregations": [ "last" ], "operation": "aggregate" }, "severity": { "aggregations": [ "last" ], "operation": "aggregate" }, "startsAt": { "aggregations": [ "last" ], "operation": "aggregate" }, "status": { "aggregations": [ "last" ], "operation": "aggregate" } } } }, { "id": "filterByValue", "options": { "filters": [ { "config": { "id": "equal", "options": { "value": "firing" } }, "fieldName": "status (last)" } ], "match": "all", "type": "include" } }, { "id": "filterFieldsByName", "options": { "include": { "names": [ "ID (last)", "startsAt (last)", "duration (last)", "alertname (last)", "hostname (last)", "description (last)" ] } } }, { "id": "organize", "options": { "excludeByName": {}, "indexByName": {}, "renameByName": { "ID (last)": "ID", "alertname (last)": "名称", "description (last)": "描述", "duration (last)": "持续时间", "hostname (last)": "主机名", "startsAt (last)": "开始时间" } } } ], "type": "table" }, { "collapsed": false, "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 29 }, "id": 28, "panels": [], "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "refId": "A" } ], "title": "alert details query", "type": "row" }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "auto", "cellOptions": { "type": "auto" }, "filterable": true, "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [ { "matcher": { "id": "byName", "options": "description" }, "properties": [ { "id": "custom.width", "value": 436 } ] }, { "matcher": { "id": "byName", "options": "severity" }, "properties": [ { "id": "custom.width", "value": 104 } ] }, { "matcher": { "id": "byName", "options": "env" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "startsAt" }, "properties": [ { "id": "custom.width", "value": 156 } ] }, { "matcher": { "id": "byName", "options": "ID" }, "properties": [ { "id": "custom.width", "value": 94 } ] }, { "matcher": { "id": "byName", "options": "状态" }, "properties": [ { "id": "custom.width", "value": 101 } ] }, { "matcher": { "id": "byName", "options": "名称" }, "properties": [ { "id": "custom.width", "value": 209 } ] }, { "matcher": { "id": "byName", "options": "主机名" }, "properties": [ { "id": "custom.width", "value": 173 } ] }, { "matcher": { "id": "byName", "options": "项目" }, "properties": [ { "id": "custom.width", "value": 130 } ] }, { "matcher": { "id": "byName", "options": "环境" }, "properties": [ { "id": "custom.width", "value": 107 } ] }, { "matcher": { "id": "byName", "options": "描述" }, "properties": [ { "id": "custom.width", "value": 497 } ] } ] }, "gridPos": { "h": 22, "w": 24, "x": 0, "y": 30 }, "id": 2, "options": { "cellHeight": "sm", "footer": { "countRows": false, "fields": "", "reducer": [ "sum" ], "show": false }, "frameIndex": 2, "showHeader": true, "sortBy": [ { "desc": false, "displayName": "ID" } ] }, "pluginVersion": "10.0.10", "targets": [ { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n ID,\n status,\n startsAt,\n endsAt\nFROM Alert\nWHERE\n startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\nORDER BY ID", "refId": "A", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"alertname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"alertname\"", "refId": "B", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"env\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"idc\"", "refId": "C", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"severity\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"severity\"", "refId": "D", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"az\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"az\"", "refId": "E", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"hostname\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"namehost\"", "refId": "F", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"project\"\nFROM\n\tAlertLabel\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Label=\"name\"", "refId": "G", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] }, { "datasource": { "type": "mysql", "uid": "d51d42e2-9ecf-465b-a78e-724aa75cefa4" }, "editorMode": "code", "format": "table", "group": [], "hide": false, "metricColumn": "none", "rawQuery": true, "rawSql": "SELECT\n\tAlertID AS \"ID\",\n\tValue AS \"description\"\nFROM\n\tAlertAnnotation\nWHERE\n\tAlertID IN (\n\tSELECT\n\t\tID \n\tFROM\n\t\tAlert \n\tWHERE\n\t startsAt BETWEEN FROM_UNIXTIME(${__from:date:seconds}) AND FROM_UNIXTIME(${__to:date:seconds})\n\t)\n\tAND Annotation=\"short\"", "refId": "H", "select": [ [ { "params": [ "ID" ], "type": "column" } ] ], "sql": { "columns": [ { "parameters": [], "type": "function" } ], "groupBy": [ { "property": { "type": "string" }, "type": "groupBy" } ], "limit": 50 }, "table": "alert", "timeColumn": "startsAt", "timeColumnType": "timestamp", "where": [ { "name": "$__timeFilter", "params": [], "type": "macro" } ] } ], "title": "history alert details", "transformations": [ { "id": "merge", "options": {} }, { "id": "organize", "options": { "excludeByName": { "ID": false, "alertGroupID": true }, "indexByName": { "ID": 0, "alertGroupID": 1, "alertname": 2, "az": 6, "description": 8, "endsAt": 11, "env": 7, "fingerprint": 12, "hostname": 4, "project": 5, "severity": 9, "startsAt": 10, "status": 3 }, "renameByName": { "ID": "", "alertname": "名称", "az": "地区", "description": "描述", "endsAt": "结束时间", "env": "环境", "hostname": "主机名", "project": "项目", "severity": "严重性", "startsAt": "开始时间", "status": "状态" } } } ], "type": "table" } ], "refresh": "", "schemaVersion": 38, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "now-24h", "to": "now" }, "timepicker": {}, "timezone": "browser", "title": "prometheus alert history-record", "uid": "E9sEj4J7k3", "version": 41, "weekStart": "" }
标签:__,grafana,groupBy,prometheus,startsAt,ID,type,id,模板 From: https://www.cnblogs.com/putaoo/p/17921249.html