|
| 1 | +{{- if and (.Capabilities.APIVersions.Has "grafana.integreatly.org/v1beta1") .Values.grafana.dashboard.enabled }} |
| 2 | +apiVersion: grafana.integreatly.org/v1beta1 |
| 3 | +kind: GrafanaDashboard |
| 4 | +metadata: |
| 5 | + name: {{ include "redis.grafanaDashboard.name" . }} |
| 6 | +spec: |
| 7 | + folder: {{ include "redis.grafanaFolder.name" . }} |
| 8 | + instanceSelector: |
| 9 | + matchLabels: |
| 10 | + {{- toYaml .Values.grafana.instanceSelector.matchLabels | nindent 6 }} |
| 11 | + json: | |
| 12 | + { |
| 13 | + "uid": "{{ .Release.Name }}-redis", |
| 14 | + "title": "Redis - {{ .Release.Name }}", |
| 15 | + "tags": ["redis"], |
| 16 | + "timezone": "browser", |
| 17 | + "schemaVersion": 38, |
| 18 | + "version": 1, |
| 19 | + "refresh": "30s", |
| 20 | + "time": {"from": "now-1h", "to": "now"}, |
| 21 | + "templating": { |
| 22 | + "list": [ |
| 23 | + { |
| 24 | + "type": "datasource", |
| 25 | + "name": "datasource", |
| 26 | + "label": "Datasource", |
| 27 | + "pluginId": "prometheus", |
| 28 | + "current": {} |
| 29 | + }, |
| 30 | + { |
| 31 | + "type": "textbox", |
| 32 | + "name": "namespace", |
| 33 | + "label": "Namespace", |
| 34 | + "current": { |
| 35 | + "value": "{{ .Release.Namespace }}", |
| 36 | + "text": "{{ .Release.Namespace }}" |
| 37 | + }, |
| 38 | + "options": [ |
| 39 | + { |
| 40 | + "selected": true, |
| 41 | + "text": "{{ .Release.Namespace }}", |
| 42 | + "value": "{{ .Release.Namespace }}" |
| 43 | + } |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "type": "query", |
| 48 | + "name": "pod", |
| 49 | + "label": "Pod", |
| 50 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 51 | + "definition": "label_values(container_cpu_usage_seconds_total{container=\"redis\", namespace=\"$namespace\"}, pod)", |
| 52 | + "query": { |
| 53 | + "query": "label_values(container_cpu_usage_seconds_total{container=\"redis\", namespace=\"$namespace\"}, pod)", |
| 54 | + "refId": "StandardVariableQuery" |
| 55 | + }, |
| 56 | + "refresh": 2, |
| 57 | + "multi": true, |
| 58 | + "includeAll": true, |
| 59 | + "allValue": ".*", |
| 60 | + "current": {} |
| 61 | + } |
| 62 | + ] |
| 63 | + }, |
| 64 | + "panels": [ |
| 65 | + { |
| 66 | + "id": 1, |
| 67 | + "title": "CPU Usage", |
| 68 | + "type": "timeseries", |
| 69 | + "gridPos": {"h": 8, "w": 12, "x": 0, "y": 0}, |
| 70 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 71 | + "targets": [ |
| 72 | + { |
| 73 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 74 | + "expr": "rate(container_cpu_usage_seconds_total{container=\"redis\", namespace=\"$namespace\", pod=~\"$pod\"}[5m])", |
| 75 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 76 | + "refId": "A" |
| 77 | + } |
| 78 | + ], |
| 79 | + "fieldConfig": { |
| 80 | + "defaults": { |
| 81 | + "unit": "short", |
| 82 | + "color": {"mode": "palette-classic"}, |
| 83 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 84 | + }, |
| 85 | + "overrides": [] |
| 86 | + }, |
| 87 | + "options": { |
| 88 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 89 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 90 | + } |
| 91 | + }, |
| 92 | + { |
| 93 | + "id": 2, |
| 94 | + "title": "Memory Usage", |
| 95 | + "type": "timeseries", |
| 96 | + "gridPos": {"h": 8, "w": 12, "x": 12, "y": 0}, |
| 97 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 98 | + "targets": [ |
| 99 | + { |
| 100 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 101 | + "expr": "container_memory_working_set_bytes{container=\"redis\", namespace=\"$namespace\", pod=~\"$pod\"}", |
| 102 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 103 | + "refId": "A" |
| 104 | + } |
| 105 | + ], |
| 106 | + "fieldConfig": { |
| 107 | + "defaults": { |
| 108 | + "unit": "bytes", |
| 109 | + "color": {"mode": "palette-classic"}, |
| 110 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 111 | + }, |
| 112 | + "overrides": [] |
| 113 | + }, |
| 114 | + "options": { |
| 115 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 116 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 117 | + } |
| 118 | + } |
| 119 | + {{- if .Values.redis.exporter.enabled }}, |
| 120 | + { |
| 121 | + "id": 3, |
| 122 | + "title": "Connected Clients", |
| 123 | + "type": "timeseries", |
| 124 | + "gridPos": {"h": 8, "w": 12, "x": 0, "y": 8}, |
| 125 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 126 | + "targets": [ |
| 127 | + { |
| 128 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 129 | + "expr": "redis_connected_clients{namespace=\"$namespace\", pod=~\"$pod\"}", |
| 130 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 131 | + "refId": "A" |
| 132 | + } |
| 133 | + ], |
| 134 | + "fieldConfig": { |
| 135 | + "defaults": { |
| 136 | + "unit": "short", |
| 137 | + "color": {"mode": "palette-classic"}, |
| 138 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 139 | + }, |
| 140 | + "overrides": [] |
| 141 | + }, |
| 142 | + "options": { |
| 143 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 144 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 145 | + } |
| 146 | + }, |
| 147 | + { |
| 148 | + "id": 4, |
| 149 | + "title": "Redis Memory Used", |
| 150 | + "type": "timeseries", |
| 151 | + "gridPos": {"h": 8, "w": 12, "x": 12, "y": 8}, |
| 152 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 153 | + "targets": [ |
| 154 | + { |
| 155 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 156 | + "expr": "redis_memory_used_bytes{namespace=\"$namespace\", pod=~\"$pod\"}", |
| 157 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 158 | + "refId": "A" |
| 159 | + } |
| 160 | + ], |
| 161 | + "fieldConfig": { |
| 162 | + "defaults": { |
| 163 | + "unit": "bytes", |
| 164 | + "color": {"mode": "palette-classic"}, |
| 165 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 166 | + }, |
| 167 | + "overrides": [] |
| 168 | + }, |
| 169 | + "options": { |
| 170 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 171 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 172 | + } |
| 173 | + }, |
| 174 | + { |
| 175 | + "id": 5, |
| 176 | + "title": "Commands Processed / sec", |
| 177 | + "type": "timeseries", |
| 178 | + "gridPos": {"h": 8, "w": 12, "x": 0, "y": 16}, |
| 179 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 180 | + "targets": [ |
| 181 | + { |
| 182 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 183 | + "expr": "rate(redis_commands_processed_total{namespace=\"$namespace\", pod=~\"$pod\"}[5m])", |
| 184 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 185 | + "refId": "A" |
| 186 | + } |
| 187 | + ], |
| 188 | + "fieldConfig": { |
| 189 | + "defaults": { |
| 190 | + "unit": "ops", |
| 191 | + "color": {"mode": "palette-classic"}, |
| 192 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 193 | + }, |
| 194 | + "overrides": [] |
| 195 | + }, |
| 196 | + "options": { |
| 197 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 198 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 199 | + } |
| 200 | + }, |
| 201 | + { |
| 202 | + "id": 6, |
| 203 | + "title": "Cache Hit Rate", |
| 204 | + "type": "timeseries", |
| 205 | + "gridPos": {"h": 8, "w": 12, "x": 12, "y": 16}, |
| 206 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 207 | + "targets": [ |
| 208 | + { |
| 209 | + "datasource": {"type": "prometheus", "uid": "${datasource}"}, |
| 210 | + "expr": "rate(redis_keyspace_hits_total{namespace=\"$namespace\", pod=~\"$pod\"}[5m]) / (rate(redis_keyspace_hits_total{namespace=\"$namespace\", pod=~\"$pod\"}[5m]) + rate(redis_keyspace_misses_total{namespace=\"$namespace\", pod=~\"$pod\"}[5m]))", |
| 211 | + "legendFormat": "{{ "{{" }}pod{{ "}}" }}", |
| 212 | + "refId": "A" |
| 213 | + } |
| 214 | + ], |
| 215 | + "fieldConfig": { |
| 216 | + "defaults": { |
| 217 | + "unit": "percentunit", |
| 218 | + "min": 0, |
| 219 | + "max": 1, |
| 220 | + "color": {"mode": "palette-classic"}, |
| 221 | + "custom": {"lineWidth": 1, "fillOpacity": 10} |
| 222 | + }, |
| 223 | + "overrides": [] |
| 224 | + }, |
| 225 | + "options": { |
| 226 | + "tooltip": {"mode": "multi", "sort": "none"}, |
| 227 | + "legend": {"displayMode": "list", "placement": "bottom"} |
| 228 | + } |
| 229 | + } |
| 230 | + {{- end }} |
| 231 | + ] |
| 232 | + } |
| 233 | +{{- end }} |
0 commit comments