{
  "dashboard": {
    "id": null,
    "title": "🔐 Vaultwarden Password Manager - Enhanced",
    "tags": ["vaultwarden", "password-manager", "security", "user-friendly"],
    "style": "dark",
    "timezone": "browser",
    "panels": [
      {
        "id": 1,
        "title": "🟢 Vaultwarden Service Status",
        "type": "stat",
        "targets": [
          {
            "expr": "up{job=\"vaultwarden-monitoring\"}",
            "legendFormat": "{{instance}}"
          },
          {
            "expr": "up{job=\"http-service-health\", instance=~\".*vaultwarden.*\"}",
            "legendFormat": "{{instance}}"
          }
        ],
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "thresholds"
            },
            "thresholds": {
              "steps": [
                {"color": "red", "value": 0},
                {"color": "green", "value": 1}
              ]
            },
            "mappings": [
              {
                "options": {
                  "0": {"text": "🔴 OFFLINE", "color": "red"},
                  "1": {"text": "🟢 ONLINE", "color": "green"}
                },
                "type": "value"
              }
            ],
            "unit": "short",
            "displayName": "Status"
          }
        },
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 0},
        "options": {
          "colorMode": "value",
          "graphMode": "none",
          "justifyMode": "auto",
          "orientation": "auto",
          "reduceOptions": {
            "calcs": ["lastNotNull"],
            "fields": "",
            "values": false
          },
          "textMode": "auto"
        }
      },
      {
        "id": 2,
        "title": "⚡ Response Time Performance",
        "type": "graph",
        "targets": [
          {
            "expr": "probe_duration_seconds{job=\"vaultwarden-monitoring\"}",
            "legendFormat": "{{instance}}"
          }
        ],
        "yAxes": [
          {
            "label": "Response Time (seconds)",
            "min": 0
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 0},
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "thresholds"
            },
            "thresholds": {
              "steps": [
                {"color": "green", "value": 0},
                {"color": "yellow", "value": 1},
                {"color": "red", "value": 5}
              ]
            }
          }
        }
      },
      {
        "id": 3,
        "title": "🌐 HTTP Status Codes",
        "type": "graph",
        "targets": [
          {
            "expr": "probe_http_status_code{job=\"vaultwarden-monitoring\"}",
            "legendFormat": "{{instance}} - Status {{code}}"
          }
        ],
        "yAxes": [
          {
            "label": "HTTP Status Code",
            "min": 0,
            "max": 600
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 8}
      },
      {
        "id": 4,
        "title": "🔒 SSL Certificate Health",
        "type": "stat",
        "targets": [
          {
            "expr": "probe_ssl_earliest_cert_expiry{job=\"vaultwarden-monitoring\"} - time()",
            "legendFormat": "{{instance}}"
          }
        ],
        "fieldConfig": {
          "defaults": {
            "unit": "s",
            "color": {
              "mode": "thresholds"
            },
            "thresholds": {
              "steps": [
                {"color": "red", "value": 0},
                {"color": "orange", "value": 86400},
                {"color": "green", "value": 604800}
              ]
            },
            "mappings": [
              {
                "options": {
                  "0": {"text": "🔴 EXPIRED", "color": "red"},
                  "86400": {"text": "🟡 EXPIRES SOON", "color": "orange"},
                  "604800": {"text": "🟢 VALID", "color": "green"}
                },
                "type": "range"
              }
            ]
          }
        },
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 8}
      },
      {
        "id": 5,
        "title": "💻 Container Resource Usage",
        "type": "graph",
        "targets": [
          {
            "expr": "rate(container_cpu_usage_seconds_total{name=~\".*vaultwarden.*\"}[5m]) * 100",
            "legendFormat": "🔐 Vaultwarden CPU Usage"
          },
          {
            "expr": "container_memory_usage_bytes{name=~\".*vaultwarden.*\"} / 1024 / 1024",
            "legendFormat": "🔐 Vaultwarden Memory (MB)"
          }
        ],
        "yAxes": [
          {
            "label": "CPU % / Memory MB"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 0, "y": 16}
      },
      {
        "id": 6,
        "title": "🌐 Network Traffic",
        "type": "graph",
        "targets": [
          {
            "expr": "rate(container_network_receive_bytes_total{name=~\".*vaultwarden.*\"}[5m]) / 1024 / 1024",
            "legendFormat": "📥 Vaultwarden Receive"
          },
          {
            "expr": "rate(container_network_transmit_bytes_total{name=~\".*vaultwarden.*\"}[5m]) / 1024 / 1024",
            "legendFormat": "📤 Vaultwarden Transmit"
          }
        ],
        "yAxes": [
          {
            "label": "MB/s"
          }
        ],
        "gridPos": {"h": 8, "w": 12, "x": 12, "y": 16}
      },
      {
        "id": 7,
        "title": "📊 Service Health Summary",
        "type": "table",
        "targets": [
          {
            "expr": "up{job=~\".*vaultwarden.*\"}",
            "format": "table",
            "instant": true
          }
        ],
        "transformations": [
          {
            "id": "organize",
            "options": {
              "excludeByName": {
                "Time": true,
                "__name__": true,
                "job": true
              },
              "renameByName": {
                "instance": "Service Endpoint",
                "Value": "Status"
              }
            }
          }
        ],
        "fieldConfig": {
          "defaults": {
            "mappings": [
              {
                "options": {
                  "0": {"text": "🔴 DOWN", "color": "red"},
                  "1": {"text": "🟢 UP", "color": "green"}
                },
                "type": "value"
              }
            ]
          }
        },
        "gridPos": {"h": 8, "w": 24, "x": 0, "y": 24}
      }
    ],
    "time": {
      "from": "now-1h",
      "to": "now"
    },
    "refresh": "30s",
    "annotations": {
      "list": [
        {
          "name": "Vaultwarden Events",
          "datasource": "Prometheus",
          "expr": "up{job=\"vaultwarden-monitoring\"} == 0",
          "titleFormat": "🔴 Vaultwarden Service Down",
          "textFormat": "Vaultwarden service is currently offline"
        }
      ]
    }
  }
}
