mirror of
https://github.com/20kaushik02/real-time-traffic-analysis-clickhouse.git
synced 2025-12-06 09:44:06 +00:00
back to ui, WiP
This commit is contained in:
parent
84e501cf4b
commit
8b04cbdadb
@ -12,8 +12,11 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- clickhouse-keeper1
|
- clickhouse-keeper1
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
replicas: 1
|
||||||
constraints: [node.labels.main == true]
|
# placement:
|
||||||
|
# constraints: [node.labels.main == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
clickhouse-keeper2:
|
clickhouse-keeper2:
|
||||||
image: clickhouse/clickhouse-server:latest
|
image: clickhouse/clickhouse-server:latest
|
||||||
@ -27,8 +30,11 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- clickhouse-keeper2
|
- clickhouse-keeper2
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
replicas: 1
|
||||||
constraints: [node.labels.main == true]
|
# placement:
|
||||||
|
# constraints: [node.labels.main == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
clickhouse-keeper3:
|
clickhouse-keeper3:
|
||||||
image: clickhouse/clickhouse-server:latest
|
image: clickhouse/clickhouse-server:latest
|
||||||
@ -42,8 +48,11 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- clickhouse-keeper3
|
- clickhouse-keeper3
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
replicas: 1
|
||||||
constraints: [node.labels.main == true]
|
# placement:
|
||||||
|
# constraints: [node.labels.main == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
|
|
||||||
clickhouse-server1:
|
clickhouse-server1:
|
||||||
image: clickhouse/clickhouse-server:latest
|
image: clickhouse/clickhouse-server:latest
|
||||||
@ -65,8 +74,10 @@ services:
|
|||||||
- clickhouse-server1
|
- clickhouse-server1
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
placement:
|
# placement:
|
||||||
constraints: [node.labels.main == true]
|
# constraints: [node.labels.main == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
update_config:
|
update_config:
|
||||||
delay: 10s
|
delay: 10s
|
||||||
resources:
|
resources:
|
||||||
@ -99,8 +110,10 @@ services:
|
|||||||
- clickhouse-server2
|
- clickhouse-server2
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
placement:
|
# placement:
|
||||||
constraints: [node.labels.main == true]
|
# constraints: [node.labels.main == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
update_config:
|
update_config:
|
||||||
delay: 10s
|
delay: 10s
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@ -7,8 +7,8 @@ services:
|
|||||||
- zookeeper
|
- zookeeper
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
placement:
|
# placement:
|
||||||
constraints: [node.labels.worker == true]
|
# constraints: [node.labels.worker == true]
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
environment:
|
environment:
|
||||||
@ -42,8 +42,8 @@ services:
|
|||||||
- kafka_data:/var/lib/kafka/data
|
- kafka_data:/var/lib/kafka/data
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
placement:
|
# placement:
|
||||||
constraints: [node.labels.worker == true]
|
# constraints: [node.labels.worker == true]
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
|
|
||||||
@ -60,8 +60,8 @@ services:
|
|||||||
command: "sh -c 'sleep 30 && python /app/pcap_processor.py -c /data/csv/main.csv -x --stream_size 100000'"
|
command: "sh -c 'sleep 30 && python /app/pcap_processor.py -c /data/csv/main.csv -x --stream_size 100000'"
|
||||||
deploy:
|
deploy:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
placement:
|
# placement:
|
||||||
constraints: [node.labels.worker == true]
|
# constraints: [node.labels.worker == true]
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
|
|
||||||
|
|||||||
@ -34,8 +34,8 @@ elif ($masterNode); then
|
|||||||
# data streaming
|
# data streaming
|
||||||
cd $scriptDir/../preprocessing
|
cd $scriptDir/../preprocessing
|
||||||
$dockerCmd service create --name registry -p 5000:5000 registry:2
|
$dockerCmd service create --name registry -p 5000:5000 registry:2
|
||||||
$dockerCmd build -t 127.0.0.1:5000/data-streamer:latest --no-cache --push -f Dockerfile.python .
|
# $dockerCmd build -t 127.0.0.1:5000/data-streamer:latest --no-cache --push -f Dockerfile.python .
|
||||||
# $dockerCmd build -t 127.0.0.1:5000/data-streamer:latest --push -f Dockerfile.python .
|
$dockerCmd build -t 127.0.0.1:5000/data-streamer:latest --push -f Dockerfile.python .
|
||||||
|
|
||||||
# execute
|
# execute
|
||||||
cd $scriptDir
|
cd $scriptDir
|
||||||
|
|||||||
@ -154,14 +154,17 @@
|
|||||||
"legend": {
|
"legend": {
|
||||||
"displayMode": "list",
|
"displayMode": "list",
|
||||||
"placement": "bottom",
|
"placement": "bottom",
|
||||||
"showLegend": true
|
"showLegend": true,
|
||||||
|
"values": [
|
||||||
|
"percent"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"pieType": "pie",
|
"pieType": "pie",
|
||||||
"reduceOptions": {
|
"reduceOptions": {
|
||||||
"calcs": [
|
"calcs": [
|
||||||
"lastNotNull"
|
"lastNotNull"
|
||||||
],
|
],
|
||||||
"fields": "/^ProtocolCount$/",
|
"fields": "/^Protocol frequency$/",
|
||||||
"values": true
|
"values": true
|
||||||
},
|
},
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
@ -190,11 +193,11 @@
|
|||||||
},
|
},
|
||||||
"pluginVersion": "4.5.1",
|
"pluginVersion": "4.5.1",
|
||||||
"queryType": "table",
|
"queryType": "table",
|
||||||
"rawSql": "SELECT\r\n l4_protocol as Protocol,\r\n COUNT(Protocol) as ProtocolCount\r\n FROM traffic_records_all\r\n GROUP BY Protocol",
|
"rawSql": "SELECT\r\n l4_protocol as Protocol,\r\n COUNT(Protocol) as \"Protocol frequency\"\r\n FROM traffic_records_all\r\n GROUP BY Protocol",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"title": "Distribution of L4 protocol",
|
"title": "Distribution of L4 protocol (frequency)",
|
||||||
"type": "piechart"
|
"type": "piechart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -287,11 +290,11 @@
|
|||||||
},
|
},
|
||||||
"pluginVersion": "4.5.1",
|
"pluginVersion": "4.5.1",
|
||||||
"queryType": "table",
|
"queryType": "table",
|
||||||
"rawSql": "SELECT \r\n Port, \r\n SourcePortCount, \r\n DestPortCount\r\nFROM\r\n(\r\n SELECT \r\n src_port AS Port, \r\n COUNT(*) AS SourcePortCount\r\n FROM traffic_records_all\r\n GROUP BY src_port\r\n ORDER BY SourcePortCount DESC\r\n LIMIT 40\r\n) AS src\r\nINNER JOIN\r\n(\r\n SELECT \r\n dst_port AS Port, \r\n COUNT(*) AS DestPortCount\r\n FROM traffic_records_all\r\n GROUP BY dst_port\r\n ORDER BY DestPortCount DESC\r\n LIMIT 40\r\n) AS dst\r\nUSING (Port)\r\nORDER BY (SourcePortCount + DestPortCount) DESC\r\nLIMIT 40;\r\n",
|
"rawSql": "SELECT \r\n Port, \r\n SourcePortCount AS \"Source port frequency\",\r\n DestPortCount AS \"Destination port frequency\"\r\nFROM\r\n(\r\n SELECT \r\n src_port AS Port, \r\n COUNT(*) AS SourcePortCount\r\n FROM traffic_records_all\r\n GROUP BY src_port\r\n ORDER BY SourcePortCount DESC\r\n LIMIT 40\r\n) AS src\r\nINNER JOIN\r\n(\r\n SELECT \r\n dst_port AS Port, \r\n COUNT(*) AS DestPortCount\r\n FROM traffic_records_all\r\n GROUP BY dst_port\r\n ORDER BY DestPortCount DESC\r\n LIMIT 40\r\n) AS dst\r\nUSING (Port)\r\nORDER BY (SourcePortCount + DestPortCount) DESC\r\nLIMIT 40;\r\n",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"title": "Top ports (by count)",
|
"title": "Top ports (frequency)",
|
||||||
"type": "barchart"
|
"type": "barchart"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -305,67 +308,48 @@
|
|||||||
"mode": "palette-classic"
|
"mode": "palette-classic"
|
||||||
},
|
},
|
||||||
"custom": {
|
"custom": {
|
||||||
"axisBorderShow": false,
|
|
||||||
"axisCenteredZero": false,
|
|
||||||
"axisColorMode": "text",
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"fillOpacity": 80,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
"hideFrom": {
|
||||||
"legend": false,
|
"legend": false,
|
||||||
"tooltip": false,
|
"tooltip": false,
|
||||||
"viz": false
|
"viz": false
|
||||||
},
|
|
||||||
"lineWidth": 1,
|
|
||||||
"scaleDistribution": {
|
|
||||||
"type": "linear"
|
|
||||||
},
|
|
||||||
"thresholdsStyle": {
|
|
||||||
"mode": "off"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mappings": [],
|
"mappings": []
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"overrides": []
|
"overrides": []
|
||||||
},
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 8,
|
"h": 8,
|
||||||
"w": 12,
|
"w": 6,
|
||||||
"x": 0,
|
"x": 18,
|
||||||
"y": 16
|
"y": 8
|
||||||
},
|
},
|
||||||
"id": 2,
|
"id": 6,
|
||||||
"options": {
|
"options": {
|
||||||
"barRadius": 0,
|
"displayLabels": [
|
||||||
"barWidth": 0.97,
|
"percent",
|
||||||
"fullHighlight": false,
|
"name"
|
||||||
"groupWidth": 0.7,
|
],
|
||||||
"legend": {
|
"legend": {
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "list",
|
"displayMode": "list",
|
||||||
"placement": "bottom",
|
"placement": "bottom",
|
||||||
"showLegend": true
|
"showLegend": true,
|
||||||
|
"values": [
|
||||||
|
"percent"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pieType": "pie",
|
||||||
|
"reduceOptions": {
|
||||||
|
"calcs": [
|
||||||
|
"lastNotNull"
|
||||||
|
],
|
||||||
|
"fields": "/^Protocol bandwidth$/",
|
||||||
|
"values": true
|
||||||
},
|
},
|
||||||
"orientation": "horizontal",
|
|
||||||
"showValue": "auto",
|
|
||||||
"stacking": "none",
|
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"mode": "single",
|
"mode": "single",
|
||||||
"sort": "none"
|
"sort": "none"
|
||||||
},
|
}
|
||||||
"xField": "SourcePort",
|
|
||||||
"xTickLabelRotation": 0,
|
|
||||||
"xTickLabelSpacing": 100
|
|
||||||
},
|
},
|
||||||
"pluginVersion": "11.3.1",
|
"pluginVersion": "11.3.1",
|
||||||
"targets": [
|
"targets": [
|
||||||
@ -384,109 +368,12 @@
|
|||||||
},
|
},
|
||||||
"pluginVersion": "4.5.1",
|
"pluginVersion": "4.5.1",
|
||||||
"queryType": "table",
|
"queryType": "table",
|
||||||
"rawSql": "SELECT\r\n src_port as SourcePort,\r\n COUNT(SourcePort) as SourcePortCount\r\n FROM traffic_records_all\r\n GROUP BY SourcePort\r\n ORDER BY SourcePortCount DESC\r\n LIMIT 10",
|
"rawSql": "SELECT\n l4_protocol as Protocol,\n SUM(pkt_len)/1024.0/1024.0 as \"Protocol bandwidth\"\n FROM traffic_records_all\n GROUP BY Protocol",
|
||||||
"refId": "A"
|
"refId": "A"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"title": "Top 10 source ports (by count)",
|
"title": "Distribution of L4 protocol (bandwidth)",
|
||||||
"type": "barchart"
|
"type": "piechart"
|
||||||
},
|
|
||||||
{
|
|
||||||
"datasource": {
|
|
||||||
"type": "grafana-clickhouse-datasource",
|
|
||||||
"uid": "PDEE91DDB90597936"
|
|
||||||
},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"color": {
|
|
||||||
"mode": "palette-classic"
|
|
||||||
},
|
|
||||||
"custom": {
|
|
||||||
"axisBorderShow": false,
|
|
||||||
"axisCenteredZero": false,
|
|
||||||
"axisColorMode": "text",
|
|
||||||
"axisLabel": "",
|
|
||||||
"axisPlacement": "auto",
|
|
||||||
"fillOpacity": 80,
|
|
||||||
"gradientMode": "none",
|
|
||||||
"hideFrom": {
|
|
||||||
"legend": false,
|
|
||||||
"tooltip": false,
|
|
||||||
"viz": false
|
|
||||||
},
|
|
||||||
"lineWidth": 1,
|
|
||||||
"scaleDistribution": {
|
|
||||||
"type": "linear"
|
|
||||||
},
|
|
||||||
"thresholdsStyle": {
|
|
||||||
"mode": "off"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mappings": [],
|
|
||||||
"thresholds": {
|
|
||||||
"mode": "absolute",
|
|
||||||
"steps": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"overrides": []
|
|
||||||
},
|
|
||||||
"gridPos": {
|
|
||||||
"h": 8,
|
|
||||||
"w": 12,
|
|
||||||
"x": 12,
|
|
||||||
"y": 16
|
|
||||||
},
|
|
||||||
"id": 3,
|
|
||||||
"options": {
|
|
||||||
"barRadius": 0,
|
|
||||||
"barWidth": 0.97,
|
|
||||||
"fullHighlight": false,
|
|
||||||
"groupWidth": 0.7,
|
|
||||||
"legend": {
|
|
||||||
"calcs": [],
|
|
||||||
"displayMode": "list",
|
|
||||||
"placement": "bottom",
|
|
||||||
"showLegend": true
|
|
||||||
},
|
|
||||||
"orientation": "horizontal",
|
|
||||||
"showValue": "auto",
|
|
||||||
"stacking": "none",
|
|
||||||
"tooltip": {
|
|
||||||
"mode": "single",
|
|
||||||
"sort": "none"
|
|
||||||
},
|
|
||||||
"xField": "DestPort",
|
|
||||||
"xTickLabelRotation": 0,
|
|
||||||
"xTickLabelSpacing": 100
|
|
||||||
},
|
|
||||||
"pluginVersion": "11.3.1",
|
|
||||||
"targets": [
|
|
||||||
{
|
|
||||||
"editorType": "sql",
|
|
||||||
"format": 1,
|
|
||||||
"meta": {
|
|
||||||
"builderOptions": {
|
|
||||||
"columns": [],
|
|
||||||
"database": "",
|
|
||||||
"limit": 1000,
|
|
||||||
"mode": "list",
|
|
||||||
"queryType": "table",
|
|
||||||
"table": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pluginVersion": "4.5.1",
|
|
||||||
"queryType": "table",
|
|
||||||
"rawSql": "SELECT\r\n dst_port as DestPort,\r\n COUNT(DestPort) as DestPortCount\r\n FROM traffic_records_all\r\n GROUP BY DestPort\r\n ORDER BY DestPortCount DESC\r\n LIMIT 10",
|
|
||||||
"refId": "A"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"title": "Top 10 destination ports (by count)",
|
|
||||||
"type": "barchart"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"preload": false,
|
"preload": false,
|
||||||
@ -503,6 +390,6 @@
|
|||||||
"timezone": "browser",
|
"timezone": "browser",
|
||||||
"title": "Internet traffic capture analysis",
|
"title": "Internet traffic capture analysis",
|
||||||
"uid": "be59fkbp3zs3kc",
|
"uid": "be59fkbp3zs3kc",
|
||||||
"version": 11,
|
"version": 1,
|
||||||
"weekStart": ""
|
"weekStart": ""
|
||||||
}
|
}
|
||||||
@ -15,8 +15,11 @@ services:
|
|||||||
aliases:
|
aliases:
|
||||||
- grafana
|
- grafana
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
replicas: 1
|
||||||
constraints: [node.labels.worker == true]
|
# placement:
|
||||||
|
# constraints: [node.labels.worker == true]
|
||||||
|
restart_policy:
|
||||||
|
condition: on-failure
|
||||||
depends_on:
|
depends_on:
|
||||||
- clickhouse-server1
|
- clickhouse-server1
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user