cleanup and files added
This commit is contained in:
49
qt_app_pyside1/fixed_grafana_queries.py
Normal file
49
qt_app_pyside1/fixed_grafana_queries.py
Normal file
@@ -0,0 +1,49 @@
|
||||
"""
|
||||
Fixed Grafana queries without syntax errors
|
||||
"""
|
||||
|
||||
print("=== CORRECTED Grafana Panel Queries ===")
|
||||
|
||||
print("\n1. Traffic Light Status Panel Query:")
|
||||
print('''from(bucket: "traffic_monitoring")
|
||||
|> range(start: -15m)
|
||||
|> filter(fn: (r) => r["_measurement"] == "traffic_light_status")
|
||||
|> filter(fn: (r) => r["_field"] == "color_numeric")
|
||||
|> last()''')
|
||||
|
||||
print("\n2. Red Light Violations Panel Query:")
|
||||
print('''from(bucket: "traffic_monitoring")
|
||||
|> range(start: -1h)
|
||||
|> filter(fn: (r) => r["_measurement"] == "violation_events")
|
||||
|> filter(fn: (r) => r["_field"] == "count")
|
||||
|> count()''')
|
||||
|
||||
print("\n3. Device Info Status Panel Query:")
|
||||
print('''from(bucket: "traffic_monitoring")
|
||||
|> range(start: -15m)
|
||||
|> filter(fn: (r) => r["_measurement"] == "device_info")
|
||||
|> filter(fn: (r) => r["_field"] == "status")
|
||||
|> last()''')
|
||||
|
||||
print("\n=== Alternative Simple Queries ===")
|
||||
|
||||
print("\n4. Traffic Light - Simple Query:")
|
||||
print('''from(bucket: "traffic_monitoring")
|
||||
|> range(start: -15m)
|
||||
|> filter(fn: (r) => r._measurement == "traffic_light_status")
|
||||
|> filter(fn: (r) => r._field == "color_numeric")
|
||||
|> last()''')
|
||||
|
||||
print("\n5. Violations - Simple Count:")
|
||||
print('''from(bucket: "traffic_monitoring")
|
||||
|> range(start: -1h)
|
||||
|> filter(fn: (r) => r._measurement == "violation_events")
|
||||
|> filter(fn: (r) => r._field == "count")
|
||||
|> sum()''')
|
||||
|
||||
print("\n=== Instructions ===")
|
||||
print("1. Go to Grafana dashboard")
|
||||
print("2. Edit each panel showing 'No data'")
|
||||
print("3. Use the CORRECTED queries above (without $ variables)")
|
||||
print("4. Click 'Apply' to save each panel")
|
||||
print("5. The panels should now show data!")
|
||||
Reference in New Issue
Block a user