{
  "__inputs": [ { "name": "DS_PROMETHEUS", "label": "Prometheus", "type": "datasource", "pluginId": "prometheus", "pluginName": "Prometheus" } ],
  "title": "nMon",
  "uid": "nmon-overview",
  "tags": ["nmon", "monitoring"],
  "timezone": "browser",
  "schemaVersion": 39,
  "refresh": "1m",
  "time": { "from": "now-24h", "to": "now" },
  "templating": { "list": [
    { "name": "group", "label": "Gruppe", "type": "query", "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "query": "label_values(nmon_monitor_status, group)", "includeAll": true, "multi": true, "current": { "text": "All", "value": "$__all" } }
  ] },
  "panels": [
    { "type": "stat", "title": "Monitore OK", "gridPos": { "x": 0, "y": 0, "w": 6, "h": 4 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "count(nmon_monitor_status{group=~\"$group\"} == 1)", "refId": "A" } ],
      "fieldConfig": { "defaults": { "color": { "mode": "fixed", "fixedColor": "green" } } } },
    { "type": "stat", "title": "Warnungen", "gridPos": { "x": 6, "y": 0, "w": 6, "h": 4 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "count(nmon_monitor_status{group=~\"$group\"} == 2) or vector(0)", "refId": "A" } ],
      "fieldConfig": { "defaults": { "color": { "mode": "fixed", "fixedColor": "orange" } } } },
    { "type": "stat", "title": "Ausfälle", "gridPos": { "x": 12, "y": 0, "w": 6, "h": 4 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "count(nmon_monitor_status{group=~\"$group\"} == 3) or vector(0)", "refId": "A" } ],
      "fieldConfig": { "defaults": { "color": { "mode": "fixed", "fixedColor": "red" } } } },
    { "type": "stat", "title": "Offene Incidents", "gridPos": { "x": 18, "y": 0, "w": 6, "h": 4 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "sum(nmon_incidents_open)", "refId": "A" } ] },
    { "type": "timeseries", "title": "Antwortzeit", "gridPos": { "x": 0, "y": 4, "w": 24, "h": 8 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "nmon_monitor_response_seconds{group=~\"$group\"}", "legendFormat": "{{name}}", "refId": "A" } ],
      "fieldConfig": { "defaults": { "unit": "s" } } },
    { "type": "table", "title": "Monitore", "gridPos": { "x": 0, "y": 12, "w": 12, "h": 10 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "nmon_monitor_uptime_ratio{group=~\"$group\"} * 100", "format": "table", "instant": true, "refId": "A" } ],
      "fieldConfig": { "defaults": { "unit": "percent", "decimals": 2 } },
      "transformations": [ { "id": "organize", "options": { "excludeByName": { "Time": true, "__name__": true, "instance": true, "job": true, "id": true, "url": true, "type": true, "platform": true } } } ] },
    { "type": "table", "title": "Zertifikate (Tage bis Ablauf)", "gridPos": { "x": 12, "y": 12, "w": 12, "h": 10 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "sort((nmon_certificate_expiry_timestamp_seconds{group=~\"$group\"} - time()) / 86400)", "format": "table", "instant": true, "refId": "A" } ],
      "fieldConfig": { "defaults": { "decimals": 0, "thresholds": { "mode": "absolute", "steps": [ { "color": "red", "value": null }, { "color": "orange", "value": 7 }, { "color": "green", "value": 21 } ] } } },
      "transformations": [ { "id": "organize", "options": { "excludeByName": { "Time": true, "__name__": true, "instance": true, "job": true, "id": true, "type": true } } } ] },
    { "type": "timeseries", "title": "Server CPU", "gridPos": { "x": 0, "y": 22, "w": 12, "h": 8 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "nmon_server_cpu_percent{group=~\"$group\"}", "legendFormat": "{{name}}", "refId": "A" } ],
      "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } },
    { "type": "timeseries", "title": "Server RAM", "gridPos": { "x": 12, "y": 22, "w": 12, "h": 8 },
      "datasource": { "type": "prometheus", "uid": "${DS_PROMETHEUS}" },
      "targets": [ { "expr": "nmon_server_ram_used_bytes{group=~\"$group\"} / nmon_server_ram_total_bytes{group=~\"$group\"} * 100", "legendFormat": "{{name}}", "refId": "A" } ],
      "fieldConfig": { "defaults": { "unit": "percent", "max": 100 } } }
  ]
}
