Skip to content

Commit

Permalink
dashboard: malware, add 'all' option
Browse files Browse the repository at this point in the history
  • Loading branch information
gsanchietti committed Sep 6, 2024
1 parent 605252d commit 1ff9ba2
Showing 1 changed file with 51 additions and 99 deletions.
150 changes: 51 additions & 99 deletions imageroot/etc/dashboards/malware.json
Original file line number Diff line number Diff line change
@@ -1,59 +1,4 @@
{
"__inputs": [
{
"name": "DS_GRAFANA-POSTGRESQL-DATASOURCE",
"label": "grafana-postgresql-datasource",
"description": "",
"type": "datasource",
"pluginId": "grafana-postgresql-datasource",
"pluginName": "PostgreSQL"
}
],
"__elements": {},
"__requires": [
{
"type": "panel",
"id": "barchart",
"name": "Bar chart",
"version": ""
},
{
"type": "panel",
"id": "geomap",
"name": "Geomap",
"version": ""
},
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "10.3.3"
},
{
"type": "datasource",
"id": "grafana-postgresql-datasource",
"name": "PostgreSQL",
"version": "1.0.0"
},
{
"type": "panel",
"id": "piechart",
"name": "Pie chart",
"version": ""
},
{
"type": "panel",
"id": "stat",
"name": "Stat",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
Expand All @@ -73,14 +18,15 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"id": 4,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand All @@ -100,8 +46,7 @@
"value": 80
}
]
},
"unitScale": true
}
},
"overrides": []
},
Expand All @@ -117,6 +62,7 @@
"graphMode": "area",
"justifyMode": "auto",
"orientation": "auto",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"lastNotNull"
Expand All @@ -128,17 +74,17 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "10.3.3",
"pluginVersion": "11.2.0",
"targets": [
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT count(*) as total FROM ts_malware WHERE $__timeFilter(time) and unit_id='$unit_id'\n",
"rawSql": "SELECT count(*) as total FROM ts_malware WHERE $__timeFilter(time) and unit_id in ($unit_id)\n",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -164,8 +110,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -206,8 +153,7 @@
"value": 80
}
]
},
"unitScale": true
}
},
"overrides": []
},
Expand Down Expand Up @@ -244,12 +190,12 @@
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT src, COUNT(*) AS block_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP BY src\nORDER BY block_count DESC\nLIMIT 10",
"rawSql": "SELECT src, COUNT(*) AS block_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP BY src\nORDER BY block_count DESC\nLIMIT 10",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -275,8 +221,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand All @@ -290,8 +237,7 @@
"viz": false
}
},
"mappings": [],
"unitScale": true
"mappings": []
},
"overrides": []
},
Expand Down Expand Up @@ -325,12 +271,12 @@
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT chain AS direction, COUNT(*) AS entry_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP BY chain\n",
"rawSql": "SELECT chain AS direction, COUNT(*) AS entry_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP BY chain\n",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -356,8 +302,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand All @@ -371,8 +318,7 @@
"viz": false
}
},
"mappings": [],
"unitScale": true
"mappings": []
},
"overrides": []
},
Expand Down Expand Up @@ -406,12 +352,12 @@
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT category, COUNT(*) AS entry_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP BY category\n",
"rawSql": "SELECT category, COUNT(*) AS entry_count\nFROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP BY category\n",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -437,8 +383,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -466,8 +413,7 @@
"value": 80
}
]
},
"unitScale": true
}
},
"overrides": []
},
Expand Down Expand Up @@ -550,17 +496,17 @@
"zoom": 15
}
},
"pluginVersion": "10.3.3",
"pluginVersion": "11.2.0",
"targets": [
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT count(*) as count, country as lookup FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP BY country",
"rawSql": "SELECT count(*) as count, country as lookup FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP BY country",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -586,8 +532,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand All @@ -601,6 +548,7 @@
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
Expand Down Expand Up @@ -639,8 +587,7 @@
"value": 80
}
]
},
"unitScale": true
}
},
"overrides": []
},
Expand All @@ -667,12 +614,12 @@
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT time_bucket('10m', time) as interval_10_miunutes, count(*) FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP by interval_10_miunutes",
"rawSql": "SELECT time_bucket('10m', time) as interval_10_miunutes, count(*) FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP by interval_10_miunutes",
"refId": "A",
"sql": {
"columns": [
Expand All @@ -698,8 +645,9 @@
},
{
"datasource": {
"default": false,
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"fieldConfig": {
"defaults": {
Expand Down Expand Up @@ -741,8 +689,7 @@
}
]
},
"unit": "short",
"unitScale": true
"unit": "short"
},
"overrides": []
},
Expand Down Expand Up @@ -779,12 +726,12 @@
{
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"editorMode": "code",
"format": "table",
"rawQuery": true,
"rawSql": "SELECT country, count(*) as count FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id='$unit_id'\nGROUP by country\nORDER by count desc\nLIMIT 10",
"rawSql": "SELECT country, count(*) as count FROM ts_malware\nWHERE $__timeFilter(time) AND unit_id IN ($unit_id)\nGROUP by country\nORDER by count desc\nLIMIT 10",
"refId": "A",
"sql": {
"columns": [
Expand Down Expand Up @@ -815,15 +762,20 @@
"templating": {
"list": [
{
"current": {},
"allValue": "select distinct(unit_id) from units",
"current": {
"selected": true,
"text": "All",
"value": "$__all"
},
"datasource": {
"type": "grafana-postgresql-datasource",
"uid": "${DS_GRAFANA-POSTGRESQL-DATASOURCE}"
"uid": "f90e9ed5-a116-4337-bb98-5a3099bc25ee"
},
"definition": "select id as __value, uuid as __text from units",
"description": "",
"hide": 0,
"includeAll": false,
"includeAll": true,
"label": "UnitId",
"multi": false,
"name": "unit_id",
Expand All @@ -838,13 +790,13 @@
]
},
"time": {
"from": "now-6h",
"from": "now-1h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"timezone": "utc",
"title": "Malware",
"uid": "dd395331-5dc0-4172-b243-8646c0ca3ccd",
"version": 16,
"version": 20,
"weekStart": ""
}

0 comments on commit 1ff9ba2

Please sign in to comment.