diff --git a/monitoring/configmap-chemavx-homelab-overview.yaml b/monitoring/configmap-chemavx-homelab-overview.yaml index a67c815..0958973 100644 --- a/monitoring/configmap-chemavx-homelab-overview.yaml +++ b/monitoring/configmap-chemavx-homelab-overview.yaml @@ -4,9 +4,9 @@ metadata: name: chemavx-homelab-overview namespace: monitoring labels: - grafana_dashboard: "1" + grafana_dashboard: '1' data: - chemavx-homelab-overview.json: |- + chemavx-homelab-overview.json: | { "annotations": { "list": [ @@ -461,7 +461,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 8, + "x": 4, "y": 10 }, "id": 9, @@ -549,7 +549,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 12, + "x": 8, "y": 10 }, "id": 10, @@ -637,7 +637,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 16, + "x": 12, "y": 10 }, "id": 11, @@ -725,7 +725,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 20, + "x": 16, "y": 10 }, "id": 12, @@ -813,8 +813,8 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 0, - "y": 14 + "x": 20, + "y": 10 }, "id": 13, "options": { @@ -901,7 +901,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 4, + "x": 0, "y": 14 }, "id": 14, @@ -989,95 +989,7 @@ data: "gridPos": { "h": 4, "w": 4, - "x": 8, - "y": 14 - }, - "id": 15, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_pod_status_phase{namespace=\"polymarket-bot\",phase=\"Running\"}) or vector(0)", - "instant": true, - "legendFormat": "polymarket-bot", - "refId": "A" - } - ], - "title": "polymarket-bot", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "0": { - "color": "red", - "index": 0, - "text": "Down" - } - }, - "type": "value" - }, - { - "options": { - "from": 1, - "result": { - "color": "green", - "index": 1, - "text": "Running" - }, - "to": null - }, - "type": "range" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 4, - "x": 12, + "x": 4, "y": 14 }, "id": 16, @@ -1111,94 +1023,6 @@ data: "title": "ollama", "type": "stat" }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [ - { - "options": { - "0": { - "color": "red", - "index": 0, - "text": "Down" - } - }, - "type": "value" - }, - { - "options": { - "from": 1, - "result": { - "color": "green", - "index": 1, - "text": "Running" - }, - "to": null - }, - "type": "range" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 1 - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 4, - "w": 4, - "x": 16, - "y": 14 - }, - "id": 17, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "expr": "sum(kube_pod_status_phase{namespace=\"open-webui\",phase=\"Running\"}) or vector(0)", - "instant": true, - "legendFormat": "open-webui", - "refId": "A" - } - ], - "title": "open-webui", - "type": "stat" - }, { "collapsed": false, "gridPos": { @@ -1335,435 +1159,6 @@ data: ], "title": "Ollama — Memoria en uso", "type": "stat" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 27 - }, - "id": 21, - "panels": [], - "title": "📈 Polymarket Bot", - "type": "row" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue", - "value": null - } - ] - }, - "unit": "currencyUSD" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 0, - "y": 28 - }, - "id": 22, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/total_pnl/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "columns": [ - { - "selector": "total_pnl", - "text": "total_pnl", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_trades", - "text": "total_trades", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "win_rate", - "text": "win_rate", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_deployed", - "text": "total_deployed", - "timestampFormat": "", - "type": "number" - } - ], - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "filters": [], - "format": "dataframe", - "global_query_id": "", - "json_options": { - "columnar": false, - "root_is_not_array": true - }, - "method": "GET", - "parser": "backend", - "refId": "A", - "root_selector": "", - "source": "url", - "type": "json", - "url": "http://api.polymarket-bot.svc.cluster.local:8000/api/summary", - "url_options": { - "body_type": "", - "data": "", - "headers": null, - "method": "GET", - "params": null - } - } - ], - "title": "P&L Actual (USD)", - "type": "stat" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue", - "value": null - } - ] - }, - "unit": "short" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 6, - "y": 28 - }, - "id": 23, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/total_trades/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "columns": [ - { - "selector": "total_pnl", - "text": "total_pnl", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_trades", - "text": "total_trades", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "win_rate", - "text": "win_rate", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_deployed", - "text": "total_deployed", - "timestampFormat": "", - "type": "number" - } - ], - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "filters": [], - "format": "dataframe", - "global_query_id": "", - "json_options": { - "columnar": false, - "root_is_not_array": true - }, - "method": "GET", - "parser": "backend", - "refId": "A", - "root_selector": "", - "source": "url", - "type": "json", - "url": "http://api.polymarket-bot.svc.cluster.local:8000/api/summary", - "url_options": { - "body_type": "", - "data": "", - "headers": null, - "method": "GET", - "params": null - } - } - ], - "title": "Trades Totales", - "type": "stat" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue", - "value": null - } - ] - }, - "unit": "percentunit" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 12, - "y": 28 - }, - "id": 24, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/win_rate/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "columns": [ - { - "selector": "total_pnl", - "text": "total_pnl", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_trades", - "text": "total_trades", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "win_rate", - "text": "win_rate", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_deployed", - "text": "total_deployed", - "timestampFormat": "", - "type": "number" - } - ], - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "filters": [], - "format": "dataframe", - "global_query_id": "", - "json_options": { - "columnar": false, - "root_is_not_array": true - }, - "method": "GET", - "parser": "backend", - "refId": "A", - "root_selector": "", - "source": "url", - "type": "json", - "url": "http://api.polymarket-bot.svc.cluster.local:8000/api/summary", - "url_options": { - "body_type": "", - "data": "", - "headers": null, - "method": "GET", - "params": null - } - } - ], - "title": "Win Rate", - "type": "stat" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue", - "value": null - } - ] - }, - "unit": "currencyUSD" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 6, - "x": 18, - "y": 28 - }, - "id": 25, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "/total_deployed/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "12.4.2", - "targets": [ - { - "columns": [ - { - "selector": "total_pnl", - "text": "total_pnl", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_trades", - "text": "total_trades", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "win_rate", - "text": "win_rate", - "timestampFormat": "", - "type": "number" - }, - { - "selector": "total_deployed", - "text": "total_deployed", - "timestampFormat": "", - "type": "number" - } - ], - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "infinity" - }, - "filters": [], - "format": "dataframe", - "global_query_id": "", - "json_options": { - "columnar": false, - "root_is_not_array": true - }, - "method": "GET", - "parser": "backend", - "refId": "A", - "root_selector": "", - "source": "url", - "type": "json", - "url": "http://api.polymarket-bot.svc.cluster.local:8000/api/summary", - "url_options": { - "body_type": "", - "data": "", - "headers": null, - "method": "GET", - "params": null - } - } - ], - "title": "Capital Deployed (USD)", - "type": "stat" } ], "refresh": "30s", @@ -1780,6 +1175,6 @@ data: "timezone": "browser", "title": "ChemaVX Homelab Overview", "uid": "chemavx-homelab-v1", - "version": 3, + "version": 4, "weekStart": "" - } \ No newline at end of file + } diff --git a/monitoring/configmap-kube-prometheus-stack-grafana-datasource.yaml b/monitoring/configmap-kube-prometheus-stack-grafana-datasource.yaml index 310eed1..70b0bed 100644 --- a/monitoring/configmap-kube-prometheus-stack-grafana-datasource.yaml +++ b/monitoring/configmap-kube-prometheus-stack-grafana-datasource.yaml @@ -1,11 +1,6 @@ apiVersion: v1 data: - datasource.yaml: "apiVersion: 1\ndatasources:\n- name: \"Prometheus\"\n type: prometheus\n\ - \ uid: prometheus\n url: http://kube-prometheus-stack-prometheus.monitoring:9090/\n\ - \ access: proxy\n isDefault: true\n jsonData:\n httpMethod: POST\n timeInterval:\ - \ 30s\n- name: \"Alertmanager\"\n type: alertmanager\n uid: alertmanager\n \ - \ url: http://kube-prometheus-stack-alertmanager.monitoring:9093/\n access: proxy\n\ - \ jsonData:\n handleGrafanaManagedAlerts: false\n implementation: prometheus" + datasource.yaml: "apiVersion: 1\ndatasources:\n- name: \"Prometheus\"\n type: prometheus\n uid: prometheus\n url: http://kube-prometheus-stack-prometheus.monitoring:9090/\n access: proxy\n isDefault: true\n jsonData:\n httpMethod: POST\n timeInterval: 30s" kind: ConfigMap metadata: annotations: @@ -23,4 +18,3 @@ metadata: release: kube-prometheus-stack name: kube-prometheus-stack-grafana-datasource namespace: monitoring - diff --git a/monitoring/deployment-kube-prometheus-stack-grafana.yaml b/monitoring/deployment-kube-prometheus-stack-grafana.yaml index 9109fa9..c5e8731 100644 --- a/monitoring/deployment-kube-prometheus-stack-grafana.yaml +++ b/monitoring/deployment-kube-prometheus-stack-grafana.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: - deployment.kubernetes.io/revision: '2' + deployment.kubernetes.io/revision: '16' meta.helm.sh/release-name: kube-prometheus-stack meta.helm.sh/release-namespace: monitoring labels: @@ -31,9 +31,8 @@ spec: annotations: checksum/config: b835787868e1c1e3616db22add4a94b4f3a7b8ccedf24d3e48c323334a2b023c checksum/sc-dashboard-provider-config: e70bf6a851099d385178a76de9757bb0bef8299da6d8443602590e44f05fdf24 - checksum/secret: bed677784356b2af7fb0d87455db21f077853059b594101a4f6532bfbd962a7f kubectl.kubernetes.io/default-container: grafana - kubectl.kubernetes.io/restartedAt: '2026-04-09T07:16:07Z' + kubectl.kubernetes.io/restartedAt: '2026-07-22T08:00:01Z' labels: app.kubernetes.io/instance: kube-prometheus-stack app.kubernetes.io/name: grafana @@ -59,12 +58,12 @@ spec: valueFrom: secretKeyRef: key: admin-user - name: kube-prometheus-stack-grafana + name: grafana-admin - name: REQ_PASSWORD valueFrom: secretKeyRef: key: admin-password - name: kube-prometheus-stack-grafana + name: grafana-admin - name: REQ_URL value: http://localhost:3000/api/admin/provisioning/dashboards/reload - name: REQ_METHOD @@ -100,12 +99,12 @@ spec: valueFrom: secretKeyRef: key: admin-user - name: kube-prometheus-stack-grafana + name: grafana-admin - name: REQ_PASSWORD valueFrom: secretKeyRef: key: admin-password - name: kube-prometheus-stack-grafana + name: grafana-admin - name: REQ_URL value: http://localhost:3000/api/admin/provisioning/datasources/reload - name: REQ_METHOD @@ -136,12 +135,12 @@ spec: valueFrom: secretKeyRef: key: admin-user - name: kube-prometheus-stack-grafana + name: grafana-admin - name: GF_SECURITY_ADMIN_PASSWORD valueFrom: secretKeyRef: key: admin-password - name: kube-prometheus-stack-grafana + name: grafana-admin - name: GF_PATHS_DATA value: /var/lib/grafana/ - name: GF_PATHS_LOGS @@ -155,13 +154,13 @@ spec: - name: TELEGRAM_BOT_TOKEN valueFrom: secretKeyRef: - name: grafana-telegram-infisical key: TELEGRAM_BOT_TOKEN + name: grafana-telegram-infisical - name: TELEGRAM_CHAT_ID valueFrom: secretKeyRef: - name: grafana-telegram-infisical key: TELEGRAM_CHAT_ID + name: grafana-telegram-infisical image: docker.io/grafana/grafana:12.4.2 imagePullPolicy: IfNotPresent livenessProbe: @@ -212,6 +211,8 @@ spec: - mountPath: /etc/grafana/grafana.ini name: config subPath: grafana.ini + - mountPath: /etc/grafana/provisioning/alerting + name: grafana-alerting - mountPath: /var/lib/grafana name: storage - mountPath: /var/lib/grafana-search @@ -223,8 +224,6 @@ spec: subPath: provider.yaml - mountPath: /etc/grafana/provisioning/datasources name: sc-datasources-volume - - mountPath: /etc/grafana/provisioning/alerting - name: grafana-alerting dnsPolicy: ClusterFirst enableServiceLinks: true initContainers: @@ -269,6 +268,10 @@ spec: defaultMode: 420 name: kube-prometheus-stack-grafana name: config + - configMap: + defaultMode: 420 + name: grafana-alerting + name: grafana-alerting - name: storage persistentVolumeClaim: claimName: kube-prometheus-stack-grafana @@ -282,8 +285,3 @@ spec: name: sc-dashboard-provider - emptyDir: {} name: sc-datasources-volume - - configMap: - defaultMode: 420 - name: grafana-alerting - name: grafana-alerting - diff --git a/monitoring/values-kube-prometheus-stack.yaml b/monitoring/values-kube-prometheus-stack.yaml index 5337b90..6bff493 100644 --- a/monitoring/values-kube-prometheus-stack.yaml +++ b/monitoring/values-kube-prometheus-stack.yaml @@ -23,6 +23,19 @@ # como acceso de emergencia. Leerla: # kubectl get secret grafana-admin -n monitoring \ # -o jsonpath='{.data.admin-password}' | base64 -d; echo +# rev 5 (2026-07-22): fuera la datasource Alertmanager. OJO: NO la apaga +# alertmanager.enabled=false — el chart la provisiona igual, apuntando a un +# servicio que no existe (error 500 al consultarla). El interruptor real es +# grafana.sidecar.datasources.alertmanager.enabled. Y quitarla del fichero de +# provisioning NO la borra de grafana.db: hay que provisionar el borrado con +# una directiva deleteDatasources de un solo uso (se hizo y se retiró). +# rev 6 (2026-07-22): grafana.envValueFrom. Mismo caso que rev 3, encontrado al +# auditar el Deployment contra el render: TELEGRAM_BOT_TOKEN y TELEGRAM_CHAT_ID +# estaban puestas A MANO y el chart no las generaba. El contact point de +# alerting usa ${TELEGRAM_BOT_TOKEN}: reconstruir el release desde cero habría +# dejado las alertas de Telegram mudas. Se declaran aquí sin tocar nada vivo. +# (CHAT_ID hoy no lo usa nadie —el chatid del contact point va literal— pero se +# deja para que el render coincida exactamente con lo desplegado.) alertmanager: enabled: false defaultRules: @@ -34,6 +47,15 @@ defaultRules: grafana: admin: existingSecret: grafana-admin + envValueFrom: + TELEGRAM_BOT_TOKEN: + secretKeyRef: + key: TELEGRAM_BOT_TOKEN + name: grafana-telegram-infisical + TELEGRAM_CHAT_ID: + secretKeyRef: + key: TELEGRAM_CHAT_ID + name: grafana-telegram-infisical extraConfigmapMounts: - configMap: grafana-alerting mountPath: /etc/grafana/provisioning/alerting @@ -57,6 +79,10 @@ grafana: enabled: true size: 5Gi storageClassName: local-path + sidecar: + datasources: + alertmanager: + enabled: false kubeControllerManager: enabled: false kubeProxy: