Grafana dashboards as ConfigMaps

文章目录

    • 1. 简介
    • 2. 创建 configmaps
    • 3. grafana 界面查看

1. 简介

将 Grafana 仪表板存储为 Kubernetes ConfigMap 相比传统的通过 Grafana 界面导入仪表板有以下一些主要优点:

  • 版本控制: ConfigMap 可以存储在版本控制系统(如Git)中,便于跟踪和管理仪表板的变更历史。而传统方式下,仪表板的改动很难追踪和恢复。
  • 可移植性:ConfigMap 是 Kubernetes 原生对象,可以在不同的集群和环境之间轻松迁移和共享。传统方式下,仪表板需要通过导出导入的方式在不同环境之间传递。
  • 集中管理: 所有仪表板都可以作为 ConfigMap 集中存储和管理,避免分散在多个位置。传统方式下,仪表板管理较为分散。
  • 动态更新:Kubernetes 支持在不重启 Grafana 的情况下更新 ConfigMap,从而无缓冲更新仪表板。传统方式需要重启 Grafana 使更改生效。
  • 一致性部署: 通过 ConfigMap 的方式,可以确保 Grafana 实例在部署时使用完全一致的仪表板配置。
  • 安全性 :ConfigMap 可以利用 Kubernetes 的角色访问控制机制来管理访问权限。
  • 自动化: ConfigMap 可以与 GitOps 工作流相结合,实现仪表板配置的自动化部署和更新。

总的来说,使用 ConfigMap 管理 Grafana 仪表板能够提高可维护性、一致性和自动化程度,同时增强安全性和可迁移性,非常适合云原生环境下的使用。

获取监控仪表盘的json文件,例如,展示 Gafana Redis Overview dashboard 的 redis.json,以prometheus作为数据源。

{"annotations": {"list": [{"builtIn": 1,"datasource": "-- Grafana --","enable": true,"hide": true,"iconColor": "rgba(0, 211, 255, 1)","name": "Annotations & Alerts","type": "dashboard"}]},"description": "Redis Overview","editable": true,"gnetId": 763,"graphTooltip": 1,"id": 28,"iteration": 1620627698368,"links": [],"panels": [{"cacheTimeout": null,"colorBackground": false,"colorValue": false,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"datasource": "Prometheus","decimals": 0,"editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {}},"overrides": []},"format": "s","gauge": {"maxValue": 100,"minValue": 0,"show": false,"thresholdLabels": false,"thresholdMarkers": true},"gridPos": {"h": 7,"w": 3,"x": 0,"y": 0},"id": 9,"interval": null,"isNew": true,"links": [],"mappingType": 1,"mappingTypes": [{"name": "value to text","value": 1},{"name": "range to text","value": 2}],"maxDataPoints": 100,"nullPointMode": "connected","nullText": null,"postfix": "","postfixFontSize": "50%","prefix": "","prefixFontSize": "50%","rangeMaps": [{"from": "null","text": "N/A","to": "null"}],"sparkline": {"fillColor": "rgba(31, 118, 189, 0.18)","full": false,"lineColor": "rgb(31, 120, 193)","show": true},"tableColumn": "","targets": [{"expr": "max(max_over_time(redis_uptime_in_seconds{service=~\"$service\",pod=~\"$pod\"}[$__interval]))","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "","metric": "","refId": "A","step": 1800}],"thresholds": "","title": "Max Uptime","type": "singlestat","valueFontSize": "70%","valueMaps": [{"op": "=","text": "N/A","value": "null"}],"valueName": "current"},{"cacheTimeout": null,"colorBackground": false,"colorValue": false,"colors": ["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],"datasource": "Prometheus","decimals": 0,"editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {}},"overrides": []},"format": "none","gauge": {"maxValue": 100,"minValue": 0,"show": false,"thresholdLabels": false,"thresholdMarkers": true},"gridPos": {"h": 7,"w": 2,"x": 3,"y": 0},"hideTimeOverride": true,"id": 12,"interval": null,"isNew": true,"links": [],"mappingType": 1,"mappingTypes": [{"name": "value to text","value": 1},{"name": "range to text","value": 2}],"maxDataPoints": 100,"nullPointMode": "connected","nullText": null,"postfix": "","postfixFontSize": "50%","prefix": "","prefixFontSize": "50%","rangeMaps": [{"from": "null","text": "N/A","to": "null"}],"sparkline": {"fillColor": "rgba(31, 118, 189, 0.18)","full": false,"lineColor": "rgb(31, 120, 193)","show": true},"tableColumn": "","targets": [{"expr": "sum(redis_connected_clients{service=~\"$service\",pod=~\"$pod\"})","format": "time_series","intervalFactor": 2,"legendFormat": "","metric": "","refId": "A","step": 2}],"thresholds": "","timeFrom": "1m","timeShift": null,"title": "Clients","type": "singlestat","valueFontSize": "80%","valueMaps": [{"op": "=","text": "N/A","value": "null"}],"valueName": "current"},{"cacheTimeout": null,"colorBackground": false,"colorValue": false,"colors": ["rgba(50, 172, 45, 0.97)","rgba(237, 129, 40, 0.89)","rgba(245, 54, 54, 0.9)"],"datasource": "Prometheus","decimals": 0,"editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {}},"overrides": []},"format": "percent","gauge": {"maxValue": 100,"minValue": 0,"show": true,"thresholdLabels": false,"thresholdMarkers": true},"gridPos": {"h": 7,"w": 3,"x": 5,"y": 0},"hideTimeOverride": true,"id": 11,"interval": null,"isNew": true,"links": [],"mappingType": 1,"mappingTypes": [{"name": "value to text","value": 1},{"name": "range to text","value": 2}],"maxDataPoints": 100,"nullPointMode": "connected","nullText": null,"postfix": "","postfixFontSize": "50%","prefix": "","prefixFontSize": "50%","rangeMaps": [{"from": "null","text": "N/A","to": "null"}],"sparkline": {"fillColor": "rgba(31, 118, 189, 0.18)","full": false,"lineColor": "rgb(31, 120, 193)","show": true},"tableColumn": "","targets": [{"expr": "sum(100 * (redis_memory_used_bytes{service=~\"$service\",pod=~\"$pod\"}  / redis_memory_max_bytes{service=~\"$service\",pod=~\"$pod\"}))","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "","metric": "","refId": "A","step": 2}],"thresholds": "80,95","timeFrom": "1m","timeShift": null,"title": "Memory Usage","type": "singlestat","valueFontSize": "80%","valueMaps": [{"op": "=","text": "N/A","value": "null"}],"valueName": "current"},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 8,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 8,"x": 8,"y": 0},"hiddenSeries": false,"id": 18,"isNew": true,"legend": {"avg": false,"current": false,"hideEmpty": false,"hideZero": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": true,"steppedLine": false,"targets": [{"expr": "sum(rate(redis_commands_total{service=~\"$service\",pod=~\"$pod\"} [1m])) by (cmd)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "{{ cmd }}","metric": "redis_command_calls_total","refId": "A","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Total Commands / sec","tooltip": {"msResolution": true,"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","decimals": 2,"editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 8,"x": 16,"y": 0},"hiddenSeries": false,"id": 1,"isNew": true,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": true,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "irate(redis_keyspace_hits_total{service=~\"$service\",pod=~\"$pod\"}[5m])","format": "time_series","hide": false,"interval": "","intervalFactor": 2,"legendFormat": "hits, {{ pod }}","metric": "","refId": "A","step": 240,"target": ""},{"expr": "irate(redis_keyspace_misses_total{service=~\"$service\",pod=~\"$pod\"}[5m])","format": "time_series","hide": false,"interval": "","intervalFactor": 2,"legendFormat": "misses, {{ pod }}","metric": "","refId": "B","step": 240,"target": ""}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Hits / Misses per Sec","tooltip": {"msResolution": false,"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "short","label": "","logBase": 1,"max": null,"min": 0,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {"max": "#BF1B00"},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 0,"y": 7},"hiddenSeries": false,"id": 7,"isNew": true,"legend": {"avg": false,"current": false,"hideEmpty": false,"hideZero": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "null as zero","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "redis_memory_used_bytes{service=~\"$service\",pod=~\"$pod\"}","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "used, {{ pod }}","metric": "","refId": "A","step": 240,"target": ""},{"expr": "redis_memory_max_bytes{service=~\"$service\",pod=~\"$pod\"}","format": "time_series","hide": false,"interval": "","intervalFactor": 2,"legendFormat": "max, {{ pod }}","refId": "B","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Total Memory Usage","tooltip": {"msResolution": false,"shared": true,"sort": 0,"value_type": "cumulative"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "bytes","label": null,"logBase": 1,"max": null,"min": 0,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 12,"y": 7},"hiddenSeries": false,"id": 10,"isNew": true,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "sum(rate(redis_net_input_bytes_total{service=~\"$service\",pod=~\"$pod\"}[5m])) by (pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "input, {{ pod }}","refId": "A","step": 240},{"expr": "sum(rate(redis_net_output_bytes_total{service=~\"$service\",pod=~\"$pod\"}[5m])) by (pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "output, {{ pod }}","refId": "B","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Network I/O","tooltip": {"msResolution": true,"shared": true,"sort": 0,"value_type": "cumulative"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "bytes","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 7,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 0,"y": 14},"hiddenSeries": false,"id": 5,"isNew": true,"legend": {"alignAsTable": false,"avg": false,"current": true,"hideEmpty": false,"hideZero": true,"max": false,"min": false,"rightSide": false,"show": true,"total": false,"values": true},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": true,"steppedLine": false,"targets": [{"expr": "sum (redis_db_keys{service=~\"$service\",pod=~\"$pod\"}) by (db, pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "{{ db }}, {{ pod }}","refId": "A","step": 240,"target": ""}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Total Items per DB","tooltip": {"msResolution": false,"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "none","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 7,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 12,"y": 14},"hiddenSeries": false,"id": 13,"isNew": true,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": true,"steppedLine": false,"targets": [{"expr": "sum (redis_db_keys{service=~\"$service\",pod=~\"$pod\"}) by (pod) - sum (redis_db_keys_expiring{service=~\"$service\",pod=~\"$pod\"}) by (pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "not expiring, {{ pod }}","refId": "A","step": 240,"target": ""},{"expr": "sum (redis_db_keys_expiring{service=~\"$service\",pod=~\"$pod\"}) by (pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "expiring, {{ pod }}","metric": "","refId": "B","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Expiring vs Not-Expiring Keys","tooltip": {"msResolution": false,"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {"evicts": "#890F02","memcached_items_evicted_total{instance=\"172.17.0.1:9150\",job=\"prometheus\"}": "#890F02","reclaims": "#3F6833"},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 0,"y": 21},"hiddenSeries": false,"id": 8,"isNew": true,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 2,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [{"alias": "reclaims","yaxis": 2}],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "sum(rate(redis_expired_keys_total{service=~\"$service\",pod=~\"$pod\"}[5m])) by (pod)","format": "time_series","hide": false,"interval": "","intervalFactor": 2,"legendFormat": "expired, {{ pod }}","metric": "","refId": "A","step": 240,"target": ""},{"expr": "sum(rate(redis_evicted_keys_total{service=~\"$service\",pod=~\"$pod\"}[5m])) by (pod)","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "evicted, {{ pod }}","refId": "B","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Expired/Evicted Keys","tooltip": {"msResolution": false,"shared": true,"sort": 0,"value_type": "cumulative"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 1,"fillGradient": 0,"gridPos": {"h": 7,"w": 12,"x": 12,"y": 21},"hiddenSeries": false,"id": 16,"legend": {"avg": false,"current": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "null","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 2,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "sum(redis_connected_clients{service=~\"$service\",pod=~\"$pod\"})","format": "time_series","intervalFactor": 1,"legendFormat": "connected","refId": "A"},{"expr": "sum(redis_blocked_clients{service=~\"$service\",pod=~\"$pod\"})","format": "time_series","intervalFactor": 1,"legendFormat": "blocked","refId": "B"}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Connected/Blocked Clients","tooltip": {"shared": true,"sort": 0,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 2,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 0,"y": 28},"hiddenSeries": false,"id": 20,"isNew": true,"legend": {"avg": false,"current": false,"hideEmpty": false,"hideZero": true,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": false,"steppedLine": false,"targets": [{"expr": "sum(irate(redis_commands_duration_seconds_total{service=~\"$service\",pod=~\"$pod\"}[1m])) by (cmd)\n  /\nsum(irate(redis_commands_total{service=~\"$service\",pod=~\"$pod\"}[1m])) by (cmd)\n","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "{{ cmd }}","metric": "redis_command_calls_total","refId": "A","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Average Time Spent by Command / sec","tooltip": {"msResolution": true,"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "s","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}},{"aliasColors": {},"bars": false,"dashLength": 10,"dashes": false,"datasource": "Prometheus","editable": true,"error": false,"fieldConfig": {"defaults": {"custom": {},"links": []},"overrides": []},"fill": 8,"fillGradient": 0,"grid": {},"gridPos": {"h": 7,"w": 12,"x": 12,"y": 28},"hiddenSeries": false,"id": 14,"isNew": true,"legend": {"avg": false,"current": false,"hideEmpty": false,"hideZero": false,"max": false,"min": false,"show": true,"total": false,"values": false},"lines": true,"linewidth": 1,"links": [],"nullPointMode": "connected","options": {"alertThreshold": true},"percentage": false,"pluginVersion": "7.4.2","pointradius": 5,"points": false,"renderer": "flot","seriesOverrides": [],"spaceLength": 10,"stack": true,"steppedLine": false,"targets": [{"expr": "sum(irate(redis_commands_duration_seconds_total{service=~\"$service\",pod=~\"$pod\"}[1m])) by (cmd) != 0","format": "time_series","interval": "","intervalFactor": 2,"legendFormat": "{{ cmd }}","metric": "redis_command_calls_total","refId": "A","step": 240}],"thresholds": [],"timeFrom": null,"timeRegions": [],"timeShift": null,"title": "Total Time Spent by Command / sec","tooltip": {"msResolution": true,"shared": true,"sort": 2,"value_type": "individual"},"type": "graph","xaxis": {"buckets": null,"mode": "time","name": null,"show": true,"values": []},"yaxes": [{"format": "s","label": null,"logBase": 1,"max": null,"min": null,"show": true},{"format": "short","label": null,"logBase": 1,"max": null,"min": null,"show": true}],"yaxis": {"align": false,"alignLevel": null}}],"refresh": false,"schemaVersion": 27,"style": "dark","tags": ["prometheus","redis"],"templating": {"list": [{"allValue": null,"current": {"selected": true,"text": "lkirulxq-l46-redis-exporter-svc","value": "lkirulxq-l46-redis-exporter-svc"},"datasource": null,"definition": "label_values(redis_up,service)","description": null,"error": null,"hide": 0,"includeAll": false,"label": "Service","multi": false,"name": "service","options": [],"query": {"query": "label_values(redis_up,service)","refId": "StandardVariableQuery"},"refresh": 1,"regex": "","skipUrlSync": false,"sort": 1,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"allValue": null,"current": {"selected": false,"text": "lkirulxq-l46-redis-1","value": "lkirulxq-l46-redis-1"},"datasource": null,"definition": "label_values(redis_up{service=\"$service\"},pod)","description": null,"error": null,"hide": 0,"includeAll": false,"label": "Pod","multi": false,"name": "pod","options": [],"query": {"query": "label_values(redis_up{service=\"$service\"},pod)","refId": "StandardVariableQuery"},"refresh": 1,"regex": "","skipUrlSync": false,"sort": 0,"tagValuesQuery": "","tags": [],"tagsQuery": "","type": "query","useTags": false},{"auto": false,"auto_count": 30,"auto_min": "10s","current": {"selected": false,"text": "1s","value": "1s"},"description": null,"error": null,"hide": 0,"label": "Interval","name": "interval","options": [{"selected": true,"text": "1s","value": "1s"},{"selected": false,"text": "5s","value": "5s"},{"selected": false,"text": "1m","value": "1m"},{"selected": false,"text": "5m","value": "5m"},{"selected": false,"text": "1h","value": "1h"},{"selected": false,"text": "6h","value": "6h"},{"selected": false,"text": "1d","value": "1d"}],"query": "1s,5s,1m,5m,1h,6h,1d","refresh": 2,"skipUrlSync": false,"type": "interval"}]},"time": {"from": "now-24h","to": "now"},"timepicker": {"refresh_intervals": ["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options": ["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone": "browser","title": "Redis Overview","uid": "redis","version": 6
}

2. 创建 configmaps

kubectl apply configmap redis-dashboard -n prometheus --from-file=redis.json

编辑 configmap 添加 label

kubectl edit cm  redis-dashboards -n prometheus
....
metadata:labels:grafana_dashboard: "1"
.......
....

3. grafana 界面查看

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/273137.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

牛客周赛 Round 36

赛况 C题可惜,比赛时模拟没有想明白,只对了一半,赛后看了大佬们的题解后恍然大悟,而F题是压根没思路,况且F题部分分也比较难拿。 题目列表 A-小红的数位删除 思路 将读入的数字整除10做三次后输出即可 参考代码 #inc…

Golang搭建grpc环境

简介 OS : Windows 11 Golang 版本: go1.22.0 grpc : 1.2 protobuffer: 1.28代理 没有代理国内环境下载不了库七牛CDN (试过可用) go env -w GOPROXYhttps://goproxy.cn,direct阿里云代理(运行grpc时下载包出现报错 ): go env -w GOPROXYhttps://mirr…

Qt ini配置文件

ini文件用于保存用户的设置操作,下列以背景颜色设置为例子 暂时默认设置为白色背景 这段代码放置在主窗口的构造函数中,用于初始化读取ini文件 QString color;//第一个参数在我这里ini文件时相对路径需要放在工程中,也可以写绝对路径QSettin…

运维:记一次寻找定时任务并删除的经历

前言 我相信接手别人的服务器、或者在没有任何文档的情况去看自己原先的服务器,都或多或少会遇到莫名其妙的服务器独有规则。 比如你服务本身跑的好好的,突然啪的一下,没了! 什么原因导致的呢?其中,很大可能是定时任务在作祟。 原因分析 本次,我遇到的问题是:在Ubuntu系…

017集——圆弧(ARC)转多段线(lwpolyline)——cad vba 中按一定精度拟合加点实现

在国土资源管理项目中,我们经常会遇到CAD转gis数据实现入库,而cad中的arc圆弧转为gis数据只能转出弧的顶点坐标,导致图形变形失真。若一个一个对弧进行手工增加点转为多段线,耗时耗力,效率极其低下。这里给出解决方案&…

微软亚太区AI智能应用创新业务负责人许豪,将出席“ISIG-AIGC技术与应用发展峰会”

3月16日,第四届「ISIG中国产业智能大会」将在上海中庚聚龙酒店拉开序幕。本届大会由苏州市金融科技协会指导,企智未来科技(AIGC开放社区、RPA中国、LowCode低码时代)主办。大会旨在聚合每一位产业成员的力量,深入探索A…

[QT]自定义的QtabWidget

需求 最近有一个需求就是一个QTabWidget要求有四个tab页在左侧用于显示主页面&#xff0c;在右侧有一个关于按钮&#xff0c;点击后用于弹出窗口显示一些程序相关信息。主要是怎么实现右侧按钮 相关代码 #ifndef MYTABWIDGET_H #define MYTABWIDGET_H#include <QWidget&g…

如何保证消息的可靠传输

数据的丢失问题&#xff0c;可能出现在生产者、MQ、消费者中 生产者丢失&#xff1a; 生产者将数据发送到 RabbitMQ 的时候&#xff0c;可能数据就在半路给搞丢了&#xff0c;因为网络问题啥的&#xff0c;都有可能。此时可以选择用 RabbitMQ 提供的事务功能&#xff0c;就是生…

std::function模板类性能问题

背景 题目&#xff1a;最近发现记忆化搜索真的很好用&#xff0c;于是在做力扣上记忆化搜索相关的题目时&#xff0c;用这种方法重做了一下买卖股票问题。 问题来源 在写递归代码的时候&#xff0c;我学习了一种匿名函数的写法&#xff0c;直接在函数体内写function<int(…

SpringBoot 多环境的配置(附带有截图)

文章目录 概要整体配置流程配置详细说明技术细节小结 概要 多环境开发 在实际项目开发中&#xff0c;一般需要针对不同的运行环境&#xff0c;如开发环境、测试环境、生产环境等&#xff0c;每个运行环境的数据库等配置都不相同&#xff0c;每次发布测试、更新生产都需要手动…

【MATLAB第99期】#源码分享 | 基于MATLAB的SHEPard模型多输入单输出回归预测模型

【MATLAB第99期】#源码分享 | 基于MATLAB的SHEPard模型多输入单输出回归预测模型 Shepard模型(简称SP模型)就是一种直观的、可操作的相似预测法&#xff0c;常用于插值。相似预测法基本原理按照相似原因产生相似结果的原则&#xff0c;从历史样本中集中找出与现在的最相似的一…

基于java ssm springboot女士电商平台系统

基于java ssm springboot女士电商平台系统源码文档设计 博主介绍&#xff1a;多年java开发经验&#xff0c;专注Java开发、定制、远程、文档编写指导等,csdn特邀作者、专注于Java技术领域 作者主页 央顺技术团队 Java毕设项目精品实战案例《1000套》 欢迎点赞 收藏 ⭐留言 文末…

Vue3学习记录(六)--- 组合式API之依赖注入和异步组件

一、依赖注入 1、简介 ​ 在前面的笔记中&#xff0c;我们学习过父组件向子组件传递数据时&#xff0c;需要借助props来实现。但如果父组件想要向孙子组件传递数据&#xff0c;那就要连续使用两层props逐级向下传递&#xff0c;如果要接收数据的是更深层的后代组件&#xff0…

数据库(mysql)-新手笔记-基本知识点(1)

基本概念 数据库 Database :存储数据的容器 表 Table : 在数据库中存储的基本结构,它由行和列组成 行 Row : 表中的一条记录 列 Column : 表中的字段,定义了数据的类型和约束 数据类型 数据值 如 INT(整型),FLAOT(浮点型) ,DECIMAL (精确小数点) 字符串 如 VARCHAR(可变长度字…

基于OpenCV的图形分析辨认03

目录 一、前言 二、实验目的 三、实验内容 四、实验过程 一、前言 编程语言&#xff1a;Python&#xff0c;编程软件&#xff1a;vscode或pycharm&#xff0c;必备的第三方库&#xff1a;OpenCV&#xff0c;numpy&#xff0c;matplotlib&#xff0c;os等等。 关于OpenCV&…

微信小程序云开发教程——墨刀原型工具入门(编辑页面)

引言 作为一个小白&#xff0c;小北要怎么在短时间内快速学会微信小程序原型设计&#xff1f; “时间紧&#xff0c;任务重”&#xff0c;这意味着学习时必须把握微信小程序原型设计中的重点、难点&#xff0c;而非面面俱到。 要在短时间内理解、掌握一个工具的使用&#xf…

Hello C++ (c++是什么/c++怎么学/c++推荐书籍)

引言 其实C基础语法基本上已经学完&#xff0c;早就想开始写C的博客了&#xff0c;却因为其他各种事情一直没开始。原计划是想讲Linux系统虚拟机安装的&#xff0c;后来考虑了一下还是算了&#xff0c;等Linux学到一定程度再开始相关博客的写作和发表吧。今天写博客想给C开个头…

excel 动态列导出

excel动态列&#xff0c;只好用poi来写了&#xff0c;也并不复杂&#xff0c;一样就这个件事情抽像为几步&#xff0c;就是套路了&#xff0c;开发效率就上去了。 1 准备空模板 导出操作与excel模板的导出一样&#xff0c;可以参考excel导出标准化 2 自定义SheetWriteHandler …

Python 一步一步教你用pyglet制作汉诺塔游戏

目录 汉诺塔游戏 1. 抓取颜色 2. 绘制圆盘 3. 九层汉塔 4. 绘制塔架 5. 叠加圆盘 6. 游戏框架 汉诺塔游戏 汉诺塔&#xff08;Tower of Hanoi&#xff09;&#xff0c;是一个源于印度古老传说的益智玩具。这个传说讲述了大梵天创造世界的时候&#xff0c;他做了三根金刚…

Python错题集-8:AttributeError(找不到对应的对象的属性)

1问题描述 AttributeError: AxesSubplot object has no attribute arc 2代码详情 import matplotlib.pyplot as plt# 创建一个新的图形和坐标轴 fig, ax plt.subplots()# 定义弧线的参数 center (0.5, 0.5) # 圆心坐标 (x, y) width 1.0 # 半径 height 0.5 # 半径 ang…