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.mzph.cn/news/735231.shtml

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

相关文章

人民网(人民号)如何发布文章新闻,人民网怎么投稿,附人民日报价格多少钱

最近有很多朋友问到一个问题,就是人民网如何发布文章新闻,以及人民网怎么投稿。作为一个专业的媒体发稿平台,媒介多多网为大家提供了一个非常好的解决方案。 首先,人民网作为我国权威媒体之一,其新闻发布渠道非常严谨…

python学习笔记------集合(set)

集合定义格式 基本语法: #定义集合字面量 {元素,元素,元素......,元素} #定义集合变量 变量名称{元素,元素,元素......,元素} #定义空集合 变量名称set() #定义集合字面量 {元素&#…

利用Amazon Bedrock畅玩Claude 3等多种领先模型,抢占AI高地(体验倒计时4小时)

快乐的时间总是短暂的,Claude 3 在亚马逊云科技上限时体验仅剩4小时,上次分享了入门级操作教程,本期给大家带来AWS Lambda Amazon Bedrock一起构建可以便捷使用的Claude 3接口 AWS Lambda AWS Lambda 是一项计算服务,可以运行您…

小白也能上手的爬虫项目:从零开始学习数据抓取

博主猫头虎的技术世界 🌟 欢迎来到猫头虎的博客 — 探索技术的无限可能! 专栏链接: 🔗 精选专栏: 《面试题大全》 — 面试准备的宝典!《IDEA开发秘籍》 — 提升你的IDEA技能!《100天精通鸿蒙》 …

基于51单片机的定时器时钟设计[proteus仿真]

基于51单片机的定时器时钟设计[proteus仿真] 时钟设计检测系统这个题目算是课程设计和毕业设计中常见的题目了,本期是一个基于51单片机的定时器时钟设计 需要的源文件和程序的小伙伴可以关注公众号【阿目分享嵌入式】,赞赏任意文章 2¥&…

Git分支管理(Git分支的原理、创建、切换、合并、删除分支)

系列文章目录 文章一:Git基本操作 文章目录 系列文章目录前言一、Git分支是什么二、Git分支的原理三、创建分支四、切换分支五、合并分支六、删除分支 前言 在上一篇文章中,我们学习了如何使用Git的一些基本操作,例如安装Git、创建本地仓库…

IDEA编译安卓源码TVBox

因为电视x受限,无法观看电视直播,为了春晚不受影响,于是网络一顿搜索,试过多个APP,偶尔找到这款开源的TVBox,寒假在家,随便拿来练练手,学习安卓APP的编写,此文做以记录&a…

栈与队列的故事

​​​​​​​ 目录 ​编辑​​​​​​​ 一、栈 1.1栈的概念及结构 1.2栈的实现 1、实现支持动态增长的栈 2、初始化栈 3、入栈 4、出栈 5、获取栈顶元素 6、检测栈是否为空 7、获取栈中有效元素个数 8、销毁栈 9、测试 1.3源码 二、队列 2.1队列的概念及结构…

Python 强大邮件处理库 Imbox

目录 IMAP Mailbox Imbox 安装 特性 提取邮件内容 处理附件 安全性 示例 1:读取收件箱中的邮件 2:搜索并下载附件 3:连接到IMAP服务器获取所有邮件 结论 IMAP Mailbox IMAP(Internet Message Access Protocol&#x…

解放生产力,AI加持你也能做这些事!

去年网上流行一个说法叫一人企业或超级IP。一个人就是一家公司,可以更加专注于自身核心技能。既能对工作拥有更大的自主性和控制力,又能舍弃了传统公司管理等繁琐的事务工作,可以全面释放自己的兴趣和潜力。 这个概念给笔者留下了比较深的印…

使用Julia语言和R语言实现K-均值

K-均值算法基础 K-均值聚类算法属于一种无监督学习的方法,通过迭代的方式将数据划分为K个不重叠的子集(簇),每个子集由其内部数据点的平均值来表示。计算方法大体如下: 1.初始化簇中心 选择K个数据点作为初始的簇中心…

实用软件分享之自动清理过期备份文件清理文件夹

实用软件分享之自动清理过期备份文件清理文件夹,单文件程序,把程序放在要清理的文件夹内,运行后,可以设置清理指定文件后缀,支持设置保留个数,按文件的修改时候,清理掉最早的文件 初步讲解&am…

【算法面试题】-04

执行时长 def min_execution_time(n, size, tasks):a 0ans sizei 0while i < size:tmp tasks[i]a tmpif a < n:a 0else:a - ni 1ans a // nif a % n ! 0:ans 1return ans# 读取输入 n int(input()) size int(input()) tasks list(map(int, input().split()))…

ElasticSearch之排序,fielddata和docvalue

写在前面 es搜索返回结果的排序默认是按照得分的高低来排的&#xff0c;本文来看下如何按照字段来排序&#xff0c;实现类似于MySQL的order by xxx的效果。 1&#xff1a;什么是fileddata和doc_value 参考ElasticSearch之零碎知识点 和一文带你彻底弄懂ES中的doc_values和fi…

[QT]自定义的QtabWidget

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

[ROS 系列学习教程] rosbag C++ API

ROS 系列学习教程(总目录) 本文目录 一、rosbag::Bag1.1 常用接口1.2 其他接口 二、rosbag::View2.1 常用接口2.1.1 代码示例 rosbag 的 C API 主要有两个类&#xff0c;用于写bag文件的Bag类&#xff0c;和用于读bag文件的View类。 一、rosbag::Bag 用于写bag文件。 头文件…

集合和数组的相关操作

目录 1.数组转集合(引用类型数组) 2.数组转集合(基础类型数组) 3.集合转数组 4.集合之间是否相交 5.获取两个集合的交集 6.集合转为字符串 1.数组转集合(引用类型数组) (1)Arrays.asList 示例&#xff1a; String[] colArr new String[6];colArr[0] "1";co…

代码随想录刷题笔记 DAY 42 | 最后一块石头的重量 II No.1049 | 目标和 No.494 | 一和零 No.474

文章目录 Day 4301. 最后一块石头的重量 II&#xff08;No. 1049&#xff09;<1> 题目<2> 笔记<3> 代码 02. 目标和&#xff08;No. 494&#xff09;<1> 题目<2> 笔记<3> 代码 03. 一和零&#xff08;No. 474&#xff09;<1> 题目&l…

[C/C++]string类常用接口介绍及模拟实现string类

一&#xff1a;Cstring类的由来 在C语言中&#xff0c;字符串是以\0结尾的一些字符的集合&#xff0c;为了操作方便&#xff0c;C标准库中提供了一些str系列的库函数&#xff0c;但是这些库函数与字符串是分离开的&#xff0c;不太符合OOP的思想&#xff0c;而且底层空间需要用…

字节跳动的 SDXL-LIGHTNING : 体验飞一般的文生图

TikTok 的母公司字节跳动推出了最新的文本到图像生成人工智能模型&#xff0c;名为SDXL-Lightning。顾名思义&#xff0c;这个新模型只需很轻量的推理步骤&#xff08;1&#xff0c;4 或 8 步&#xff09;即可实现极其快速且高质量的文本到图像生成功能。与原始 SDXL 模型相比&…