├── .gitignore ├── README.md ├── bin └── grafana_dashboards_generate.sh ├── output └── README.md └── templates ├── ConfigMap.header ├── dashboard.foot ├── dashboard.header └── grafana-dashboards ├── README.md ├── all-nodes-dashboard.json ├── deployment-dashboard.json ├── kubernetes-pods-dashboard.json ├── node-dashboard.json ├── prometheus-datasource.json └── resource-requests-dashboard.json /.gitignore: -------------------------------------------------------------------------------- 1 | output/*.yaml 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Grafana Dashboards Configmap Generator 2 | 3 | ## IMPORTANT NOTE: 4 | 5 | This code has been moved and it's now part of `prometheus-operator` project. 6 | Check https://github.com/coreos/prometheus-operator. 7 | The code is under `contrib/kube-prometheus/hack/grafana-dashboards-configmap-generator` directory. 8 | 9 | Latest improvements available in `prometheus-operator` release are: 10 | * The tool also generates a grafana-deployment.yaml aligned with the configmaps generated. 11 | 12 | (I will update this repository with latest code soon). 13 | 14 | ## Description: 15 | Tool to maintain grafana dashboards' configmap for a grafana deployed with kube-prometheus (a tool inside prometheus-operator). 16 | 17 | The tool reads the content of a directory with grafana .json resources (dashboards and datasources) and creates a manifest file under output/ directory with all the content from the files in a Kubernetes ConfigMap format. 18 | 19 | Based on a configurable size limit, the tool will create 1 or N configmaps to allocate the .json resources (bin packing). If the limit is reached then the configmaps generated will have names like grafana-dashboards-0, grafana-dashboards-1, etc, and if the limit is not reached the configmap generated will be called "grafana-dashboards". 20 | 21 | Input Parameters Allowed: 22 | ```bash 23 | -i dir, --input-dir dir 24 | Directory with grafana dashboards to process. 25 | Important notes: 26 | Files should be suffixed with -dashboard.json or -datasource.json. 27 | We don't recommend file names with spaces. 28 | 29 | -o file, --output-file file 30 | Output file for config maps. 31 | 32 | -s NUM, --size-limit NUM 33 | Size limit in bytes for each dashboard (default: 240000) 34 | 35 | -n namespace, --namespace namespace 36 | Namespace for the configmap (default: monitoring). 37 | 38 | -x, --apply-configmap 39 | Applies the generated configmap with kubectl. 40 | 41 | --apply-type 42 | Type of kubectl command. Accepted values: apply, replace, create (default: apply). 43 | ``` 44 | 45 | ## Usage 46 | 47 | Just execute the .sh under bin/ directory. The output will be placed in the output/ directory. 48 | 49 | Examples: 50 | ```bash 51 | $ ./grafana_dashboards_generate.sh 52 | $ bin/grafana_dashboards_generate.sh -o manifests/grafana/grafana-dashboards.yaml -i assets/grafana-dashboards 53 | $ bin/grafana_dashboards_generate.sh -s 1000000 --apply-configmap --apply-type replace 54 | 55 | # Note: the output file, if provided with -o, shouldn't exist. 56 | ``` 57 | 58 | ## Configuration and options 59 | 60 | * Put the json files you want to pack in the templates/grafana-dashboards/ directory 61 | * Size limit default is 240000 bytes due to the annotations size limit in kubernetes of 256KB. 62 | 63 | -------------------------------------------------------------------------------- /bin/grafana_dashboards_generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Author: eedugon 3 | 4 | # Description: Tool to maintain grafana dashboards configmap for a grafana deployed 5 | # with kube-prometheus (a tool inside prometheus-operator) 6 | # The tool reads the content of a directory with grafana .json resources 7 | # that need to be moved into a configmap. 8 | # Based on a configurable size limit, the tool will create 1 or N configmaps 9 | # to allocate the .json resources (bin packing) 10 | 11 | # parameters 12 | # -o, --output-file 13 | # -i, --input-dir 14 | # -s, --size-limit 15 | # -x, --apply-configmap : true or false (default = false) 16 | # --apply-type : create, replace, apply (default = apply) 17 | 18 | # 19 | # Basic Functions 20 | # 21 | echoSyntax() { 22 | echo "Usage: ${0} [options]" 23 | echo "Options:" 24 | echo -e "\t-i dir, --input-dir dir" 25 | echo -e "\t\tDirectory with grafana dashboards to process." 26 | echo -e "\t\tImportant notes:" 27 | echo -e "\t\t\tFiles should be suffixed with -dashboard.json or -datasource.json." 28 | echo -e "\t\t\tWe don't recommend file names with spaces." 29 | echo 30 | echo -e "\t-o file, --output-file file" 31 | echo -e "\t\tOutput file for config maps." 32 | echo 33 | echo -e "\t-s NUM, --size-limit NUM" 34 | echo -e "\t\tSize limit in bytes for each dashboard (default: 240000)" 35 | echo 36 | echo -e "\t-n namespace, --namespace namespace" 37 | echo -e "\t\tNamespace for the configmap (default: monitoring)." 38 | echo 39 | echo -e "\t-x, --apply-configmap" 40 | echo -e "\t\tApplies the generated configmap with kubectl." 41 | echo 42 | echo -e "\t--apply-type" 43 | echo -e "\t\tType of kubectl command. Accepted values: apply, replace, create (default: apply)." 44 | } 45 | 46 | 47 | # # Apply changes --> environment allowed 48 | # test -z "$APPLY_CONFIGMAP" && APPLY_CONFIGMAP="false" 49 | # # Size limit --> environment set allowed 50 | # test -z "$DATA_SIZE_LIMIT" && DATA_SIZE_LIMIT="240000" # in bytes 51 | # # Changes type: in case of problems with k8s configmaps, try replace. Should be apply 52 | # test -z "$APPLY_TYPE" && APPLY_TYPE="apply" 53 | # # Input values verification 54 | # echo "$DATA_SIZE_LIMIT" | grep -q "^[0-9]\+$" || { echo "ERROR: Incorrect value for DATA_SIZE_LIMIT: $DATA_SIZE_LIMIT. Number expected"; exit 1; } 55 | 56 | # Base variables (do not change them) 57 | DATE_EXEC="$(date "+%Y-%m-%d-%H%M%S")" 58 | BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 59 | TOOL_HOME="$(dirname $BIN_DIR)" 60 | SCRIPT_BASE=`basename $0 | sed "s/\.[Ss][Hh]//"` 61 | 62 | TEMPLATES_DIR="$TOOL_HOME/templates" 63 | DASHBOARD_HEADER_FILE="$TEMPLATES_DIR/dashboard.header" 64 | DASHBOARD_FOOT_FILE="$TEMPLATES_DIR/dashboard.foot" 65 | CONFIGMAP_HEADER="$TEMPLATES_DIR/ConfigMap.header" 66 | OUTPUT_BASE_DIR="$TOOL_HOME/output" 67 | 68 | # Some default values 69 | OUTPUT_FILE="$OUTPUT_BASE_DIR/grafana-dashboards-configMap-$DATE_EXEC.yaml" 70 | DASHBOARDS_DIR="$TEMPLATES_DIR/grafana-dashboards" 71 | 72 | APPLY_CONFIGMAP="false" 73 | APPLY_TYPE="apply" 74 | DATA_SIZE_LIMIT="240000" 75 | NAMESPACE="monitoring" 76 | 77 | # Input parameters 78 | while (( "$#" )); do 79 | case "$1" in 80 | "-o" | "--output-file") 81 | OUTPUT_FILE="$2" 82 | shift 83 | ;; 84 | "-i" | "--input-dir") 85 | DASHBOARDS_DIR="$2" 86 | shift 87 | ;; 88 | "-n" | "--namespace") 89 | NAMESPACE="$2" 90 | shift 91 | ;; 92 | "-x" | "--apply-configmap") 93 | APPLY_CONFIGMAP="true" 94 | ;; 95 | "--apply-type") 96 | APPLY_TYPE="$2" 97 | test "$APPLY_TYPE" != "create" && test "$APPLY_TYPE" != "apply" && test "$APPLY_TYPE" != "replace" && { echo "Unexpected APPLY_TYPE: $APPLY_TYPE"; exit 1; } 98 | shift 99 | ;; 100 | "-s"|"--size-limit") 101 | if ! ( echo $2 | grep -q '^[0-9]\+$') || [ $2 -eq 0 ]; then 102 | echo "Invalid value for size limit '$2'" 103 | exit 1 104 | fi 105 | DATA_SIZE_LIMIT=$2 106 | shift 107 | ;; 108 | "-h"|"--help") 109 | echoSyntax 110 | exit 0 111 | ;; 112 | *) 113 | echo "Unknown argument: $1" 114 | exit 1 115 | ;; 116 | esac 117 | shift 118 | done 119 | 120 | # 121 | # Main Functions 122 | # 123 | addConfigMapHeader() { 124 | # If a parameter is provided it will be used as the configmap index. 125 | # If no parameter is provided, the name will be kept 126 | test "$#" -le 1 || { echo "# INTERNAL ERROR: Wrong call to function addConfigMapHeader"; return 1; } 127 | local id="$1" 128 | 129 | if [ "$id" ]; then 130 | cat "$CONFIGMAP_HEADER" | sed "s/name: grafana-dashboards/name: grafana-dashboards-$id/" 131 | else 132 | cat "$CONFIGMAP_HEADER" 133 | fi 134 | } 135 | 136 | addArrayToConfigMap() { 137 | # This function process the array to_process into a configmap 138 | 139 | local OLDIFS=$IFS 140 | local IFS=$'\n' 141 | for file in ${to_process[@]}; do 142 | # check that file exists 143 | test -f "$file" || { echo "# INTERNAL ERROR IN ARRAY: File not found: $file"; continue; } 144 | 145 | # detection of type (dashboard or datasource) 146 | type="" 147 | basename "$file" | grep -q "\-datasource" && type="datasource" 148 | basename "$file" | grep -q "\-dashboard" && type="dashboard" 149 | test "$type" || { echo "# ERROR: Unrecognized file type: $(basename $file)"; return 1; } 150 | 151 | #echo "# Processing $type $file" 152 | # Indent 2 153 | echo " $(basename $file): |+" 154 | 155 | # Dashboard header: No indent needed 156 | test "$type" = "dashboard" && cat $DASHBOARD_HEADER_FILE 157 | 158 | # File content: Indent 4 159 | cat $file | sed "s/^/ /" 160 | 161 | # Dashboard foot 162 | test "$type" = "dashboard" && cat $DASHBOARD_FOOT_FILE 163 | done 164 | echo "---" 165 | 166 | IFS=$OLDIFS 167 | return 0 168 | } 169 | 170 | initialize-bin-pack() { 171 | # We separate initialization to reuse the bin-pack for different sets of files. 172 | n="0" 173 | to_process=() 174 | bytes_to_process="0" 175 | total_files_processed="0" 176 | total_configmaps_created="0" 177 | } 178 | 179 | bin-pack-files() { 180 | # Algorithm: 181 | # We process the files with no special order consideration 182 | # We create an array/queue of "files to add to configmap" called "to_process" 183 | # Size of the file is analyzed to determine if it can be added to the queue or not. 184 | # the max size of the queue is limited by DATA_SIZE_LIMIT 185 | # while there's room available in the queue we add files. 186 | # when there's no room we create a configmap with the members of the queue 187 | # before adding the file to a cleaned queue 188 | 189 | # Counters initialization is not in the scope of this function 190 | local file="" 191 | OLDIFS=$IFS 192 | IFS=$'\n' 193 | # echo "DEBUG bin-pack:" 194 | # echo "$@" 195 | 196 | for file in $@; do 197 | test -f "$file" || { echo "# INTERNAL ERROR: File not found: $file"; continue; } 198 | # echo "debug: Processing file $(basename $file)" 199 | 200 | file_size_bytes="$(stat -c%s "$file")" 201 | 202 | # If the file is bigger than the configured limit we skip it file 203 | if [ "$file_size_bytes" -gt "$DATA_SIZE_LIMIT" ]; then 204 | echo "ERROR: File $(basename $file) bigger than size limit: $DATA_SIZE_LIMIT ($file_size_bytes). Skipping" 205 | continue 206 | fi 207 | (( total_files_processed++ )) 208 | 209 | if test "$(expr "$bytes_to_process" + "$file_size_bytes")" -le "$DATA_SIZE_LIMIT"; then 210 | # We have room to include the file in the configmap 211 | # test "$to_process" && to_process="$to_process $file" || to_process="$file" 212 | to_process+=("$file") 213 | (( bytes_to_process = bytes_to_process + file_size_bytes )) 214 | echo "# File $(basename $file) : added to queue" 215 | else 216 | # There's no room to add this file to the queue. so we process what we have and add the file to the queue 217 | if [ "$to_process" ]; then 218 | echo 219 | echo "# Size limit ($DATA_SIZE_LIMIT) reached. Processing queue with $bytes_to_process bytes. Creating configmap with id $n" 220 | echo 221 | # Create a new configmap 222 | addConfigMapHeader $n >> $OUTPUT_FILE || { echo "ERROR in call to addConfigMapHeader function"; exit 1; } 223 | addArrayToConfigMap >> $OUTPUT_FILE || { echo "ERROR in call to addArrayToConfigMap function"; exit 1; } 224 | # Initialize variables with info about file not processed 225 | (( total_configmaps_created++ )) 226 | (( n++ )) 227 | # to_process="$file" 228 | to_process=() 229 | to_process+=("$file") 230 | bytes_to_process="$file_size_bytes" 231 | echo "# File $(basename $file) : added to queue" 232 | else 233 | # based on the algorithm the queue should never be empty if we reach this part of the code 234 | # if this happens maybe bytes_to_process was not aligned with the queue (to_process) 235 | echo "ERROR (unexpected)" 236 | fi 237 | fi 238 | done 239 | IFS=$OLDIFS 240 | } 241 | 242 | # Some variables checks... 243 | test ! -d "$TEMPLATES_DIR" && { echo "ERROR: missing templates directory $TEMPLATES_DIR"; exit 1; } 244 | 245 | test -f "$DASHBOARD_FOOT_FILE" || { echo "Template $DASHBOARD_FOOT_FILE not found"; exit 1; } 246 | test -f "$DASHBOARD_HEADER_FILE" || { echo "Template $DASHBOARD_HEADER_FILE not found"; exit 1; } 247 | test -f "$CONFIGMAP_HEADER" || { echo "Template $CONFIGMAP_HEADER not found"; exit 1; } 248 | 249 | test ! -d "$OUTPUT_BASE_DIR" && { echo "ERROR: missing directory $OUTPUT_BASE_DIR"; exit 1; } 250 | 251 | # Initial checks 252 | test -d "$DASHBOARDS_DIR" || { echo "ERROR: Dashboards directory not found: $DASHBOARDS_DIR"; echoSyntax; exit 1; } 253 | 254 | test -f "$OUTPUT_FILE" && { echo "ERROR: Output file already exists: $OUTPUT_FILE"; exit 1; } 255 | touch $OUTPUT_FILE || { echo "ERROR: Unable to create or modify $OUTPUT_FILE"; exit 1; } 256 | 257 | # Main code start 258 | 259 | echo "# Starting execution of $SCRIPT_BASE on $DATE_EXEC" 260 | echo "# Configured size limit: $DATA_SIZE_LIMIT bytes" 261 | echo "# Grafna input dashboards and datasources will be read from: $DASHBOARDS_DIR" 262 | echo "# Grafana Dashboards ConfigMap will be created into file:" 263 | echo "$OUTPUT_FILE" 264 | echo 265 | 266 | # Loop variables initialization 267 | initialize-bin-pack 268 | 269 | # Process dashboards 270 | bin-pack-files "$(find $DASHBOARDS_DIR -maxdepth 1 -type f -name "*-dashboard.json" | sort)" 271 | 272 | # Continue processing datasources (maintaining the same queue) 273 | bin-pack-files "$(find $DASHBOARDS_DIR -maxdepth 1 -type f -name "*-datasource.json" | sort )" 274 | 275 | # Processing remaining data in the queue (or unique) 276 | if [ "$to_process" ]; then 277 | if [ "$n" -eq 0 ]; then 278 | echo 279 | echo "# Size limit not reached ($bytes_to_process). Adding all files into basic configmap" 280 | echo 281 | addConfigMapHeader >> $OUTPUT_FILE || { echo "ERROR in call to addConfigMapHeader function"; exit 1; } 282 | else 283 | echo 284 | echo "# Size limit not reached ($bytes_to_process). Adding remaining files into configmap with id $n" 285 | echo 286 | addConfigMapHeader $n >> $OUTPUT_FILE || { echo "ERROR in call to addConfigMapHeader function"; exit 1; } 287 | fi 288 | addArrayToConfigMap >> $OUTPUT_FILE || { echo "ERROR in call to addArrayToConfigMap function"; exit 1; } 289 | (( total_configmaps_created++ )) 290 | to_process=() 291 | fi 292 | 293 | echo "# Process completed, configmap created: $(basename $OUTPUT_FILE)" 294 | echo "# Summary" 295 | echo "# Total files processed: $total_files_processed" 296 | echo "# Total amount of ConfigMaps inside the manifest: $total_configmaps_created" 297 | 298 | # If output file is empty we can delete it and exit 299 | test ! -s "$OUTPUT_FILE" && { echo "# Configmap empty, deleting file"; rm $OUTPUT_FILE; exit 0; } 300 | 301 | if [ "$APPLY_CONFIGMAP" = "true" ]; then 302 | test -x "$(which kubectl)" || { echo "ERROR: kubectl command not available. Apply configmap not possible"; exit 1; } 303 | echo 304 | if kubectl -n $NAMESPACE $APPLY_TYPE -f "$OUTPUT_FILE"; then 305 | echo 306 | echo "# ConfigMap updated. Wait until grafana-watcher applies the changes and reloads the dashboards." 307 | else 308 | echo 309 | echo "ERROR APPLYING CONFIGURATION. Check yaml file" 310 | echo "$OUTPUT_FILE" 311 | fi 312 | else 313 | echo 314 | echo "# To apply the new configMap to your k8s system do something like:" 315 | echo "kubectl -n monitoring $APPLY_TYPE -f $(basename $OUTPUT_FILE)" 316 | echo 317 | fi 318 | -------------------------------------------------------------------------------- /output/README.md: -------------------------------------------------------------------------------- 1 | ### This directory will include all generated manifests 2 | -------------------------------------------------------------------------------- /templates/ConfigMap.header: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: grafana-dashboards 5 | data: 6 | -------------------------------------------------------------------------------- /templates/dashboard.foot: -------------------------------------------------------------------------------- 1 | , 2 | "inputs": [ 3 | { 4 | "name": "DS_PROMETHEUS", 5 | "pluginId": "prometheus", 6 | "type": "datasource", 7 | "value": "prometheus" 8 | } 9 | ], 10 | "overwrite": true 11 | } 12 | -------------------------------------------------------------------------------- /templates/dashboard.header: -------------------------------------------------------------------------------- 1 | { 2 | "dashboard": 3 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/README.md: -------------------------------------------------------------------------------- 1 | # Add your grafana dashboards into this directory 2 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/all-nodes-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "description": "", 5 | "label": "prometheus", 6 | "name": "DS_PROMETHEUS", 7 | "pluginId": "prometheus", 8 | "pluginName": "Prometheus", 9 | "type": "datasource" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "id": "grafana", 15 | "name": "Grafana", 16 | "type": "grafana", 17 | "version": "4.1.1" 18 | }, 19 | { 20 | "id": "graph", 21 | "name": "Graph", 22 | "type": "panel", 23 | "version": "" 24 | }, 25 | { 26 | "id": "prometheus", 27 | "name": "Prometheus", 28 | "type": "datasource", 29 | "version": "1.0.0" 30 | }, 31 | { 32 | "id": "singlestat", 33 | "name": "Singlestat", 34 | "type": "panel", 35 | "version": "" 36 | } 37 | ], 38 | "annotations": { 39 | "list": [] 40 | }, 41 | "description": "Dashboard to get an overview of one server", 42 | "editable": true, 43 | "gnetId": 22, 44 | "graphTooltip": 0, 45 | "hideControls": false, 46 | "id": null, 47 | "links": [], 48 | "refresh": false, 49 | "rows": [ 50 | { 51 | "collapse": false, 52 | "height": "250px", 53 | "panels": [ 54 | { 55 | "alerting": {}, 56 | "aliasColors": {}, 57 | "bars": false, 58 | "datasource": "${DS_PROMETHEUS}", 59 | "editable": true, 60 | "error": false, 61 | "fill": 1, 62 | "grid": {}, 63 | "id": 3, 64 | "legend": { 65 | "avg": false, 66 | "current": false, 67 | "max": false, 68 | "min": false, 69 | "show": true, 70 | "total": false, 71 | "values": false 72 | }, 73 | "lines": true, 74 | "linewidth": 2, 75 | "links": [], 76 | "nullPointMode": "connected", 77 | "percentage": false, 78 | "pointradius": 5, 79 | "points": false, 80 | "renderer": "flot", 81 | "seriesOverrides": [], 82 | "span": 6, 83 | "stack": false, 84 | "steppedLine": false, 85 | "targets": [ 86 | { 87 | "expr": "sum(rate(node_cpu{mode=\"idle\"}[2m])) * 100", 88 | "hide": false, 89 | "intervalFactor": 10, 90 | "legendFormat": "", 91 | "refId": "A", 92 | "step": 50 93 | } 94 | ], 95 | "thresholds": [], 96 | "timeFrom": null, 97 | "timeShift": null, 98 | "title": "Idle cpu", 99 | "tooltip": { 100 | "msResolution": false, 101 | "shared": true, 102 | "sort": 0, 103 | "value_type": "cumulative" 104 | }, 105 | "type": "graph", 106 | "xaxis": { 107 | "mode": "time", 108 | "name": null, 109 | "show": true, 110 | "values": [] 111 | }, 112 | "yaxes": [ 113 | { 114 | "format": "percent", 115 | "label": "cpu usage", 116 | "logBase": 1, 117 | "max": null, 118 | "min": 0, 119 | "show": true 120 | }, 121 | { 122 | "format": "short", 123 | "label": null, 124 | "logBase": 1, 125 | "max": null, 126 | "min": null, 127 | "show": true 128 | } 129 | ] 130 | }, 131 | { 132 | "alerting": {}, 133 | "aliasColors": {}, 134 | "bars": false, 135 | "datasource": "${DS_PROMETHEUS}", 136 | "editable": true, 137 | "error": false, 138 | "fill": 1, 139 | "grid": {}, 140 | "id": 9, 141 | "legend": { 142 | "avg": false, 143 | "current": false, 144 | "max": false, 145 | "min": false, 146 | "show": true, 147 | "total": false, 148 | "values": false 149 | }, 150 | "lines": true, 151 | "linewidth": 2, 152 | "links": [], 153 | "nullPointMode": "connected", 154 | "percentage": false, 155 | "pointradius": 5, 156 | "points": false, 157 | "renderer": "flot", 158 | "seriesOverrides": [], 159 | "span": 6, 160 | "stack": false, 161 | "steppedLine": false, 162 | "targets": [ 163 | { 164 | "expr": "sum(node_load1)", 165 | "intervalFactor": 4, 166 | "legendFormat": "load 1m", 167 | "refId": "A", 168 | "step": 20, 169 | "target": "" 170 | }, 171 | { 172 | "expr": "sum(node_load5)", 173 | "intervalFactor": 4, 174 | "legendFormat": "load 5m", 175 | "refId": "B", 176 | "step": 20, 177 | "target": "" 178 | }, 179 | { 180 | "expr": "sum(node_load15)", 181 | "intervalFactor": 4, 182 | "legendFormat": "load 15m", 183 | "refId": "C", 184 | "step": 20, 185 | "target": "" 186 | } 187 | ], 188 | "thresholds": [], 189 | "timeFrom": null, 190 | "timeShift": null, 191 | "title": "System load", 192 | "tooltip": { 193 | "msResolution": false, 194 | "shared": true, 195 | "sort": 0, 196 | "value_type": "cumulative" 197 | }, 198 | "type": "graph", 199 | "xaxis": { 200 | "mode": "time", 201 | "name": null, 202 | "show": true, 203 | "values": [] 204 | }, 205 | "yaxes": [ 206 | { 207 | "format": "percentunit", 208 | "label": null, 209 | "logBase": 1, 210 | "max": null, 211 | "min": null, 212 | "show": true 213 | }, 214 | { 215 | "format": "short", 216 | "label": null, 217 | "logBase": 1, 218 | "max": null, 219 | "min": null, 220 | "show": true 221 | } 222 | ] 223 | } 224 | ], 225 | "repeat": null, 226 | "repeatIteration": null, 227 | "repeatRowId": null, 228 | "showTitle": false, 229 | "title": "New row", 230 | "titleSize": "h6" 231 | }, 232 | { 233 | "collapse": false, 234 | "height": "250px", 235 | "panels": [ 236 | { 237 | "alerting": {}, 238 | "aliasColors": {}, 239 | "bars": false, 240 | "datasource": "${DS_PROMETHEUS}", 241 | "editable": true, 242 | "error": false, 243 | "fill": 1, 244 | "grid": {}, 245 | "id": 4, 246 | "legend": { 247 | "avg": false, 248 | "current": false, 249 | "max": false, 250 | "min": false, 251 | "show": true, 252 | "total": false, 253 | "values": false 254 | }, 255 | "lines": true, 256 | "linewidth": 2, 257 | "links": [], 258 | "nullPointMode": "connected", 259 | "percentage": false, 260 | "pointradius": 5, 261 | "points": false, 262 | "renderer": "flot", 263 | "seriesOverrides": [ 264 | { 265 | "alias": "node_memory_SwapFree{instance=\"172.17.0.1:9100\",job=\"prometheus\"}", 266 | "yaxis": 2 267 | } 268 | ], 269 | "span": 9, 270 | "stack": true, 271 | "steppedLine": false, 272 | "targets": [ 273 | { 274 | "expr": "sum(node_memory_MemTotal) - sum(node_memory_MemFree) - sum(node_memory_Buffers) - sum(node_memory_Cached)", 275 | "intervalFactor": 2, 276 | "legendFormat": "memory usage", 277 | "metric": "memo", 278 | "refId": "A", 279 | "step": 4, 280 | "target": "" 281 | }, 282 | { 283 | "expr": "sum(node_memory_Buffers)", 284 | "interval": "", 285 | "intervalFactor": 2, 286 | "legendFormat": "memory buffers", 287 | "metric": "memo", 288 | "refId": "B", 289 | "step": 4, 290 | "target": "" 291 | }, 292 | { 293 | "expr": "sum(node_memory_Cached)", 294 | "interval": "", 295 | "intervalFactor": 2, 296 | "legendFormat": "memory cached", 297 | "metric": "memo", 298 | "refId": "C", 299 | "step": 4, 300 | "target": "" 301 | }, 302 | { 303 | "expr": "sum(node_memory_MemFree)", 304 | "interval": "", 305 | "intervalFactor": 2, 306 | "legendFormat": "memory free", 307 | "metric": "memo", 308 | "refId": "D", 309 | "step": 4, 310 | "target": "" 311 | } 312 | ], 313 | "thresholds": [], 314 | "timeFrom": null, 315 | "timeShift": null, 316 | "title": "Memory usage", 317 | "tooltip": { 318 | "msResolution": false, 319 | "shared": true, 320 | "sort": 0, 321 | "value_type": "individual" 322 | }, 323 | "type": "graph", 324 | "xaxis": { 325 | "mode": "time", 326 | "name": null, 327 | "show": true, 328 | "values": [] 329 | }, 330 | "yaxes": [ 331 | { 332 | "format": "bytes", 333 | "label": null, 334 | "logBase": 1, 335 | "max": null, 336 | "min": "0", 337 | "show": true 338 | }, 339 | { 340 | "format": "short", 341 | "label": null, 342 | "logBase": 1, 343 | "max": null, 344 | "min": null, 345 | "show": true 346 | } 347 | ] 348 | }, 349 | { 350 | "cacheTimeout": null, 351 | "colorBackground": false, 352 | "colorValue": false, 353 | "colors": [ 354 | "rgba(50, 172, 45, 0.97)", 355 | "rgba(237, 129, 40, 0.89)", 356 | "rgba(245, 54, 54, 0.9)" 357 | ], 358 | "datasource": "${DS_PROMETHEUS}", 359 | "editable": true, 360 | "error": false, 361 | "format": "percent", 362 | "gauge": { 363 | "maxValue": 100, 364 | "minValue": 0, 365 | "show": true, 366 | "thresholdLabels": false, 367 | "thresholdMarkers": true 368 | }, 369 | "id": 5, 370 | "interval": null, 371 | "links": [], 372 | "mappingType": 1, 373 | "mappingTypes": [ 374 | { 375 | "name": "value to text", 376 | "value": 1 377 | }, 378 | { 379 | "name": "range to text", 380 | "value": 2 381 | } 382 | ], 383 | "maxDataPoints": 100, 384 | "nullPointMode": "connected", 385 | "nullText": null, 386 | "postfix": "", 387 | "postfixFontSize": "50%", 388 | "prefix": "", 389 | "prefixFontSize": "50%", 390 | "rangeMaps": [ 391 | { 392 | "from": "null", 393 | "text": "N/A", 394 | "to": "null" 395 | } 396 | ], 397 | "span": 3, 398 | "sparkline": { 399 | "fillColor": "rgba(31, 118, 189, 0.18)", 400 | "full": false, 401 | "lineColor": "rgb(31, 120, 193)", 402 | "show": false 403 | }, 404 | "targets": [ 405 | { 406 | "expr": "((sum(node_memory_MemTotal) - sum(node_memory_MemFree) - sum(node_memory_Buffers) - sum(node_memory_Cached)) / sum(node_memory_MemTotal)) * 100", 407 | "intervalFactor": 2, 408 | "metric": "", 409 | "refId": "A", 410 | "step": 60, 411 | "target": "" 412 | } 413 | ], 414 | "thresholds": "80, 90", 415 | "title": "Memory usage", 416 | "type": "singlestat", 417 | "valueFontSize": "80%", 418 | "valueMaps": [ 419 | { 420 | "op": "=", 421 | "text": "N/A", 422 | "value": "null" 423 | } 424 | ], 425 | "valueName": "avg" 426 | } 427 | ], 428 | "repeat": null, 429 | "repeatIteration": null, 430 | "repeatRowId": null, 431 | "showTitle": false, 432 | "title": "New row", 433 | "titleSize": "h6" 434 | }, 435 | { 436 | "collapse": false, 437 | "height": "250px", 438 | "panels": [ 439 | { 440 | "alerting": {}, 441 | "aliasColors": {}, 442 | "bars": false, 443 | "datasource": "${DS_PROMETHEUS}", 444 | "editable": true, 445 | "error": false, 446 | "fill": 1, 447 | "grid": {}, 448 | "id": 6, 449 | "legend": { 450 | "avg": false, 451 | "current": false, 452 | "max": false, 453 | "min": false, 454 | "show": true, 455 | "total": false, 456 | "values": false 457 | }, 458 | "lines": true, 459 | "linewidth": 2, 460 | "links": [], 461 | "nullPointMode": "connected", 462 | "percentage": false, 463 | "pointradius": 5, 464 | "points": false, 465 | "renderer": "flot", 466 | "seriesOverrides": [ 467 | { 468 | "alias": "read", 469 | "yaxis": 1 470 | }, 471 | { 472 | "alias": "{instance=\"172.17.0.1:9100\"}", 473 | "yaxis": 2 474 | }, 475 | { 476 | "alias": "io time", 477 | "yaxis": 2 478 | } 479 | ], 480 | "span": 9, 481 | "stack": false, 482 | "steppedLine": false, 483 | "targets": [ 484 | { 485 | "expr": "sum(rate(node_disk_bytes_read[5m]))", 486 | "hide": false, 487 | "intervalFactor": 4, 488 | "legendFormat": "read", 489 | "refId": "A", 490 | "step": 8, 491 | "target": "" 492 | }, 493 | { 494 | "expr": "sum(rate(node_disk_bytes_written[5m]))", 495 | "intervalFactor": 4, 496 | "legendFormat": "written", 497 | "refId": "B", 498 | "step": 8 499 | }, 500 | { 501 | "expr": "sum(rate(node_disk_io_time_ms[5m]))", 502 | "intervalFactor": 4, 503 | "legendFormat": "io time", 504 | "refId": "C", 505 | "step": 8 506 | } 507 | ], 508 | "thresholds": [], 509 | "timeFrom": null, 510 | "timeShift": null, 511 | "title": "Disk I/O", 512 | "tooltip": { 513 | "msResolution": false, 514 | "shared": true, 515 | "sort": 0, 516 | "value_type": "cumulative" 517 | }, 518 | "type": "graph", 519 | "xaxis": { 520 | "mode": "time", 521 | "name": null, 522 | "show": true, 523 | "values": [] 524 | }, 525 | "yaxes": [ 526 | { 527 | "format": "bytes", 528 | "label": null, 529 | "logBase": 1, 530 | "max": null, 531 | "min": null, 532 | "show": true 533 | }, 534 | { 535 | "format": "ms", 536 | "label": null, 537 | "logBase": 1, 538 | "max": null, 539 | "min": null, 540 | "show": true 541 | } 542 | ] 543 | }, 544 | { 545 | "cacheTimeout": null, 546 | "colorBackground": false, 547 | "colorValue": false, 548 | "colors": [ 549 | "rgba(50, 172, 45, 0.97)", 550 | "rgba(237, 129, 40, 0.89)", 551 | "rgba(245, 54, 54, 0.9)" 552 | ], 553 | "datasource": "${DS_PROMETHEUS}", 554 | "editable": true, 555 | "error": false, 556 | "format": "percentunit", 557 | "gauge": { 558 | "maxValue": 1, 559 | "minValue": 0, 560 | "show": true, 561 | "thresholdLabels": false, 562 | "thresholdMarkers": true 563 | }, 564 | "id": 7, 565 | "interval": null, 566 | "links": [], 567 | "mappingType": 1, 568 | "mappingTypes": [ 569 | { 570 | "name": "value to text", 571 | "value": 1 572 | }, 573 | { 574 | "name": "range to text", 575 | "value": 2 576 | } 577 | ], 578 | "maxDataPoints": 100, 579 | "nullPointMode": "connected", 580 | "nullText": null, 581 | "postfix": "", 582 | "postfixFontSize": "50%", 583 | "prefix": "", 584 | "prefixFontSize": "50%", 585 | "rangeMaps": [ 586 | { 587 | "from": "null", 588 | "text": "N/A", 589 | "to": "null" 590 | } 591 | ], 592 | "span": 3, 593 | "sparkline": { 594 | "fillColor": "rgba(31, 118, 189, 0.18)", 595 | "full": false, 596 | "lineColor": "rgb(31, 120, 193)", 597 | "show": false 598 | }, 599 | "targets": [ 600 | { 601 | "expr": "(sum(node_filesystem_size{device!=\"rootfs\"}) - sum(node_filesystem_free{device!=\"rootfs\"})) / sum(node_filesystem_size{device!=\"rootfs\"})", 602 | "intervalFactor": 2, 603 | "refId": "A", 604 | "step": 60, 605 | "target": "" 606 | } 607 | ], 608 | "thresholds": "0.75, 0.9", 609 | "title": "Disk space usage", 610 | "type": "singlestat", 611 | "valueFontSize": "80%", 612 | "valueMaps": [ 613 | { 614 | "op": "=", 615 | "text": "N/A", 616 | "value": "null" 617 | } 618 | ], 619 | "valueName": "current" 620 | } 621 | ], 622 | "repeat": null, 623 | "repeatIteration": null, 624 | "repeatRowId": null, 625 | "showTitle": false, 626 | "title": "New row", 627 | "titleSize": "h6" 628 | }, 629 | { 630 | "collapse": false, 631 | "height": "250px", 632 | "panels": [ 633 | { 634 | "alerting": {}, 635 | "aliasColors": {}, 636 | "bars": false, 637 | "datasource": "${DS_PROMETHEUS}", 638 | "editable": true, 639 | "error": false, 640 | "fill": 1, 641 | "grid": {}, 642 | "id": 8, 643 | "legend": { 644 | "avg": false, 645 | "current": false, 646 | "max": false, 647 | "min": false, 648 | "show": true, 649 | "total": false, 650 | "values": false 651 | }, 652 | "lines": true, 653 | "linewidth": 2, 654 | "links": [], 655 | "nullPointMode": "connected", 656 | "percentage": false, 657 | "pointradius": 5, 658 | "points": false, 659 | "renderer": "flot", 660 | "seriesOverrides": [ 661 | { 662 | "alias": "transmitted ", 663 | "yaxis": 2 664 | } 665 | ], 666 | "span": 6, 667 | "stack": false, 668 | "steppedLine": false, 669 | "targets": [ 670 | { 671 | "expr": "sum(rate(node_network_receive_bytes{device!~\"lo\"}[5m]))", 672 | "hide": false, 673 | "intervalFactor": 2, 674 | "legendFormat": "", 675 | "refId": "A", 676 | "step": 10, 677 | "target": "" 678 | } 679 | ], 680 | "thresholds": [], 681 | "timeFrom": null, 682 | "timeShift": null, 683 | "title": "Network received", 684 | "tooltip": { 685 | "msResolution": false, 686 | "shared": true, 687 | "sort": 0, 688 | "value_type": "cumulative" 689 | }, 690 | "type": "graph", 691 | "xaxis": { 692 | "mode": "time", 693 | "name": null, 694 | "show": true, 695 | "values": [] 696 | }, 697 | "yaxes": [ 698 | { 699 | "format": "bytes", 700 | "label": null, 701 | "logBase": 1, 702 | "max": null, 703 | "min": null, 704 | "show": true 705 | }, 706 | { 707 | "format": "bytes", 708 | "label": null, 709 | "logBase": 1, 710 | "max": null, 711 | "min": null, 712 | "show": true 713 | } 714 | ] 715 | }, 716 | { 717 | "alerting": {}, 718 | "aliasColors": {}, 719 | "bars": false, 720 | "datasource": "${DS_PROMETHEUS}", 721 | "editable": true, 722 | "error": false, 723 | "fill": 1, 724 | "grid": {}, 725 | "id": 10, 726 | "legend": { 727 | "avg": false, 728 | "current": false, 729 | "max": false, 730 | "min": false, 731 | "show": true, 732 | "total": false, 733 | "values": false 734 | }, 735 | "lines": true, 736 | "linewidth": 2, 737 | "links": [], 738 | "nullPointMode": "connected", 739 | "percentage": false, 740 | "pointradius": 5, 741 | "points": false, 742 | "renderer": "flot", 743 | "seriesOverrides": [ 744 | { 745 | "alias": "transmitted ", 746 | "yaxis": 2 747 | } 748 | ], 749 | "span": 6, 750 | "stack": false, 751 | "steppedLine": false, 752 | "targets": [ 753 | { 754 | "expr": "sum(rate(node_network_transmit_bytes{device!~\"lo\"}[5m]))", 755 | "hide": false, 756 | "intervalFactor": 2, 757 | "legendFormat": "", 758 | "refId": "B", 759 | "step": 10, 760 | "target": "" 761 | } 762 | ], 763 | "thresholds": [], 764 | "timeFrom": null, 765 | "timeShift": null, 766 | "title": "Network transmitted", 767 | "tooltip": { 768 | "msResolution": false, 769 | "shared": true, 770 | "sort": 0, 771 | "value_type": "cumulative" 772 | }, 773 | "type": "graph", 774 | "xaxis": { 775 | "mode": "time", 776 | "name": null, 777 | "show": true, 778 | "values": [] 779 | }, 780 | "yaxes": [ 781 | { 782 | "format": "bytes", 783 | "label": null, 784 | "logBase": 1, 785 | "max": null, 786 | "min": null, 787 | "show": true 788 | }, 789 | { 790 | "format": "bytes", 791 | "label": null, 792 | "logBase": 1, 793 | "max": null, 794 | "min": null, 795 | "show": true 796 | } 797 | ] 798 | } 799 | ], 800 | "repeat": null, 801 | "repeatIteration": null, 802 | "repeatRowId": null, 803 | "showTitle": false, 804 | "title": "New row", 805 | "titleSize": "h6" 806 | } 807 | ], 808 | "schemaVersion": 14, 809 | "style": "dark", 810 | "tags": [ 811 | "prometheus" 812 | ], 813 | "templating": { 814 | "list": [] 815 | }, 816 | "time": { 817 | "from": "now-1h", 818 | "to": "now" 819 | }, 820 | "timepicker": { 821 | "refresh_intervals": [ 822 | "5s", 823 | "10s", 824 | "30s", 825 | "1m", 826 | "5m", 827 | "15m", 828 | "30m", 829 | "1h", 830 | "2h", 831 | "1d" 832 | ], 833 | "time_options": [ 834 | "5m", 835 | "15m", 836 | "1h", 837 | "6h", 838 | "12h", 839 | "24h", 840 | "2d", 841 | "7d", 842 | "30d" 843 | ] 844 | }, 845 | "timezone": "browser", 846 | "title": "All Nodes", 847 | "version": 1 848 | } 849 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/deployment-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "description": "", 5 | "label": "prometheus", 6 | "name": "DS_PROMETHEUS", 7 | "pluginId": "prometheus", 8 | "pluginName": "Prometheus", 9 | "type": "datasource" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "id": "singlestat", 15 | "name": "Singlestat", 16 | "type": "panel", 17 | "version": "" 18 | }, 19 | { 20 | "id": "graph", 21 | "name": "Graph", 22 | "type": "panel", 23 | "version": "" 24 | }, 25 | { 26 | "id": "grafana", 27 | "name": "Grafana", 28 | "type": "grafana", 29 | "version": "3.1.1" 30 | }, 31 | { 32 | "id": "prometheus", 33 | "name": "Prometheus", 34 | "type": "datasource", 35 | "version": "1.0.0" 36 | } 37 | ], 38 | "annotations": { 39 | "list": [] 40 | }, 41 | "editable": true, 42 | "gnetId": null, 43 | "hideControls": false, 44 | "id": null, 45 | "links": [], 46 | "rows": [ 47 | { 48 | "collapse": false, 49 | "editable": true, 50 | "height": "200px", 51 | "panels": [ 52 | { 53 | "cacheTimeout": null, 54 | "colorBackground": false, 55 | "colorValue": false, 56 | "colors": [ 57 | "rgba(245, 54, 54, 0.9)", 58 | "rgba(237, 129, 40, 0.89)", 59 | "rgba(50, 172, 45, 0.97)" 60 | ], 61 | "datasource": "${DS_PROMETHEUS}", 62 | "editable": true, 63 | "error": false, 64 | "format": "none", 65 | "gauge": { 66 | "maxValue": 100, 67 | "minValue": 0, 68 | "show": false, 69 | "thresholdLabels": false, 70 | "thresholdMarkers": true 71 | }, 72 | "id": 8, 73 | "interval": null, 74 | "isNew": true, 75 | "links": [], 76 | "mappingType": 1, 77 | "mappingTypes": [ 78 | { 79 | "name": "value to text", 80 | "value": 1 81 | }, 82 | { 83 | "name": "range to text", 84 | "value": 2 85 | } 86 | ], 87 | "maxDataPoints": 100, 88 | "nullPointMode": "connected", 89 | "nullText": null, 90 | "postfix": "cores", 91 | "postfixFontSize": "50%", 92 | "prefix": "", 93 | "prefixFontSize": "50%", 94 | "rangeMaps": [ 95 | { 96 | "from": "null", 97 | "text": "N/A", 98 | "to": "null" 99 | } 100 | ], 101 | "span": 4, 102 | "sparkline": { 103 | "fillColor": "rgba(31, 118, 189, 0.18)", 104 | "full": false, 105 | "lineColor": "rgb(31, 120, 193)", 106 | "show": true 107 | }, 108 | "targets": [ 109 | { 110 | "expr": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) ", 111 | "intervalFactor": 2, 112 | "refId": "A", 113 | "step": 600 114 | } 115 | ], 116 | "thresholds": "", 117 | "title": "CPU", 118 | "type": "singlestat", 119 | "valueFontSize": "110%", 120 | "valueMaps": [ 121 | { 122 | "op": "=", 123 | "text": "N/A", 124 | "value": "null" 125 | } 126 | ], 127 | "valueName": "avg" 128 | }, 129 | { 130 | "cacheTimeout": null, 131 | "colorBackground": false, 132 | "colorValue": false, 133 | "colors": [ 134 | "rgba(245, 54, 54, 0.9)", 135 | "rgba(237, 129, 40, 0.89)", 136 | "rgba(50, 172, 45, 0.97)" 137 | ], 138 | "datasource": "${DS_PROMETHEUS}", 139 | "editable": true, 140 | "error": false, 141 | "format": "none", 142 | "gauge": { 143 | "maxValue": 100, 144 | "minValue": 0, 145 | "show": false, 146 | "thresholdLabels": false, 147 | "thresholdMarkers": true 148 | }, 149 | "id": 9, 150 | "interval": null, 151 | "isNew": true, 152 | "links": [], 153 | "mappingType": 1, 154 | "mappingTypes": [ 155 | { 156 | "name": "value to text", 157 | "value": 1 158 | }, 159 | { 160 | "name": "range to text", 161 | "value": 2 162 | } 163 | ], 164 | "maxDataPoints": 100, 165 | "nullPointMode": "connected", 166 | "nullText": null, 167 | "postfix": "GB", 168 | "postfixFontSize": "50%", 169 | "prefix": "", 170 | "prefixFontSize": "80%", 171 | "rangeMaps": [ 172 | { 173 | "from": "null", 174 | "text": "N/A", 175 | "to": "null" 176 | } 177 | ], 178 | "span": 4, 179 | "sparkline": { 180 | "fillColor": "rgba(31, 118, 189, 0.18)", 181 | "full": false, 182 | "lineColor": "rgb(31, 120, 193)", 183 | "show": true 184 | }, 185 | "targets": [ 186 | { 187 | "expr": "sum(container_memory_usage_bytes{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}) / 1024^3", 188 | "intervalFactor": 2, 189 | "refId": "A", 190 | "step": 600 191 | } 192 | ], 193 | "thresholds": "", 194 | "title": "Memory", 195 | "type": "singlestat", 196 | "valueFontSize": "110%", 197 | "valueMaps": [ 198 | { 199 | "op": "=", 200 | "text": "N/A", 201 | "value": "null" 202 | } 203 | ], 204 | "valueName": "avg" 205 | }, 206 | { 207 | "cacheTimeout": null, 208 | "colorBackground": false, 209 | "colorValue": false, 210 | "colors": [ 211 | "rgba(245, 54, 54, 0.9)", 212 | "rgba(237, 129, 40, 0.89)", 213 | "rgba(50, 172, 45, 0.97)" 214 | ], 215 | "datasource": "${DS_PROMETHEUS}", 216 | "editable": true, 217 | "error": false, 218 | "format": "Bps", 219 | "gauge": { 220 | "maxValue": 100, 221 | "minValue": 0, 222 | "show": false, 223 | "thresholdLabels": false, 224 | "thresholdMarkers": false 225 | }, 226 | "id": 7, 227 | "interval": null, 228 | "isNew": true, 229 | "links": [], 230 | "mappingType": 1, 231 | "mappingTypes": [ 232 | { 233 | "name": "value to text", 234 | "value": 1 235 | }, 236 | { 237 | "name": "range to text", 238 | "value": 2 239 | } 240 | ], 241 | "maxDataPoints": 100, 242 | "nullPointMode": "connected", 243 | "nullText": null, 244 | "postfix": "", 245 | "postfixFontSize": "50%", 246 | "prefix": "", 247 | "prefixFontSize": "50%", 248 | "rangeMaps": [ 249 | { 250 | "from": "null", 251 | "text": "N/A", 252 | "to": "null" 253 | } 254 | ], 255 | "span": 4, 256 | "sparkline": { 257 | "fillColor": "rgba(31, 118, 189, 0.18)", 258 | "full": false, 259 | "lineColor": "rgb(31, 120, 193)", 260 | "show": true 261 | }, 262 | "targets": [ 263 | { 264 | "expr": "sum(rate(container_network_transmit_bytes_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) + sum(rate(container_network_receive_bytes_total{namespace=\"$deployment_namespace\",pod_name=~\"$deployment_name.*\"}[3m])) ", 265 | "intervalFactor": 2, 266 | "refId": "A", 267 | "step": 600 268 | } 269 | ], 270 | "thresholds": "", 271 | "title": "Network", 272 | "type": "singlestat", 273 | "valueFontSize": "80%", 274 | "valueMaps": [ 275 | { 276 | "op": "=", 277 | "text": "N/A", 278 | "value": "null" 279 | } 280 | ], 281 | "valueName": "avg" 282 | } 283 | ], 284 | "showTitle": false, 285 | "title": "Row" 286 | }, 287 | { 288 | "collapse": false, 289 | "editable": true, 290 | "height": "100px", 291 | "panels": [ 292 | { 293 | "cacheTimeout": null, 294 | "colorBackground": false, 295 | "colorValue": false, 296 | "colors": [ 297 | "rgba(245, 54, 54, 0.9)", 298 | "rgba(237, 129, 40, 0.89)", 299 | "rgba(50, 172, 45, 0.97)" 300 | ], 301 | "datasource": "${DS_PROMETHEUS}", 302 | "decimals": null, 303 | "editable": true, 304 | "error": false, 305 | "format": "none", 306 | "gauge": { 307 | "maxValue": 100, 308 | "minValue": 0, 309 | "show": false, 310 | "thresholdLabels": false, 311 | "thresholdMarkers": false 312 | }, 313 | "id": 5, 314 | "interval": null, 315 | "isNew": true, 316 | "links": [], 317 | "mappingType": 1, 318 | "mappingTypes": [ 319 | { 320 | "name": "value to text", 321 | "value": 1 322 | }, 323 | { 324 | "name": "range to text", 325 | "value": 2 326 | } 327 | ], 328 | "maxDataPoints": 100, 329 | "nullPointMode": "connected", 330 | "nullText": null, 331 | "postfix": "", 332 | "postfixFontSize": "50%", 333 | "prefix": "", 334 | "prefixFontSize": "50%", 335 | "rangeMaps": [ 336 | { 337 | "from": "null", 338 | "text": "N/A", 339 | "to": "null" 340 | } 341 | ], 342 | "span": 3, 343 | "sparkline": { 344 | "fillColor": "rgba(31, 118, 189, 0.18)", 345 | "full": false, 346 | "lineColor": "rgb(31, 120, 193)", 347 | "show": false 348 | }, 349 | "targets": [ 350 | { 351 | "expr": "max(kube_deployment_spec_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 352 | "intervalFactor": 2, 353 | "metric": "kube_deployment_spec_replicas", 354 | "refId": "A", 355 | "step": 600 356 | } 357 | ], 358 | "thresholds": "", 359 | "title": "Desired Replicas", 360 | "type": "singlestat", 361 | "valueFontSize": "80%", 362 | "valueMaps": [ 363 | { 364 | "op": "=", 365 | "text": "N/A", 366 | "value": "null" 367 | } 368 | ], 369 | "valueName": "avg" 370 | }, 371 | { 372 | "cacheTimeout": null, 373 | "colorBackground": false, 374 | "colorValue": false, 375 | "colors": [ 376 | "rgba(245, 54, 54, 0.9)", 377 | "rgba(237, 129, 40, 0.89)", 378 | "rgba(50, 172, 45, 0.97)" 379 | ], 380 | "datasource": "${DS_PROMETHEUS}", 381 | "editable": true, 382 | "error": false, 383 | "format": "none", 384 | "gauge": { 385 | "maxValue": 100, 386 | "minValue": 0, 387 | "show": false, 388 | "thresholdLabels": false, 389 | "thresholdMarkers": true 390 | }, 391 | "id": 6, 392 | "interval": null, 393 | "isNew": true, 394 | "links": [], 395 | "mappingType": 1, 396 | "mappingTypes": [ 397 | { 398 | "name": "value to text", 399 | "value": 1 400 | }, 401 | { 402 | "name": "range to text", 403 | "value": 2 404 | } 405 | ], 406 | "maxDataPoints": 100, 407 | "nullPointMode": "connected", 408 | "nullText": null, 409 | "postfix": "", 410 | "postfixFontSize": "50%", 411 | "prefix": "", 412 | "prefixFontSize": "50%", 413 | "rangeMaps": [ 414 | { 415 | "from": "null", 416 | "text": "N/A", 417 | "to": "null" 418 | } 419 | ], 420 | "span": 3, 421 | "sparkline": { 422 | "fillColor": "rgba(31, 118, 189, 0.18)", 423 | "full": false, 424 | "lineColor": "rgb(31, 120, 193)", 425 | "show": false 426 | }, 427 | "targets": [ 428 | { 429 | "expr": "min(kube_deployment_status_replicas_available{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 430 | "intervalFactor": 2, 431 | "refId": "A", 432 | "step": 600 433 | } 434 | ], 435 | "thresholds": "", 436 | "title": "Available Replicas", 437 | "type": "singlestat", 438 | "valueFontSize": "80%", 439 | "valueMaps": [ 440 | { 441 | "op": "=", 442 | "text": "N/A", 443 | "value": "null" 444 | } 445 | ], 446 | "valueName": "avg" 447 | }, 448 | { 449 | "cacheTimeout": null, 450 | "colorBackground": false, 451 | "colorValue": false, 452 | "colors": [ 453 | "rgba(245, 54, 54, 0.9)", 454 | "rgba(237, 129, 40, 0.89)", 455 | "rgba(50, 172, 45, 0.97)" 456 | ], 457 | "datasource": "${DS_PROMETHEUS}", 458 | "editable": true, 459 | "error": false, 460 | "format": "none", 461 | "gauge": { 462 | "maxValue": 100, 463 | "minValue": 0, 464 | "show": false, 465 | "thresholdLabels": false, 466 | "thresholdMarkers": true 467 | }, 468 | "id": 3, 469 | "interval": null, 470 | "isNew": true, 471 | "links": [], 472 | "mappingType": 1, 473 | "mappingTypes": [ 474 | { 475 | "name": "value to text", 476 | "value": 1 477 | }, 478 | { 479 | "name": "range to text", 480 | "value": 2 481 | } 482 | ], 483 | "maxDataPoints": 100, 484 | "nullPointMode": "connected", 485 | "nullText": null, 486 | "postfix": "", 487 | "postfixFontSize": "50%", 488 | "prefix": "", 489 | "prefixFontSize": "50%", 490 | "rangeMaps": [ 491 | { 492 | "from": "null", 493 | "text": "N/A", 494 | "to": "null" 495 | } 496 | ], 497 | "span": 3, 498 | "sparkline": { 499 | "fillColor": "rgba(31, 118, 189, 0.18)", 500 | "full": false, 501 | "lineColor": "rgb(31, 120, 193)", 502 | "show": false 503 | }, 504 | "targets": [ 505 | { 506 | "expr": "max(kube_deployment_status_observed_generation{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 507 | "intervalFactor": 2, 508 | "legendFormat": "", 509 | "refId": "A", 510 | "step": 600 511 | } 512 | ], 513 | "thresholds": "", 514 | "title": "Observed Generation", 515 | "type": "singlestat", 516 | "valueFontSize": "80%", 517 | "valueMaps": [ 518 | { 519 | "op": "=", 520 | "text": "N/A", 521 | "value": "null" 522 | } 523 | ], 524 | "valueName": "avg" 525 | }, 526 | { 527 | "cacheTimeout": null, 528 | "colorBackground": false, 529 | "colorValue": false, 530 | "colors": [ 531 | "rgba(245, 54, 54, 0.9)", 532 | "rgba(237, 129, 40, 0.89)", 533 | "rgba(50, 172, 45, 0.97)" 534 | ], 535 | "datasource": "${DS_PROMETHEUS}", 536 | "editable": true, 537 | "error": false, 538 | "format": "none", 539 | "gauge": { 540 | "maxValue": 100, 541 | "minValue": 0, 542 | "show": false, 543 | "thresholdLabels": false, 544 | "thresholdMarkers": true 545 | }, 546 | "id": 2, 547 | "interval": null, 548 | "isNew": true, 549 | "links": [], 550 | "mappingType": 1, 551 | "mappingTypes": [ 552 | { 553 | "name": "value to text", 554 | "value": 1 555 | }, 556 | { 557 | "name": "range to text", 558 | "value": 2 559 | } 560 | ], 561 | "maxDataPoints": 100, 562 | "nullPointMode": "connected", 563 | "nullText": null, 564 | "postfix": "", 565 | "postfixFontSize": "50%", 566 | "prefix": "", 567 | "prefixFontSize": "50%", 568 | "rangeMaps": [ 569 | { 570 | "from": "null", 571 | "text": "N/A", 572 | "to": "null" 573 | } 574 | ], 575 | "span": 3, 576 | "sparkline": { 577 | "fillColor": "rgba(31, 118, 189, 0.18)", 578 | "full": false, 579 | "lineColor": "rgb(31, 120, 193)", 580 | "show": false 581 | }, 582 | "targets": [ 583 | { 584 | "expr": "max(kube_deployment_metadata_generation{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 585 | "intervalFactor": 2, 586 | "legendFormat": "", 587 | "refId": "A", 588 | "step": 600 589 | } 590 | ], 591 | "thresholds": "", 592 | "title": "Metadata Generation", 593 | "type": "singlestat", 594 | "valueFontSize": "80%", 595 | "valueMaps": [ 596 | { 597 | "op": "=", 598 | "text": "N/A", 599 | "value": "null" 600 | } 601 | ], 602 | "valueName": "avg" 603 | } 604 | ], 605 | "title": "New row" 606 | }, 607 | { 608 | "collapse": false, 609 | "editable": true, 610 | "height": "350px", 611 | "panels": [ 612 | { 613 | "aliasColors": {}, 614 | "bars": false, 615 | "datasource": "${DS_PROMETHEUS}", 616 | "editable": true, 617 | "error": false, 618 | "fill": 1, 619 | "grid": { 620 | "threshold1": null, 621 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 622 | "threshold2": null, 623 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 624 | }, 625 | "id": 1, 626 | "isNew": true, 627 | "legend": { 628 | "avg": false, 629 | "current": false, 630 | "hideZero": false, 631 | "max": false, 632 | "min": false, 633 | "show": true, 634 | "total": false, 635 | "values": false 636 | }, 637 | "lines": true, 638 | "linewidth": 2, 639 | "links": [], 640 | "nullPointMode": "connected", 641 | "percentage": false, 642 | "pointradius": 5, 643 | "points": false, 644 | "renderer": "flot", 645 | "seriesOverrides": [], 646 | "span": 12, 647 | "stack": false, 648 | "steppedLine": false, 649 | "targets": [ 650 | { 651 | "expr": "max(kube_deployment_status_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 652 | "intervalFactor": 2, 653 | "legendFormat": "current replicas", 654 | "refId": "A", 655 | "step": 30 656 | }, 657 | { 658 | "expr": "min(kube_deployment_status_replicas_available{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 659 | "intervalFactor": 2, 660 | "legendFormat": "available", 661 | "refId": "B", 662 | "step": 30 663 | }, 664 | { 665 | "expr": "max(kube_deployment_status_replicas_unavailable{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 666 | "intervalFactor": 2, 667 | "legendFormat": "unavailable", 668 | "refId": "C", 669 | "step": 30 670 | }, 671 | { 672 | "expr": "min(kube_deployment_status_replicas_updated{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 673 | "intervalFactor": 2, 674 | "legendFormat": "updated", 675 | "refId": "D", 676 | "step": 30 677 | }, 678 | { 679 | "expr": "max(kube_deployment_spec_replicas{deployment=\"$deployment_name\",namespace=\"$deployment_namespace\"}) without (instance, pod)", 680 | "intervalFactor": 2, 681 | "legendFormat": "desired", 682 | "refId": "E", 683 | "step": 30 684 | } 685 | ], 686 | "thresholds": [], 687 | "timeFrom": null, 688 | "timeShift": null, 689 | "title": "Replicas", 690 | "tooltip": { 691 | "msResolution": true, 692 | "shared": true, 693 | "sort": 0, 694 | "value_type": "cumulative" 695 | }, 696 | "transparent": false, 697 | "type": "graph", 698 | "xaxis": { 699 | "mode": "time", 700 | "name": null, 701 | "show": true, 702 | "values": [] 703 | }, 704 | "yaxes": [ 705 | { 706 | "format": "none", 707 | "label": "", 708 | "logBase": 1, 709 | "max": null, 710 | "min": null, 711 | "show": true 712 | }, 713 | { 714 | "format": "short", 715 | "label": null, 716 | "logBase": 1, 717 | "max": null, 718 | "min": null, 719 | "show": false 720 | } 721 | ] 722 | } 723 | ], 724 | "showTitle": false, 725 | "title": "New row" 726 | } 727 | ], 728 | "schemaVersion": 12, 729 | "sharedCrosshair": true, 730 | "style": "dark", 731 | "tags": [], 732 | "templating": { 733 | "list": [ 734 | { 735 | "allValue": ".*", 736 | "current": {}, 737 | "datasource": "${DS_PROMETHEUS}", 738 | "hide": 0, 739 | "includeAll": false, 740 | "label": "Namespace", 741 | "multi": false, 742 | "name": "deployment_namespace", 743 | "options": [], 744 | "query": "label_values(kube_deployment_metadata_generation, namespace)", 745 | "refresh": 1, 746 | "regex": "", 747 | "sort": 0, 748 | "tagValuesQuery": null, 749 | "tagsQuery": "", 750 | "type": "query", 751 | "useTags": false 752 | }, 753 | { 754 | "allValue": null, 755 | "current": {}, 756 | "datasource": "${DS_PROMETHEUS}", 757 | "hide": 0, 758 | "includeAll": false, 759 | "label": "Deployment", 760 | "multi": false, 761 | "name": "deployment_name", 762 | "options": [], 763 | "query": "label_values(kube_deployment_metadata_generation{namespace=\"$deployment_namespace\"}, deployment)", 764 | "refresh": 1, 765 | "regex": "", 766 | "sort": 0, 767 | "tagValuesQuery": "", 768 | "tagsQuery": "deployment", 769 | "type": "query", 770 | "useTags": false 771 | } 772 | ] 773 | }, 774 | "time": { 775 | "from": "now-6h", 776 | "to": "now" 777 | }, 778 | "timepicker": { 779 | "refresh_intervals": [ 780 | "5s", 781 | "10s", 782 | "30s", 783 | "1m", 784 | "5m", 785 | "15m", 786 | "30m", 787 | "1h", 788 | "2h", 789 | "1d" 790 | ], 791 | "time_options": [ 792 | "5m", 793 | "15m", 794 | "1h", 795 | "6h", 796 | "12h", 797 | "24h", 798 | "2d", 799 | "7d", 800 | "30d" 801 | ] 802 | }, 803 | "timezone": "browser", 804 | "title": "Deployment", 805 | "version": 2 806 | } 807 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/kubernetes-pods-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "description": "", 5 | "label": "prometheus", 6 | "name": "DS_PROMETHEUS", 7 | "pluginId": "prometheus", 8 | "pluginName": "Prometheus", 9 | "type": "datasource" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "id": "graph", 15 | "name": "Graph", 16 | "type": "panel", 17 | "version": "" 18 | }, 19 | { 20 | "id": "grafana", 21 | "name": "Grafana", 22 | "type": "grafana", 23 | "version": "3.1.1" 24 | }, 25 | { 26 | "id": "prometheus", 27 | "name": "Prometheus", 28 | "type": "datasource", 29 | "version": "1.0.0" 30 | } 31 | ], 32 | "annotations": { 33 | "list": [] 34 | }, 35 | "editable": true, 36 | "gnetId": null, 37 | "hideControls": false, 38 | "id": null, 39 | "links": [], 40 | "rows": [ 41 | { 42 | "collapse": false, 43 | "editable": true, 44 | "height": "250px", 45 | "panels": [ 46 | { 47 | "aliasColors": {}, 48 | "bars": false, 49 | "datasource": "${DS_PROMETHEUS}", 50 | "editable": true, 51 | "error": false, 52 | "fill": 1, 53 | "grid": { 54 | "threshold1": null, 55 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 56 | "threshold2": null, 57 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 58 | }, 59 | "id": 1, 60 | "isNew": true, 61 | "legend": { 62 | "alignAsTable": true, 63 | "avg": true, 64 | "current": true, 65 | "max": false, 66 | "min": false, 67 | "rightSide": true, 68 | "show": true, 69 | "total": false, 70 | "values": true 71 | }, 72 | "lines": true, 73 | "linewidth": 2, 74 | "links": [], 75 | "nullPointMode": "connected", 76 | "percentage": false, 77 | "pointradius": 5, 78 | "points": false, 79 | "renderer": "flot", 80 | "seriesOverrides": [], 81 | "span": 12, 82 | "stack": false, 83 | "steppedLine": false, 84 | "targets": [ 85 | { 86 | "expr": "sum by(container_name) (container_memory_usage_bytes{pod_name=\"$pod\", container_name=~\"$container\", container_name!=\"POD\"})", 87 | "interval": "10s", 88 | "intervalFactor": 1, 89 | "legendFormat": "Current: {{ container_name }}", 90 | "metric": "container_memory_usage_bytes", 91 | "refId": "A", 92 | "step": 10 93 | }, 94 | { 95 | "expr": "kube_pod_container_resource_requests_memory_bytes{pod=\"$pod\", container=~\"$container\"}", 96 | "interval": "10s", 97 | "intervalFactor": 2, 98 | "legendFormat": "Requested: {{ container }}", 99 | "metric": "kube_pod_container_resource_requests_memory_bytes", 100 | "refId": "B", 101 | "step": 20 102 | } 103 | ], 104 | "timeFrom": null, 105 | "timeShift": null, 106 | "title": "Memory Usage", 107 | "tooltip": { 108 | "msResolution": true, 109 | "shared": true, 110 | "sort": 0, 111 | "value_type": "cumulative" 112 | }, 113 | "type": "graph", 114 | "xaxis": { 115 | "show": true 116 | }, 117 | "yaxes": [ 118 | { 119 | "format": "bytes", 120 | "label": null, 121 | "logBase": 1, 122 | "max": null, 123 | "min": null, 124 | "show": true 125 | }, 126 | { 127 | "format": "short", 128 | "label": null, 129 | "logBase": 1, 130 | "max": null, 131 | "min": null, 132 | "show": true 133 | } 134 | ] 135 | } 136 | ], 137 | "title": "Row" 138 | }, 139 | { 140 | "collapse": false, 141 | "editable": true, 142 | "height": "250px", 143 | "panels": [ 144 | { 145 | "aliasColors": {}, 146 | "bars": false, 147 | "datasource": "${DS_PROMETHEUS}", 148 | "editable": true, 149 | "error": false, 150 | "fill": 1, 151 | "grid": { 152 | "threshold1": null, 153 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 154 | "threshold2": null, 155 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 156 | }, 157 | "id": 2, 158 | "isNew": true, 159 | "legend": { 160 | "alignAsTable": true, 161 | "avg": true, 162 | "current": true, 163 | "max": false, 164 | "min": false, 165 | "rightSide": true, 166 | "show": true, 167 | "total": false, 168 | "values": true 169 | }, 170 | "lines": true, 171 | "linewidth": 2, 172 | "links": [], 173 | "nullPointMode": "connected", 174 | "percentage": false, 175 | "pointradius": 5, 176 | "points": false, 177 | "renderer": "flot", 178 | "seriesOverrides": [], 179 | "span": 12, 180 | "stack": false, 181 | "steppedLine": false, 182 | "targets": [ 183 | { 184 | "expr": "sum by (container_name)( rate(container_cpu_usage_seconds_total{image!=\"\",container_name!=\"POD\",pod_name=\"$pod\"}[1m] ) )", 185 | "intervalFactor": 2, 186 | "legendFormat": "{{ container_name }}", 187 | "refId": "A", 188 | "step": 30 189 | } 190 | ], 191 | "timeFrom": null, 192 | "timeShift": null, 193 | "title": "CPU Usage", 194 | "tooltip": { 195 | "msResolution": true, 196 | "shared": true, 197 | "sort": 0, 198 | "value_type": "cumulative" 199 | }, 200 | "type": "graph", 201 | "xaxis": { 202 | "show": true 203 | }, 204 | "yaxes": [ 205 | { 206 | "format": "short", 207 | "label": null, 208 | "logBase": 1, 209 | "max": null, 210 | "min": null, 211 | "show": true 212 | }, 213 | { 214 | "format": "short", 215 | "label": null, 216 | "logBase": 1, 217 | "max": null, 218 | "min": null, 219 | "show": true 220 | } 221 | ] 222 | } 223 | ], 224 | "title": "New row" 225 | }, 226 | { 227 | "collapse": false, 228 | "editable": true, 229 | "height": "250px", 230 | "panels": [ 231 | { 232 | "aliasColors": {}, 233 | "bars": false, 234 | "datasource": "${DS_PROMETHEUS}", 235 | "editable": true, 236 | "error": false, 237 | "fill": 1, 238 | "grid": { 239 | "threshold1": null, 240 | "threshold1Color": "rgba(216, 200, 27, 0.27)", 241 | "threshold2": null, 242 | "threshold2Color": "rgba(234, 112, 112, 0.22)" 243 | }, 244 | "id": 3, 245 | "isNew": true, 246 | "legend": { 247 | "alignAsTable": true, 248 | "avg": true, 249 | "current": true, 250 | "max": false, 251 | "min": false, 252 | "rightSide": true, 253 | "show": true, 254 | "total": false, 255 | "values": true 256 | }, 257 | "lines": true, 258 | "linewidth": 2, 259 | "links": [], 260 | "nullPointMode": "connected", 261 | "percentage": false, 262 | "pointradius": 5, 263 | "points": false, 264 | "renderer": "flot", 265 | "seriesOverrides": [], 266 | "span": 12, 267 | "stack": false, 268 | "steppedLine": false, 269 | "targets": [ 270 | { 271 | "expr": "sort_desc(sum by (pod_name) (rate (container_network_receive_bytes_total{pod_name=\"$pod\"}[1m]) ))", 272 | "intervalFactor": 2, 273 | "legendFormat": "{{ pod_name }}", 274 | "refId": "A", 275 | "step": 30 276 | } 277 | ], 278 | "timeFrom": null, 279 | "timeShift": null, 280 | "title": "Network I/O", 281 | "tooltip": { 282 | "msResolution": true, 283 | "shared": true, 284 | "sort": 0, 285 | "value_type": "cumulative" 286 | }, 287 | "type": "graph", 288 | "xaxis": { 289 | "show": true 290 | }, 291 | "yaxes": [ 292 | { 293 | "format": "bytes", 294 | "label": null, 295 | "logBase": 1, 296 | "max": null, 297 | "min": null, 298 | "show": true 299 | }, 300 | { 301 | "format": "short", 302 | "label": null, 303 | "logBase": 1, 304 | "max": null, 305 | "min": null, 306 | "show": true 307 | } 308 | ] 309 | } 310 | ], 311 | "title": "New row" 312 | } 313 | ], 314 | "schemaVersion": 12, 315 | "sharedCrosshair": true, 316 | "style": "dark", 317 | "tags": [], 318 | "templating": { 319 | "list": [ 320 | { 321 | "allValue": ".*", 322 | "current": {}, 323 | "datasource": "${DS_PROMETHEUS}", 324 | "hide": 0, 325 | "includeAll": true, 326 | "label": "Namespace", 327 | "multi": false, 328 | "name": "namespace", 329 | "options": [], 330 | "query": "label_values(kube_pod_info, namespace)", 331 | "refresh": 1, 332 | "regex": "", 333 | "type": "query" 334 | }, 335 | { 336 | "current": {}, 337 | "datasource": "${DS_PROMETHEUS}", 338 | "hide": 0, 339 | "includeAll": false, 340 | "label": "Pod", 341 | "multi": false, 342 | "name": "pod", 343 | "options": [], 344 | "query": "label_values(kube_pod_info{namespace=~\"$namespace\"}, pod)", 345 | "refresh": 1, 346 | "regex": "", 347 | "type": "query" 348 | }, 349 | { 350 | "allValue": ".*", 351 | "current": {}, 352 | "datasource": "${DS_PROMETHEUS}", 353 | "hide": 0, 354 | "includeAll": true, 355 | "label": "Container", 356 | "multi": false, 357 | "name": "container", 358 | "options": [], 359 | "query": "label_values(kube_pod_container_info{namespace=\"$namespace\", pod=\"$pod\"}, container)", 360 | "refresh": 1, 361 | "regex": "", 362 | "type": "query" 363 | } 364 | ] 365 | }, 366 | "time": { 367 | "from": "now-6h", 368 | "to": "now" 369 | }, 370 | "timepicker": { 371 | "refresh_intervals": [ 372 | "5s", 373 | "10s", 374 | "30s", 375 | "1m", 376 | "5m", 377 | "15m", 378 | "30m", 379 | "1h", 380 | "2h", 381 | "1d" 382 | ], 383 | "time_options": [ 384 | "5m", 385 | "15m", 386 | "1h", 387 | "6h", 388 | "12h", 389 | "24h", 390 | "2d", 391 | "7d", 392 | "30d" 393 | ] 394 | }, 395 | "timezone": "browser", 396 | "title": "Pods", 397 | "version": 26 398 | } 399 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/node-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "description": "", 5 | "label": "prometheus", 6 | "name": "DS_PROMETHEUS", 7 | "pluginId": "prometheus", 8 | "pluginName": "Prometheus", 9 | "type": "datasource" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "id": "grafana", 15 | "name": "Grafana", 16 | "type": "grafana", 17 | "version": "4.1.1" 18 | }, 19 | { 20 | "id": "graph", 21 | "name": "Graph", 22 | "type": "panel", 23 | "version": "" 24 | }, 25 | { 26 | "id": "prometheus", 27 | "name": "Prometheus", 28 | "type": "datasource", 29 | "version": "1.0.0" 30 | }, 31 | { 32 | "id": "singlestat", 33 | "name": "Singlestat", 34 | "type": "panel", 35 | "version": "" 36 | } 37 | ], 38 | "annotations": { 39 | "list": [] 40 | }, 41 | "description": "Dashboard to get an overview of one server", 42 | "editable": true, 43 | "gnetId": 22, 44 | "graphTooltip": 0, 45 | "hideControls": false, 46 | "id": null, 47 | "links": [], 48 | "refresh": false, 49 | "rows": [ 50 | { 51 | "collapse": false, 52 | "height": "250px", 53 | "panels": [ 54 | { 55 | "alerting": {}, 56 | "aliasColors": {}, 57 | "bars": false, 58 | "datasource": "${DS_PROMETHEUS}", 59 | "editable": true, 60 | "error": false, 61 | "fill": 1, 62 | "grid": {}, 63 | "id": 3, 64 | "legend": { 65 | "avg": false, 66 | "current": false, 67 | "max": false, 68 | "min": false, 69 | "show": true, 70 | "total": false, 71 | "values": false 72 | }, 73 | "lines": true, 74 | "linewidth": 2, 75 | "links": [], 76 | "nullPointMode": "connected", 77 | "percentage": false, 78 | "pointradius": 5, 79 | "points": false, 80 | "renderer": "flot", 81 | "seriesOverrides": [], 82 | "span": 6, 83 | "stack": false, 84 | "steppedLine": false, 85 | "targets": [ 86 | { 87 | "expr": "100 - (avg by (cpu) (irate(node_cpu{mode=\"idle\", instance=\"$server\"}[5m])) * 100)", 88 | "hide": false, 89 | "intervalFactor": 10, 90 | "legendFormat": "{{cpu}}", 91 | "refId": "A", 92 | "step": 50 93 | } 94 | ], 95 | "thresholds": [], 96 | "timeFrom": null, 97 | "timeShift": null, 98 | "title": "Idle cpu", 99 | "tooltip": { 100 | "msResolution": false, 101 | "shared": true, 102 | "sort": 0, 103 | "value_type": "cumulative" 104 | }, 105 | "type": "graph", 106 | "xaxis": { 107 | "mode": "time", 108 | "name": null, 109 | "show": true, 110 | "values": [] 111 | }, 112 | "yaxes": [ 113 | { 114 | "format": "percent", 115 | "label": "cpu usage", 116 | "logBase": 1, 117 | "max": 100, 118 | "min": 0, 119 | "show": true 120 | }, 121 | { 122 | "format": "short", 123 | "label": null, 124 | "logBase": 1, 125 | "max": null, 126 | "min": null, 127 | "show": true 128 | } 129 | ] 130 | }, 131 | { 132 | "alerting": {}, 133 | "aliasColors": {}, 134 | "bars": false, 135 | "datasource": "${DS_PROMETHEUS}", 136 | "editable": true, 137 | "error": false, 138 | "fill": 1, 139 | "grid": {}, 140 | "id": 9, 141 | "legend": { 142 | "avg": false, 143 | "current": false, 144 | "max": false, 145 | "min": false, 146 | "show": true, 147 | "total": false, 148 | "values": false 149 | }, 150 | "lines": true, 151 | "linewidth": 2, 152 | "links": [], 153 | "nullPointMode": "connected", 154 | "percentage": false, 155 | "pointradius": 5, 156 | "points": false, 157 | "renderer": "flot", 158 | "seriesOverrides": [], 159 | "span": 6, 160 | "stack": false, 161 | "steppedLine": false, 162 | "targets": [ 163 | { 164 | "expr": "node_load1{instance=\"$server\"}", 165 | "intervalFactor": 4, 166 | "legendFormat": "load 1m", 167 | "refId": "A", 168 | "step": 20, 169 | "target": "" 170 | }, 171 | { 172 | "expr": "node_load5{instance=\"$server\"}", 173 | "intervalFactor": 4, 174 | "legendFormat": "load 5m", 175 | "refId": "B", 176 | "step": 20, 177 | "target": "" 178 | }, 179 | { 180 | "expr": "node_load15{instance=\"$server\"}", 181 | "intervalFactor": 4, 182 | "legendFormat": "load 15m", 183 | "refId": "C", 184 | "step": 20, 185 | "target": "" 186 | } 187 | ], 188 | "thresholds": [], 189 | "timeFrom": null, 190 | "timeShift": null, 191 | "title": "System load", 192 | "tooltip": { 193 | "msResolution": false, 194 | "shared": true, 195 | "sort": 0, 196 | "value_type": "cumulative" 197 | }, 198 | "type": "graph", 199 | "xaxis": { 200 | "mode": "time", 201 | "name": null, 202 | "show": true, 203 | "values": [] 204 | }, 205 | "yaxes": [ 206 | { 207 | "format": "percentunit", 208 | "label": null, 209 | "logBase": 1, 210 | "max": null, 211 | "min": null, 212 | "show": true 213 | }, 214 | { 215 | "format": "short", 216 | "label": null, 217 | "logBase": 1, 218 | "max": null, 219 | "min": null, 220 | "show": true 221 | } 222 | ] 223 | } 224 | ], 225 | "repeat": null, 226 | "repeatIteration": null, 227 | "repeatRowId": null, 228 | "showTitle": false, 229 | "title": "New row", 230 | "titleSize": "h6" 231 | }, 232 | { 233 | "collapse": false, 234 | "height": "250px", 235 | "panels": [ 236 | { 237 | "alerting": {}, 238 | "aliasColors": {}, 239 | "bars": false, 240 | "datasource": "${DS_PROMETHEUS}", 241 | "editable": true, 242 | "error": false, 243 | "fill": 1, 244 | "grid": {}, 245 | "id": 4, 246 | "legend": { 247 | "alignAsTable": false, 248 | "avg": false, 249 | "current": false, 250 | "hideEmpty": false, 251 | "hideZero": false, 252 | "max": false, 253 | "min": false, 254 | "rightSide": false, 255 | "show": true, 256 | "total": false, 257 | "values": false 258 | }, 259 | "lines": true, 260 | "linewidth": 2, 261 | "links": [], 262 | "nullPointMode": "connected", 263 | "percentage": false, 264 | "pointradius": 5, 265 | "points": false, 266 | "renderer": "flot", 267 | "seriesOverrides": [ 268 | { 269 | "alias": "node_memory_SwapFree{instance=\"172.17.0.1:9100\",job=\"prometheus\"}", 270 | "yaxis": 2 271 | } 272 | ], 273 | "span": 9, 274 | "stack": true, 275 | "steppedLine": false, 276 | "targets": [ 277 | { 278 | "expr": "node_memory_MemTotal{instance=\"$server\"} - node_memory_MemFree{instance=\"$server\"} - node_memory_Buffers{instance=\"$server\"} - node_memory_Cached{instance=\"$server\"}", 279 | "hide": false, 280 | "interval": "", 281 | "intervalFactor": 2, 282 | "legendFormat": "memory used", 283 | "metric": "", 284 | "refId": "C", 285 | "step": 4 286 | }, 287 | { 288 | "expr": "node_memory_Buffers{instance=\"$server\"}", 289 | "interval": "", 290 | "intervalFactor": 2, 291 | "legendFormat": "memory buffers", 292 | "metric": "", 293 | "refId": "E", 294 | "step": 4 295 | }, 296 | { 297 | "expr": "node_memory_Cached{instance=\"$server\"}", 298 | "intervalFactor": 2, 299 | "legendFormat": "memory cached", 300 | "metric": "", 301 | "refId": "F", 302 | "step": 4 303 | }, 304 | { 305 | "expr": "node_memory_MemFree{instance=\"$server\"}", 306 | "intervalFactor": 2, 307 | "legendFormat": "memory free", 308 | "metric": "", 309 | "refId": "D", 310 | "step": 4 311 | } 312 | ], 313 | "thresholds": [], 314 | "timeFrom": null, 315 | "timeShift": null, 316 | "title": "Memory usage", 317 | "tooltip": { 318 | "msResolution": false, 319 | "shared": true, 320 | "sort": 0, 321 | "value_type": "individual" 322 | }, 323 | "type": "graph", 324 | "xaxis": { 325 | "mode": "time", 326 | "name": null, 327 | "show": true, 328 | "values": [] 329 | }, 330 | "yaxes": [ 331 | { 332 | "format": "bytes", 333 | "label": null, 334 | "logBase": 1, 335 | "max": null, 336 | "min": "0", 337 | "show": true 338 | }, 339 | { 340 | "format": "short", 341 | "label": null, 342 | "logBase": 1, 343 | "max": null, 344 | "min": null, 345 | "show": true 346 | } 347 | ] 348 | }, 349 | { 350 | "cacheTimeout": null, 351 | "colorBackground": false, 352 | "colorValue": false, 353 | "colors": [ 354 | "rgba(50, 172, 45, 0.97)", 355 | "rgba(237, 129, 40, 0.89)", 356 | "rgba(245, 54, 54, 0.9)" 357 | ], 358 | "datasource": "${DS_PROMETHEUS}", 359 | "editable": true, 360 | "error": false, 361 | "format": "percent", 362 | "gauge": { 363 | "maxValue": 100, 364 | "minValue": 0, 365 | "show": true, 366 | "thresholdLabels": false, 367 | "thresholdMarkers": true 368 | }, 369 | "id": 5, 370 | "interval": null, 371 | "links": [], 372 | "mappingType": 1, 373 | "mappingTypes": [ 374 | { 375 | "name": "value to text", 376 | "value": 1 377 | }, 378 | { 379 | "name": "range to text", 380 | "value": 2 381 | } 382 | ], 383 | "maxDataPoints": 100, 384 | "nullPointMode": "connected", 385 | "nullText": null, 386 | "postfix": "", 387 | "postfixFontSize": "50%", 388 | "prefix": "", 389 | "prefixFontSize": "50%", 390 | "rangeMaps": [ 391 | { 392 | "from": "null", 393 | "text": "N/A", 394 | "to": "null" 395 | } 396 | ], 397 | "span": 3, 398 | "sparkline": { 399 | "fillColor": "rgba(31, 118, 189, 0.18)", 400 | "full": false, 401 | "lineColor": "rgb(31, 120, 193)", 402 | "show": false 403 | }, 404 | "targets": [ 405 | { 406 | "expr": "((node_memory_MemTotal{instance=\"$server\"} - node_memory_MemFree{instance=\"$server\"} - node_memory_Buffers{instance=\"$server\"} - node_memory_Cached{instance=\"$server\"}) / node_memory_MemTotal{instance=\"$server\"}) * 100", 407 | "intervalFactor": 2, 408 | "refId": "A", 409 | "step": 60, 410 | "target": "" 411 | } 412 | ], 413 | "thresholds": "80, 90", 414 | "title": "Memory usage", 415 | "type": "singlestat", 416 | "valueFontSize": "80%", 417 | "valueMaps": [ 418 | { 419 | "op": "=", 420 | "text": "N/A", 421 | "value": "null" 422 | } 423 | ], 424 | "valueName": "avg" 425 | } 426 | ], 427 | "repeat": null, 428 | "repeatIteration": null, 429 | "repeatRowId": null, 430 | "showTitle": false, 431 | "title": "New row", 432 | "titleSize": "h6" 433 | }, 434 | { 435 | "collapse": false, 436 | "height": "250px", 437 | "panels": [ 438 | { 439 | "alerting": {}, 440 | "aliasColors": {}, 441 | "bars": false, 442 | "datasource": "${DS_PROMETHEUS}", 443 | "editable": true, 444 | "error": false, 445 | "fill": 1, 446 | "grid": {}, 447 | "id": 6, 448 | "legend": { 449 | "avg": false, 450 | "current": false, 451 | "max": false, 452 | "min": false, 453 | "show": true, 454 | "total": false, 455 | "values": false 456 | }, 457 | "lines": true, 458 | "linewidth": 2, 459 | "links": [], 460 | "nullPointMode": "connected", 461 | "percentage": false, 462 | "pointradius": 5, 463 | "points": false, 464 | "renderer": "flot", 465 | "seriesOverrides": [ 466 | { 467 | "alias": "read", 468 | "yaxis": 1 469 | }, 470 | { 471 | "alias": "{instance=\"172.17.0.1:9100\"}", 472 | "yaxis": 2 473 | }, 474 | { 475 | "alias": "io time", 476 | "yaxis": 2 477 | } 478 | ], 479 | "span": 9, 480 | "stack": false, 481 | "steppedLine": false, 482 | "targets": [ 483 | { 484 | "expr": "sum by (instance) (rate(node_disk_bytes_read{instance=\"$server\"}[2m]))", 485 | "hide": false, 486 | "intervalFactor": 4, 487 | "legendFormat": "read", 488 | "refId": "A", 489 | "step": 8, 490 | "target": "" 491 | }, 492 | { 493 | "expr": "sum by (instance) (rate(node_disk_bytes_written{instance=\"$server\"}[2m]))", 494 | "intervalFactor": 4, 495 | "legendFormat": "written", 496 | "refId": "B", 497 | "step": 8 498 | }, 499 | { 500 | "expr": "sum by (instance) (rate(node_disk_io_time_ms{instance=\"$server\"}[2m]))", 501 | "intervalFactor": 4, 502 | "legendFormat": "io time", 503 | "refId": "C", 504 | "step": 8 505 | } 506 | ], 507 | "thresholds": [], 508 | "timeFrom": null, 509 | "timeShift": null, 510 | "title": "Disk I/O", 511 | "tooltip": { 512 | "msResolution": false, 513 | "shared": true, 514 | "sort": 0, 515 | "value_type": "cumulative" 516 | }, 517 | "type": "graph", 518 | "xaxis": { 519 | "mode": "time", 520 | "name": null, 521 | "show": true, 522 | "values": [] 523 | }, 524 | "yaxes": [ 525 | { 526 | "format": "bytes", 527 | "label": null, 528 | "logBase": 1, 529 | "max": null, 530 | "min": null, 531 | "show": true 532 | }, 533 | { 534 | "format": "ms", 535 | "label": null, 536 | "logBase": 1, 537 | "max": null, 538 | "min": null, 539 | "show": true 540 | } 541 | ] 542 | }, 543 | { 544 | "cacheTimeout": null, 545 | "colorBackground": false, 546 | "colorValue": false, 547 | "colors": [ 548 | "rgba(50, 172, 45, 0.97)", 549 | "rgba(237, 129, 40, 0.89)", 550 | "rgba(245, 54, 54, 0.9)" 551 | ], 552 | "datasource": "${DS_PROMETHEUS}", 553 | "editable": true, 554 | "error": false, 555 | "format": "percentunit", 556 | "gauge": { 557 | "maxValue": 1, 558 | "minValue": 0, 559 | "show": true, 560 | "thresholdLabels": false, 561 | "thresholdMarkers": true 562 | }, 563 | "id": 7, 564 | "interval": null, 565 | "links": [], 566 | "mappingType": 1, 567 | "mappingTypes": [ 568 | { 569 | "name": "value to text", 570 | "value": 1 571 | }, 572 | { 573 | "name": "range to text", 574 | "value": 2 575 | } 576 | ], 577 | "maxDataPoints": 100, 578 | "nullPointMode": "connected", 579 | "nullText": null, 580 | "postfix": "", 581 | "postfixFontSize": "50%", 582 | "prefix": "", 583 | "prefixFontSize": "50%", 584 | "rangeMaps": [ 585 | { 586 | "from": "null", 587 | "text": "N/A", 588 | "to": "null" 589 | } 590 | ], 591 | "span": 3, 592 | "sparkline": { 593 | "fillColor": "rgba(31, 118, 189, 0.18)", 594 | "full": false, 595 | "lineColor": "rgb(31, 120, 193)", 596 | "show": false 597 | }, 598 | "targets": [ 599 | { 600 | "expr": "(sum(node_filesystem_size{device!=\"rootfs\",instance=\"$server\"}) - sum(node_filesystem_free{device!=\"rootfs\",instance=\"$server\"})) / sum(node_filesystem_size{device!=\"rootfs\",instance=\"$server\"})", 601 | "intervalFactor": 2, 602 | "refId": "A", 603 | "step": 60, 604 | "target": "" 605 | } 606 | ], 607 | "thresholds": "0.75, 0.9", 608 | "title": "Disk space usage", 609 | "type": "singlestat", 610 | "valueFontSize": "80%", 611 | "valueMaps": [ 612 | { 613 | "op": "=", 614 | "text": "N/A", 615 | "value": "null" 616 | } 617 | ], 618 | "valueName": "current" 619 | } 620 | ], 621 | "repeat": null, 622 | "repeatIteration": null, 623 | "repeatRowId": null, 624 | "showTitle": false, 625 | "title": "New row", 626 | "titleSize": "h6" 627 | }, 628 | { 629 | "collapse": false, 630 | "height": "250px", 631 | "panels": [ 632 | { 633 | "alerting": {}, 634 | "aliasColors": {}, 635 | "bars": false, 636 | "datasource": "${DS_PROMETHEUS}", 637 | "editable": true, 638 | "error": false, 639 | "fill": 1, 640 | "grid": {}, 641 | "id": 8, 642 | "legend": { 643 | "avg": false, 644 | "current": false, 645 | "max": false, 646 | "min": false, 647 | "show": true, 648 | "total": false, 649 | "values": false 650 | }, 651 | "lines": true, 652 | "linewidth": 2, 653 | "links": [], 654 | "nullPointMode": "connected", 655 | "percentage": false, 656 | "pointradius": 5, 657 | "points": false, 658 | "renderer": "flot", 659 | "seriesOverrides": [ 660 | { 661 | "alias": "transmitted ", 662 | "yaxis": 2 663 | } 664 | ], 665 | "span": 6, 666 | "stack": false, 667 | "steppedLine": false, 668 | "targets": [ 669 | { 670 | "expr": "rate(node_network_receive_bytes{instance=\"$server\",device!~\"lo\"}[5m])", 671 | "hide": false, 672 | "intervalFactor": 2, 673 | "legendFormat": "{{device}}", 674 | "refId": "A", 675 | "step": 10, 676 | "target": "" 677 | } 678 | ], 679 | "thresholds": [], 680 | "timeFrom": null, 681 | "timeShift": null, 682 | "title": "Network received", 683 | "tooltip": { 684 | "msResolution": false, 685 | "shared": true, 686 | "sort": 0, 687 | "value_type": "cumulative" 688 | }, 689 | "type": "graph", 690 | "xaxis": { 691 | "mode": "time", 692 | "name": null, 693 | "show": true, 694 | "values": [] 695 | }, 696 | "yaxes": [ 697 | { 698 | "format": "bytes", 699 | "label": null, 700 | "logBase": 1, 701 | "max": null, 702 | "min": null, 703 | "show": true 704 | }, 705 | { 706 | "format": "bytes", 707 | "label": null, 708 | "logBase": 1, 709 | "max": null, 710 | "min": null, 711 | "show": true 712 | } 713 | ] 714 | }, 715 | { 716 | "alerting": {}, 717 | "aliasColors": {}, 718 | "bars": false, 719 | "datasource": "${DS_PROMETHEUS}", 720 | "editable": true, 721 | "error": false, 722 | "fill": 1, 723 | "grid": {}, 724 | "id": 10, 725 | "legend": { 726 | "avg": false, 727 | "current": false, 728 | "max": false, 729 | "min": false, 730 | "show": true, 731 | "total": false, 732 | "values": false 733 | }, 734 | "lines": true, 735 | "linewidth": 2, 736 | "links": [], 737 | "nullPointMode": "connected", 738 | "percentage": false, 739 | "pointradius": 5, 740 | "points": false, 741 | "renderer": "flot", 742 | "seriesOverrides": [ 743 | { 744 | "alias": "transmitted ", 745 | "yaxis": 2 746 | } 747 | ], 748 | "span": 6, 749 | "stack": false, 750 | "steppedLine": false, 751 | "targets": [ 752 | { 753 | "expr": "rate(node_network_transmit_bytes{instance=\"$server\",device!~\"lo\"}[5m])", 754 | "hide": false, 755 | "intervalFactor": 2, 756 | "legendFormat": "{{device}}", 757 | "refId": "B", 758 | "step": 10, 759 | "target": "" 760 | } 761 | ], 762 | "thresholds": [], 763 | "timeFrom": null, 764 | "timeShift": null, 765 | "title": "Network transmitted", 766 | "tooltip": { 767 | "msResolution": false, 768 | "shared": true, 769 | "sort": 0, 770 | "value_type": "cumulative" 771 | }, 772 | "type": "graph", 773 | "xaxis": { 774 | "mode": "time", 775 | "name": null, 776 | "show": true, 777 | "values": [] 778 | }, 779 | "yaxes": [ 780 | { 781 | "format": "bytes", 782 | "label": null, 783 | "logBase": 1, 784 | "max": null, 785 | "min": null, 786 | "show": true 787 | }, 788 | { 789 | "format": "bytes", 790 | "label": null, 791 | "logBase": 1, 792 | "max": null, 793 | "min": null, 794 | "show": true 795 | } 796 | ] 797 | } 798 | ], 799 | "repeat": null, 800 | "repeatIteration": null, 801 | "repeatRowId": null, 802 | "showTitle": false, 803 | "title": "New row", 804 | "titleSize": "h6" 805 | } 806 | ], 807 | "schemaVersion": 14, 808 | "style": "dark", 809 | "tags": [ 810 | "prometheus" 811 | ], 812 | "templating": { 813 | "list": [ 814 | { 815 | "allValue": null, 816 | "current": {}, 817 | "datasource": "${DS_PROMETHEUS}", 818 | "hide": 0, 819 | "includeAll": false, 820 | "label": null, 821 | "multi": false, 822 | "name": "server", 823 | "options": [], 824 | "query": "label_values(node_boot_time, instance)", 825 | "refresh": 1, 826 | "regex": "", 827 | "sort": 0, 828 | "tagValuesQuery": "", 829 | "tags": [], 830 | "tagsQuery": "", 831 | "type": "query", 832 | "useTags": false 833 | } 834 | ] 835 | }, 836 | "time": { 837 | "from": "now-1h", 838 | "to": "now" 839 | }, 840 | "timepicker": { 841 | "refresh_intervals": [ 842 | "5s", 843 | "10s", 844 | "30s", 845 | "1m", 846 | "5m", 847 | "15m", 848 | "30m", 849 | "1h", 850 | "2h", 851 | "1d" 852 | ], 853 | "time_options": [ 854 | "5m", 855 | "15m", 856 | "1h", 857 | "6h", 858 | "12h", 859 | "24h", 860 | "2d", 861 | "7d", 862 | "30d" 863 | ] 864 | }, 865 | "timezone": "browser", 866 | "title": "Nodes", 867 | "version": 1 868 | } 869 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/prometheus-datasource.json: -------------------------------------------------------------------------------- 1 | { 2 | "access": "proxy", 3 | "basicAuth": false, 4 | "name": "prometheus", 5 | "type": "prometheus", 6 | "url": "http://prometheus-k8s.monitoring.svc:9090" 7 | } 8 | -------------------------------------------------------------------------------- /templates/grafana-dashboards/resource-requests-dashboard.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "description": "", 5 | "label": "prometheus", 6 | "name": "DS_PROMETHEUS", 7 | "pluginId": "prometheus", 8 | "pluginName": "Prometheus", 9 | "type": "datasource" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "id": "grafana", 15 | "name": "Grafana", 16 | "type": "grafana", 17 | "version": "4.1.1" 18 | }, 19 | { 20 | "id": "graph", 21 | "name": "Graph", 22 | "type": "panel", 23 | "version": "" 24 | }, 25 | { 26 | "id": "prometheus", 27 | "name": "Prometheus", 28 | "type": "datasource", 29 | "version": "1.0.0" 30 | }, 31 | { 32 | "id": "singlestat", 33 | "name": "Singlestat", 34 | "type": "panel", 35 | "version": "" 36 | } 37 | ], 38 | "annotations": { 39 | "list": [] 40 | }, 41 | "description": "Dashboard to show the resource requests vs allocatable in the cluster", 42 | "editable": true, 43 | "gnetId": null, 44 | "graphTooltip": 0, 45 | "hideControls": false, 46 | "id": null, 47 | "links": [], 48 | "rows": [ 49 | { 50 | "collapse": false, 51 | "height": "300", 52 | "panels": [ 53 | { 54 | "aliasColors": {}, 55 | "bars": false, 56 | "datasource": "${DS_PROMETHEUS}", 57 | "description": "This represents the total [CPU resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-cpu) in the cluster.\nFor comparison the total [allocatable CPU cores](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.", 58 | "fill": 1, 59 | "id": 1, 60 | "legend": { 61 | "avg": false, 62 | "current": false, 63 | "max": false, 64 | "min": false, 65 | "show": true, 66 | "total": false, 67 | "values": false 68 | }, 69 | "lines": true, 70 | "linewidth": 1, 71 | "links": [], 72 | "nullPointMode": "null", 73 | "percentage": false, 74 | "pointradius": 5, 75 | "points": false, 76 | "renderer": "flot", 77 | "seriesOverrides": [], 78 | "span": 9, 79 | "stack": false, 80 | "steppedLine": false, 81 | "targets": [ 82 | { 83 | "expr": "min(sum(kube_node_status_allocatable_cpu_cores) by (instance))", 84 | "hide": false, 85 | "intervalFactor": 2, 86 | "legendFormat": "Allocatable CPU Cores", 87 | "refId": "A", 88 | "step": 10 89 | }, 90 | { 91 | "expr": "max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance))", 92 | "intervalFactor": 2, 93 | "legendFormat": "Requested CPU Cores", 94 | "refId": "B", 95 | "step": 10 96 | } 97 | ], 98 | "thresholds": [], 99 | "timeFrom": null, 100 | "timeShift": null, 101 | "title": "CPU Cores", 102 | "tooltip": { 103 | "shared": true, 104 | "sort": 0, 105 | "value_type": "individual" 106 | }, 107 | "type": "graph", 108 | "xaxis": { 109 | "mode": "time", 110 | "name": null, 111 | "show": true, 112 | "values": [] 113 | }, 114 | "yaxes": [ 115 | { 116 | "format": "short", 117 | "label": "CPU Cores", 118 | "logBase": 1, 119 | "max": null, 120 | "min": null, 121 | "show": true 122 | }, 123 | { 124 | "format": "short", 125 | "label": null, 126 | "logBase": 1, 127 | "max": null, 128 | "min": null, 129 | "show": true 130 | } 131 | ] 132 | }, 133 | { 134 | "cacheTimeout": null, 135 | "colorBackground": false, 136 | "colorValue": false, 137 | "colors": [ 138 | "rgba(50, 172, 45, 0.97)", 139 | "rgba(237, 129, 40, 0.89)", 140 | "rgba(245, 54, 54, 0.9)" 141 | ], 142 | "datasource": "${DS_PROMETHEUS}", 143 | "decimals": null, 144 | "format": "percent", 145 | "gauge": { 146 | "maxValue": 100, 147 | "minValue": 0, 148 | "show": true, 149 | "thresholdLabels": false, 150 | "thresholdMarkers": true 151 | }, 152 | "id": 2, 153 | "interval": null, 154 | "links": [], 155 | "mappingType": 1, 156 | "mappingTypes": [ 157 | { 158 | "name": "value to text", 159 | "value": 1 160 | }, 161 | { 162 | "name": "range to text", 163 | "value": 2 164 | } 165 | ], 166 | "maxDataPoints": 100, 167 | "nullPointMode": "connected", 168 | "nullText": null, 169 | "postfix": "", 170 | "postfixFontSize": "50%", 171 | "prefix": "", 172 | "prefixFontSize": "50%", 173 | "rangeMaps": [ 174 | { 175 | "from": "null", 176 | "text": "N/A", 177 | "to": "null" 178 | } 179 | ], 180 | "span": 3, 181 | "sparkline": { 182 | "fillColor": "rgba(31, 118, 189, 0.18)", 183 | "full": false, 184 | "lineColor": "rgb(31, 120, 193)", 185 | "show": true 186 | }, 187 | "targets": [ 188 | { 189 | "expr": "max(sum(kube_pod_container_resource_requests_cpu_cores) by (instance)) / min(sum(kube_node_status_allocatable_cpu_cores) by (instance)) * 100", 190 | "intervalFactor": 2, 191 | "legendFormat": "", 192 | "refId": "A", 193 | "step": 240 194 | } 195 | ], 196 | "thresholds": "80, 90", 197 | "title": "CPU Cores", 198 | "type": "singlestat", 199 | "valueFontSize": "110%", 200 | "valueMaps": [ 201 | { 202 | "op": "=", 203 | "text": "N/A", 204 | "value": "null" 205 | } 206 | ], 207 | "valueName": "avg" 208 | } 209 | ], 210 | "repeat": null, 211 | "repeatIteration": null, 212 | "repeatRowId": null, 213 | "showTitle": false, 214 | "title": "CPU Cores", 215 | "titleSize": "h6" 216 | }, 217 | { 218 | "collapse": false, 219 | "height": "300", 220 | "panels": [ 221 | { 222 | "aliasColors": {}, 223 | "bars": false, 224 | "datasource": "${DS_PROMETHEUS}", 225 | "description": "This represents the total [memory resource requests](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#meaning-of-memory) in the cluster.\nFor comparison the total [allocatable memory](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node-allocatable.md) is also shown.", 226 | "fill": 1, 227 | "id": 3, 228 | "legend": { 229 | "avg": false, 230 | "current": false, 231 | "max": false, 232 | "min": false, 233 | "show": true, 234 | "total": false, 235 | "values": false 236 | }, 237 | "lines": true, 238 | "linewidth": 1, 239 | "links": [], 240 | "nullPointMode": "null", 241 | "percentage": false, 242 | "pointradius": 5, 243 | "points": false, 244 | "renderer": "flot", 245 | "seriesOverrides": [], 246 | "span": 9, 247 | "stack": false, 248 | "steppedLine": false, 249 | "targets": [ 250 | { 251 | "expr": "min(sum(kube_node_status_allocatable_memory_bytes) by (instance))", 252 | "hide": false, 253 | "intervalFactor": 2, 254 | "legendFormat": "Allocatable Memory", 255 | "refId": "A", 256 | "step": 10 257 | }, 258 | { 259 | "expr": "max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance))", 260 | "intervalFactor": 2, 261 | "legendFormat": "Requested Memory", 262 | "refId": "B", 263 | "step": 10 264 | } 265 | ], 266 | "thresholds": [], 267 | "timeFrom": null, 268 | "timeShift": null, 269 | "title": "Memory", 270 | "tooltip": { 271 | "shared": true, 272 | "sort": 0, 273 | "value_type": "individual" 274 | }, 275 | "type": "graph", 276 | "xaxis": { 277 | "mode": "time", 278 | "name": null, 279 | "show": true, 280 | "values": [] 281 | }, 282 | "yaxes": [ 283 | { 284 | "format": "bytes", 285 | "label": "Memory", 286 | "logBase": 1, 287 | "max": null, 288 | "min": null, 289 | "show": true 290 | }, 291 | { 292 | "format": "short", 293 | "label": null, 294 | "logBase": 1, 295 | "max": null, 296 | "min": null, 297 | "show": true 298 | } 299 | ] 300 | }, 301 | { 302 | "cacheTimeout": null, 303 | "colorBackground": false, 304 | "colorValue": false, 305 | "colors": [ 306 | "rgba(50, 172, 45, 0.97)", 307 | "rgba(237, 129, 40, 0.89)", 308 | "rgba(245, 54, 54, 0.9)" 309 | ], 310 | "datasource": "${DS_PROMETHEUS}", 311 | "decimals": null, 312 | "format": "percent", 313 | "gauge": { 314 | "maxValue": 100, 315 | "minValue": 0, 316 | "show": true, 317 | "thresholdLabels": false, 318 | "thresholdMarkers": true 319 | }, 320 | "id": 4, 321 | "interval": null, 322 | "links": [], 323 | "mappingType": 1, 324 | "mappingTypes": [ 325 | { 326 | "name": "value to text", 327 | "value": 1 328 | }, 329 | { 330 | "name": "range to text", 331 | "value": 2 332 | } 333 | ], 334 | "maxDataPoints": 100, 335 | "nullPointMode": "connected", 336 | "nullText": null, 337 | "postfix": "", 338 | "postfixFontSize": "50%", 339 | "prefix": "", 340 | "prefixFontSize": "50%", 341 | "rangeMaps": [ 342 | { 343 | "from": "null", 344 | "text": "N/A", 345 | "to": "null" 346 | } 347 | ], 348 | "span": 3, 349 | "sparkline": { 350 | "fillColor": "rgba(31, 118, 189, 0.18)", 351 | "full": false, 352 | "lineColor": "rgb(31, 120, 193)", 353 | "show": true 354 | }, 355 | "targets": [ 356 | { 357 | "expr": "max(sum(kube_pod_container_resource_requests_memory_bytes) by (instance)) / min(sum(kube_node_status_allocatable_memory_bytes) by (instance)) * 100", 358 | "intervalFactor": 2, 359 | "legendFormat": "", 360 | "refId": "A", 361 | "step": 240 362 | } 363 | ], 364 | "thresholds": "80, 90", 365 | "title": "Memory", 366 | "type": "singlestat", 367 | "valueFontSize": "110%", 368 | "valueMaps": [ 369 | { 370 | "op": "=", 371 | "text": "N/A", 372 | "value": "null" 373 | } 374 | ], 375 | "valueName": "avg" 376 | } 377 | ], 378 | "repeat": null, 379 | "repeatIteration": null, 380 | "repeatRowId": null, 381 | "showTitle": false, 382 | "title": "Memory", 383 | "titleSize": "h6" 384 | } 385 | ], 386 | "schemaVersion": 14, 387 | "style": "dark", 388 | "tags": [], 389 | "templating": { 390 | "list": [] 391 | }, 392 | "time": { 393 | "from": "now-3h", 394 | "to": "now" 395 | }, 396 | "timepicker": { 397 | "refresh_intervals": [ 398 | "5s", 399 | "10s", 400 | "30s", 401 | "1m", 402 | "5m", 403 | "15m", 404 | "30m", 405 | "1h", 406 | "2h", 407 | "1d" 408 | ], 409 | "time_options": [ 410 | "5m", 411 | "15m", 412 | "1h", 413 | "6h", 414 | "12h", 415 | "24h", 416 | "2d", 417 | "7d", 418 | "30d" 419 | ] 420 | }, 421 | "timezone": "browser", 422 | "title": "Resource Requests", 423 | "version": 1 424 | } 425 | --------------------------------------------------------------------------------