#!/bin/bash
echo "🎯 Grafana Status Check"
echo "======================="

# Проверим API
echo "📊 API Health:"
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/api/health)
if [ "$response" = "200" ]; then
    echo "✅ API is healthy (HTTP $response)"
else
    echo "❌ API returned: HTTP $response"
fi

# Проверим дашборды
echo -e "\n📈 Dashboards:"
dashboards=$(curl -s -u admin:admin123 http://localhost:3000/api/search 2>/dev/null | jq length 2>/dev/null)
if [ -n "$dashboards" ] && [ "$dashboards" -gt 0 ]; then
    echo "✅ Found $dashboards dashboards"
    curl -s -u admin:admin123 http://localhost:3000/api/search | jq -r '.[] | "  - \(.title)"'
else
    echo "❌ No dashboards found"
fi

echo -e "\n🔗 Access URLs:"
echo "  Grafana:      http://localhost:3000"
echo "  Prometheus:   http://localhost:9090"
echo "  Node Metrics: http://localhost:9100/metrics"
echo "  Container Metrics: http://localhost:8081/metrics"
