cleanup and files added
This commit is contained in:
56
qt_app_pyside1/services/influxdb/config.yml
Normal file
56
qt_app_pyside1/services/influxdb/config.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
# InfluxDB Configuration for Smart Intersection
|
||||
# Configuration file for InfluxDB v2.x
|
||||
|
||||
# HTTP API settings
|
||||
http-bind-address = ":8086"
|
||||
http-idle-timeout = "3m"
|
||||
http-read-header-timeout = "10s"
|
||||
http-read-timeout = "0"
|
||||
http-write-timeout = "0"
|
||||
|
||||
# Storage engine configuration
|
||||
bolt-path = "./influxd.bolt"
|
||||
engine-path = "./engine"
|
||||
sqlite-path = "./influxd.sqlite"
|
||||
|
||||
# Storage settings
|
||||
storage-cache-max-memory-size = "1g"
|
||||
storage-cache-snapshot-memory-size = "25m"
|
||||
storage-cache-snapshot-write-cold-duration = "10m"
|
||||
storage-max-concurrent-compactions = 3
|
||||
storage-retention-check-interval = "30m"
|
||||
storage-series-id-set-cache-size = 100
|
||||
|
||||
# Query settings
|
||||
query-concurrency = 1024
|
||||
query-initial-memory-bytes = 0
|
||||
query-max-memory-bytes = 0
|
||||
query-memory-bytes = "unlimited"
|
||||
query-queue-size = 1024
|
||||
|
||||
# Logging
|
||||
log-level = "info"
|
||||
|
||||
# Security
|
||||
tls-cert = ""
|
||||
tls-key = ""
|
||||
|
||||
# Feature flags
|
||||
feature-flags = []
|
||||
|
||||
# Session settings
|
||||
session-length = 60
|
||||
session-renew-disabled = false
|
||||
|
||||
# Continuous Queries (if needed)
|
||||
continuous-queries-enabled = true
|
||||
|
||||
# Retention policies
|
||||
[retention]
|
||||
check-interval = "1h"
|
||||
|
||||
# Default bucket for smart intersection data
|
||||
[smart-intersection]
|
||||
name = "traffic_monitoring"
|
||||
retention-period = "168h" # 7 days
|
||||
shard-group-duration = "24h"
|
||||
149
qt_app_pyside1/services/influxdb/init.flux
Normal file
149
qt_app_pyside1/services/influxdb/init.flux
Normal file
@@ -0,0 +1,149 @@
|
||||
// Smart Intersection InfluxDB Initialization Script
|
||||
// This Flux script sets up the initial database structure
|
||||
|
||||
// Create bucket for traffic monitoring data
|
||||
option task = {name: "smart-intersection-init", every: 1mo}
|
||||
|
||||
// Import required packages
|
||||
import "influxdata/influxdb/schema"
|
||||
|
||||
// Create retention policy for traffic data (7 days)
|
||||
buckets.create(
|
||||
bucket: "traffic_monitoring",
|
||||
orgID: "smart-intersection-org",
|
||||
retentionPeriod: 168h,
|
||||
description: "Smart intersection traffic monitoring data"
|
||||
)
|
||||
|
||||
// Create bucket for long-term analytics (30 days)
|
||||
buckets.create(
|
||||
bucket: "traffic_analytics",
|
||||
orgID: "smart-intersection-org",
|
||||
retentionPeriod: 720h,
|
||||
description: "Long-term traffic analytics and trends"
|
||||
)
|
||||
|
||||
// Create measurements schema
|
||||
|
||||
// Performance metrics measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "performance",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
fps: "float",
|
||||
gpu_usage: "float",
|
||||
memory_usage: "float",
|
||||
processing_time_ms: "float",
|
||||
camera_count: "int",
|
||||
active_objects: "int"
|
||||
},
|
||||
tags: ["service", "camera_id"]
|
||||
)
|
||||
|
||||
// Detection events measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "detection_events",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
object_count: "int",
|
||||
vehicle_count: "int",
|
||||
pedestrian_count: "int",
|
||||
confidence_avg: "float",
|
||||
processing_time: "float"
|
||||
},
|
||||
tags: ["camera_id", "camera_position", "detection_model"]
|
||||
)
|
||||
|
||||
// Violation events measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "violation_events",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
violation_type: "string",
|
||||
severity_level: "string",
|
||||
object_id: "string",
|
||||
confidence: "float"
|
||||
},
|
||||
tags: ["camera_id", "roi_id", "violation_category"]
|
||||
)
|
||||
|
||||
// Traffic flow measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "traffic_flow",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
vehicle_count: "int",
|
||||
average_speed: "float",
|
||||
lane_occupancy: "float",
|
||||
congestion_level: "string"
|
||||
},
|
||||
tags: ["lane_id", "direction", "camera_position"]
|
||||
)
|
||||
|
||||
// ROI events measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "roi_events",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
event_type: "string",
|
||||
dwell_time: "float",
|
||||
object_count: "int",
|
||||
activity_level: "float"
|
||||
},
|
||||
tags: ["roi_id", "roi_type", "camera_id"]
|
||||
)
|
||||
|
||||
// System health measurement
|
||||
schema.create(
|
||||
bucket: "traffic_monitoring",
|
||||
measurement: "system_health",
|
||||
columns: {
|
||||
timestamp: "timestamp",
|
||||
cpu_usage: "float",
|
||||
memory_usage: "float",
|
||||
disk_usage: "float",
|
||||
service_status: "string",
|
||||
uptime_seconds: "int"
|
||||
},
|
||||
tags: ["service_name", "host"]
|
||||
)
|
||||
|
||||
// Create continuous queries for analytics
|
||||
|
||||
// Average FPS over 1 minute intervals
|
||||
option task = {name: "fps_analytics", every: 1m}
|
||||
|
||||
from(bucket: "traffic_monitoring")
|
||||
|> range(start: -1m)
|
||||
|> filter(fn: (r) => r._measurement == "performance")
|
||||
|> filter(fn: (r) => r._field == "fps")
|
||||
|> aggregateWindow(every: 1m, fn: mean, createEmpty: false)
|
||||
|> set(key: "_measurement", value: "fps_avg_1m")
|
||||
|> to(bucket: "traffic_analytics", org: "smart-intersection-org")
|
||||
|
||||
// Vehicle count aggregation over 5 minute intervals
|
||||
option task = {name: "vehicle_count_analytics", every: 5m}
|
||||
|
||||
from(bucket: "traffic_monitoring")
|
||||
|> range(start: -5m)
|
||||
|> filter(fn: (r) => r._measurement == "detection_events")
|
||||
|> filter(fn: (r) => r._field == "vehicle_count")
|
||||
|> aggregateWindow(every: 5m, fn: sum, createEmpty: false)
|
||||
|> set(key: "_measurement", value: "vehicle_count_5m")
|
||||
|> to(bucket: "traffic_analytics", org: "smart-intersection-org")
|
||||
|
||||
// Violation count by type over 1 hour
|
||||
option task = {name: "violation_analytics", every: 1h}
|
||||
|
||||
from(bucket: "traffic_monitoring")
|
||||
|> range(start: -1h)
|
||||
|> filter(fn: (r) => r._measurement == "violation_events")
|
||||
|> group(columns: ["violation_type"])
|
||||
|> count()
|
||||
|> set(key: "_measurement", value: "violation_count_1h")
|
||||
|> to(bucket: "traffic_analytics", org: "smart-intersection-org")
|
||||
Reference in New Issue
Block a user