diff --git a/dasboards/alertas_e_incidentes-alertas_em_aberto.json b/dasboards/alertas_e_incidentes-alertas_em_aberto.json new file mode 100644 index 0000000..8125ac2 --- /dev/null +++ b/dasboards/alertas_e_incidentes-alertas_em_aberto.json @@ -0,0 +1,1177 @@ +{ + "__inputs": [ + { + "name": "DS_IPV0.MYSQL", + "label": "ipv0.mysql", + "description": "", + "type": "datasource", + "pluginId": "mysql", + "pluginName": "MySQL" + } + ], + "__elements": {}, + "__requires": [ + { + "type": "grafana", + "id": "grafana", + "name": "Grafana", + "version": "11.5.2" + }, + { + "type": "datasource", + "id": "mysql", + "name": "MySQL", + "version": "11.5.1" + }, + { + "type": "panel", + "id": "stat", + "name": "Stat", + "version": "" + }, + { + "type": "panel", + "id": "table", + "name": "Table", + "version": "" + } + ], + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "showIn": 0, + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": null, + "links": [], + "panels": [ + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "displayName": "", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "red", + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 0 + }, + "id": 8, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_triggers_ativas\nFROM triggers\nWHERE status = 0 -- Trigger habilitada\n AND value = 1; -- Trigger em estado de problema (ativa)\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Total", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "displayName": "", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "red", + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 3, + "y": 0 + }, + "id": 20, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT \n 'Críticas' AS severidade,\n COUNT(*) AS total_criticas\nFROM triggers\nWHERE status = 0 \n AND value = 1 \n AND priority IN (4, 5);\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Total Critical", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "orange", + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "orange", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 6, + "y": 0 + }, + "id": 16, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_average\nFROM triggers\nWHERE status = 0 AND value = 1 AND priority = 3;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Total Average", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "displayName": "", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "dark-yellow", + "index": 0, + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "dark-yellow", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 9, + "y": 0 + }, + "id": 21, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_warning\nFROM triggers\nWHERE status = 0 AND value = 1 AND priority = 2;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Total Warning", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "displayName": "", + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "light-blue", + "index": 0, + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-blue", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 12, + "y": 0 + }, + "id": 18, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_information\nFROM triggers\nWHERE status = 0 AND value = 1 AND priority = 1;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Total Information", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "blue", + "index": 0, + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "light-blue", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 15, + "y": 0 + }, + "id": 17, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_hosts_ativos\nFROM hosts\nWHERE status = 0 AND flags = 0;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Hosts Ativos", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "red", + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 18, + "y": 0 + }, + "id": 15, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(DISTINCT h.hostid) AS total_hosts_indisponiveis\nFROM hosts h\nJOIN items i ON i.hostid = h.hostid\nJOIN history_uint hs ON hs.itemid = i.itemid\nJOIN functions f ON f.itemid = i.itemid\nJOIN triggers t ON t.triggerid = f.triggerid\nWHERE h.status = 0 -- host ativo\n AND i.key_ = 'icmpping'\n AND hs.value = 0\n AND t.status = 0 -- trigger habilitada\n AND t.value = 1 -- trigger em estado de problema\n AND hs.clock = (\n SELECT MAX(hs2.clock)\n FROM history_uint hs2\n WHERE hs2.itemid = i.itemid\n );\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Hosts Down", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "match": "null", + "result": { + "color": "orange", + "text": "0" + } + }, + "type": "special" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "orange", + "value": null + } + ] + }, + "unit": "none" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 3, + "x": 21, + "y": 0 + }, + "id": 19, + "options": { + "colorMode": "background", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": true + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT COUNT(*) AS total_hosts_desativados\nFROM hosts\nWHERE status = 1\n AND flags IN (0, 4);\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Hosts Inativos", + "type": "stat" + }, + { + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "description": "", + "fieldConfig": { + "defaults": { + "custom": { + "align": "right", + "cellOptions": { + "type": "auto", + "wrapText": false + }, + "filterable": false, + "inspect": false + }, + "decimals": 2, + "displayName": "", + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "data_alerta" + }, + "properties": [ + { + "id": "displayName", + "value": "DATA" + }, + { + "id": "unit", + "value": "time: DD-MMM-YYYY HH:mm:ss" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "trigger_name" + }, + "properties": [ + { + "id": "displayName", + "value": "ALERTA" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "decimals", + "value": 2 + }, + { + "id": "custom.align" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "severidade" + }, + "properties": [ + { + "id": "displayName", + "value": "SEVERIDADE" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-background" + } + }, + { + "id": "custom.align", + "value": "center" + }, + { + "id": "mappings", + "value": [ + { + "options": { + "Average": { + "color": "light-red", + "index": 3 + }, + "Disaster": { + "color": "red", + "index": 5 + }, + "High": { + "color": "red", + "index": 4 + }, + "Information": { + "color": "blue", + "index": 1 + }, + "Not classified": { + "index": 0 + }, + "Warning": { + "color": "orange", + "index": 2 + } + }, + "type": "value" + } + ] + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "host" + }, + "properties": [ + { + "id": "displayName", + "value": "HOST" + }, + { + "id": "unit", + "value": "short" + }, + { + "id": "custom.align", + "value": "left" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "trigger_name" + }, + "properties": [ + { + "id": "custom.width", + "value": 769 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "severidade" + }, + "properties": [ + { + "id": "custom.width", + "value": 171 + } + ] + } + ] + }, + "gridPos": { + "h": 98, + "w": 24, + "x": 0, + "y": 4 + }, + "id": 14, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "enablePagination": true, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "11.5.2", + "targets": [ + { + "dataset": "zabbix", + "datasource": { + "type": "mysql", + "uid": "${datasource}" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT DISTINCT\n h.name AS host,\n t.description AS trigger_name,\n CASE t.priority\n WHEN 0 THEN 'Not classified'\n WHEN 1 THEN 'Information'\n WHEN 2 THEN 'Warning'\n WHEN 3 THEN 'Average'\n WHEN 4 THEN 'High'\n WHEN 5 THEN 'Disaster'\n ELSE 'Unknown'\n END AS severidade,\n FROM_UNIXTIME(t.lastchange) AS data_alerta\nFROM triggers t\nJOIN functions f ON t.triggerid = f.triggerid\nJOIN items i ON f.itemid = i.itemid\nJOIN hosts h ON i.hostid = h.hostid\nWHERE t.status = 0\n AND t.value = 1\n AND h.status = 0\n AND t.priority IN ($severity)\n AND (\n '$host' = 'ALL'\n OR h.name LIKE '%$host%'\n )\nORDER BY t.lastchange DESC;\n", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Alertas abertos", + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": {}, + "indexByName": { + "Time": 0, + "alertname": 1, + "availability_zone": 3, + "container_name": 18, + "data": 17, + "device": 5, + "env": 4, + "fstype": 6, + "host": 2, + "image_name": 19, + "instance": 7, + "instance_type": 8, + "ipaddress": 9, + "job": 10, + "mountpoint": 11, + "name": 23, + "platform_version": 12, + "prometheus": 13, + "region": 14, + "service_name": 20, + "severity": 15, + "slack_channel": 21, + "state": 24, + "tag_name": 22, + "team": 16, + "type": 25 + }, + "renameByName": {} + } + } + ], + "type": "table" + } + ], + "refresh": "30s", + "schemaVersion": 40, + "tags": [ + "dev", + "alert" + ], + "templating": { + "list": [ + { + "allowCustomValue": false, + "current": {}, + "label": "Data Source:", + "name": "datasource", + "options": [], + "query": "mysql", + "refresh": 1, + "regex": "", + "type": "datasource" + }, + { + "allValue": "0,1,2,3,4,5", + "allowCustomValue": false, + "current": { + "text": [ + "$__all" + ], + "value": [ + "$__all" + ] + }, + "includeAll": true, + "label": "Severidade: ", + "multi": true, + "name": "severity", + "options": [ + { + "selected": false, + "text": "Not classified", + "value": "0" + }, + { + "selected": false, + "text": "Information", + "value": "1" + }, + { + "selected": false, + "text": "Warning", + "value": "2" + }, + { + "selected": false, + "text": "Average", + "value": "3" + }, + { + "selected": false, + "text": "High", + "value": "4" + }, + { + "selected": false, + "text": "Disaster", + "value": "5" + } + ], + "query": "Not classified : 0, Information : 1, Warning : 2, Average : 3, High : 4, Disaster : 5 ", + "type": "custom" + }, + { + "allValue": "ALL", + "current": {}, + "datasource": { + "type": "mysql", + "uid": "${DS_IPV0.MYSQL}" + }, + "definition": "SELECT DISTINCT name \nFROM hosts \nWHERE status = 0 \n AND flags = 0\nORDER BY name;\n", + "includeAll": true, + "label": "Host:", + "name": "host", + "options": [], + "query": "SELECT DISTINCT name \nFROM hosts \nWHERE status = 0 \n AND flags = 0\nORDER BY name;\n", + "refresh": 1, + "regex": "", + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "browser", + "title": "Alertas e Incidentes em Aberto", + "uid": "WojOgXTmk", + "version": 13, + "weekStart": "" +} \ No newline at end of file