Kubernetes Example Widgets
- Node CPU %
- Pod CPU
Select 
system.cpu.utilization as your primary metric, choose the Average By filter and aggregate by the sum of all host.name. Filter the above query such that is.k8s.node = yes
Select 
k8s.pod.cpu.utilization as your primary metric, choose the Average By filter and aggregate by the average of all k8s.pod.name. Filter the above query such that k8s.deployment.name = dndemo-deployment
.json file into the Dashboard Builder:
JSON
Copy
Ask AI
{"builderViewOptions":{"report":{"reportName":"K8s Examples","reportId":44120,"reportKey":"k8s_examples__dont_delete_"},"extraActions":[]},"widgets":[{"config":[{"account_id":"","columns":["min(k8s.pod.phase,value(min))"],"distinct":false,"filter":null,"granularity":null,"group_by":null,"is_pre_flight":false,"join_with":null,"limit":null,"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.pod"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.pod.name"],"value_len":false}]}],"label":"Pod Phase","layout":{"_scope_id":1073355,"h":9,"w":6,"x":0,"y":0,"resizeHandles":["se"]},"widgetAppId":1,"key":"untitled_39o1xsh41zh"},{"config":[{"type":0,"schema":"","account_id":"","is_pre_flight":false,"distinct":false,"with":[{"key":"SELECT_DATA_BY","value":["k8s.pod.name"],"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false}],"preflights":null,"response_type":0,"top":0,"columns":["avg(k8s.container.ready,value(avg))"],"source":{"name":"k8s.container","dataset":null,"final":false,"alias":""},"granularity":null,"join_with":null,"union":null,"filter":null,"group_by":null,"order_by":null,"limit":null,"options":null,"meta_data":null,"settings":null}],"label":"Container Ready","layout":{"_scope_id":1077491,"h":9,"w":6,"x":6,"y":0,"resizeHandles":["se"]},"widgetAppId":1,"key":"container_ready_rrvc4cw9gzd"},{"config":[{"type":0,"schema":"","account_id":"","is_pre_flight":false,"distinct":false,"with":[{"key":"ATTRIBUTE_FILTER","value":{"k8s.deployment.name":{"=":"dndemo-deployment"}},"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false},{"key":"SELECT_DATA_BY","value":[],"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false}],"preflights":null,"response_type":0,"top":0,"columns":["any(k8s.pod.name)"],"source":{"name":"k8s.pod","dataset":null,"final":false,"alias":""},"granularity":null,"join_with":null,"union":null,"filter":null,"group_by":null,"order_by":null,"limit":null,"options":null,"meta_data":null,"settings":null},{"type":0,"schema":"","account_id":"","is_pre_flight":false,"distinct":false,"with":[{"key":"ATTRIBUTE_FILTER","value":{"k8s.deployment.name":{"=":"dndemo-deployment"}},"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false},{"key":"SELECT_DATA_BY","value":[],"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false}],"preflights":null,"response_type":0,"top":0,"columns":["min(k8s.pod.phase,value(min))"],"source":{"name":"k8s.pod","dataset":null,"final":false,"alias":""},"granularity":null,"join_with":null,"union":null,"filter":null,"group_by":null,"order_by":null,"limit":null,"options":null,"meta_data":null,"settings":null}],"label":"Pod Phase | Same Deployment","layout":{"_scope_id":1077505,"h":8,"w":6,"x":6,"y":9,"resizeHandles":["se"]},"widgetAppId":5,"key":"pod_phase___same_deployment_84vae4p36zn"},{"config":[{"account_id":"","columns":["avg(system.cpu.utilization,value(sum))"],"distinct":false,"filter":null,"granularity":null,"group_by":null,"is_pre_flight":false,"join_with":null,"limit":null,"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"host"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["host.name"],"value_len":false},{"is_arg":true,"is_p_arg":false,"key":"ATTRIBUTE_FILTER","swap_as":false,"value":{"is.k8s.node":{"=":"yes"}},"value_len":false}]}],"label":"Node CPU %","layout":{"_scope_id":1203808,"h":8,"w":6,"x":0,"y":27,"resizeHandles":["se"]},"widgetAppId":1,"key":"node_cpu___test_i0pca8w55c9"},{"config":[{"type":0,"schema":"","account_id":"","is_pre_flight":false,"distinct":false,"with":[{"key":"SELECT_DATA_BY","value":["k8s.pod.name"],"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false},{"key":"ATTRIBUTE_FILTER","value":{"k8s.deployment.name":{"=":"dndemo-deployment"}},"value_len":false,"swap_as":false,"is_arg":true,"is_p_arg":false}],"preflights":null,"response_type":0,"top":0,"columns":["avg(k8s.pod.cpu.utilization,value(avg))"],"source":{"name":"k8s.pod","dataset":null,"final":false,"alias":""},"granularity":null,"join_with":null,"union":null,"filter":null,"group_by":null,"order_by":null,"limit":null,"options":null,"meta_data":null,"settings":null}],"label":"Pod CPU | Same Deployment","layout":{"_scope_id":1203819,"h":8,"w":6,"x":0,"y":19,"resizeHandles":["se"]},"widgetAppId":1,"key":"pod_cpu___same_deployment_5bvgkx56vn8"},{"config":[{"columns":["avg(total_logs,value(count))"],"source":{"alias":"","dataset_id":0,"name":"log"},"with":[{"is_arg":true,"key":"ATTRIBUTE_FILTER","value":{"k8s.event.reason":{"=":"Killing"}}},{"is_arg":true,"key":"SELECT_DATA_BY","value":["host.name"]}]}],"label":"K8s Pods Killed","layout":{"_scope_id":1238209,"h":4,"w":6,"x":0,"y":15,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_pods_killed_2rolisxtlmn"},{"config":[{"columns":["any(k8s.event.name)"],"source":{"alias":"","dataset_id":0,"name":"log"},"with":[{"is_arg":true,"key":"SELECT_DATA_BY","value":["k8s.event.reason"]},{"is_arg":true,"key":"ATTRIBUTE_FILTER","value":{"k8s.event.reason":{"=":"Killing"}}}]}],"label":"Untitled","layout":{"_scope_id":1238210,"h":6,"w":6,"x":0,"y":9,"resizeHandles":["se"]},"widgetAppId":5,"key":"untitled_fkpqzj22wao"}]}
Container Example Widgets
- Active Containers
- CPU Limit by Container
- Memory Requests by Container (Bytes)
Choose the Query Value chart type, select 
k8s.container.name as your primary metric and choose the Unique By filter to display the count of all active containers:Choose the List chart type, select 
k8s.container.cpu_limit as your primary metric, choose the Maximum By filter and aggregate by the average value of all k8s.container.name:Select 
container.memory.usage as your primary metric, choose the Average By filter and aggregate by the average value of all k8s.container.name:.json file into the Dashboard Builder:
JSON
Copy
Ask AI
{"builderViewOptions":{"report":{"reportName":"Container Monitoring Example","reportId":46462,"reportKey":"container_monitoring_example"},"extraActions":[]},"widgets":[{"config":[{"account_id":"","columns":["k8s.container.memory_request"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"Memory Request by Container (Bytes)","layout":{"_scope_id":1227168,"h":5,"w":4,"x":0,"y":0,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_default__memory_request_by_container__containersja0ohmyb05s"},{"config":[{"account_id":"","columns":["uniq(k8s.container.name)"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":[],"value_len":false}]}],"label":"Containers","layout":{"_scope_id":1227169,"h":5,"w":4,"x":8,"y":10,"resizeHandles":["se"]},"widgetAppId":12,"key":"k8s_default__containers__containers67ren8gfj7v"},{"config":[{"account_id":"","columns":["max(k8s.container.memory_limit)"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"Memory Limit by Container","layout":{"_scope_id":1227170,"h":5,"w":4,"x":4,"y":10,"resizeHandles":["se"]},"widgetAppId":5,"key":"k8s_default__memory_limit_by_container__containersi1km077iatn"},{"config":[{"account_id":"","columns":["k8s.container.restarts"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"Container Restarts","layout":{"_scope_id":1227171,"h":5,"w":4,"x":8,"y":5,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_default__container_restarts_by_pod__containerst9xqxkuw0sr"},{"config":[{"account_id":"","columns":["container.memory.usage"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"Memory Usage by Container (Bytes)","layout":{"_scope_id":1227172,"h":5,"w":4,"x":0,"y":5,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_default__memory_usage_by_container__containersczj3w36phy"},{"config":[{"account_id":"","columns":["max(k8s.container.cpu_limit)"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"CPU Limit by Container","layout":{"_scope_id":1227173,"h":5,"w":4,"x":4,"y":5,"resizeHandles":["se"]},"widgetAppId":5,"key":"k8s_default__cpu_limit_by_container__containers41n78ogc5sy"},{"config":[{"account_id":"","columns":["sum(k8s.container.restarts,value(avg))"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false},{"is_arg":true,"is_p_arg":false,"key":"ATTRIBUTE_FILTER","swap_as":false,"value":{"k8s.container.restarts":{">=":"1"}},"value_len":false}]}],"label":"Container Restarted","layout":{"_scope_id":1227174,"h":5,"w":4,"x":0,"y":10,"resizeHandles":["se"]},"widgetAppId":3,"key":"k8s_default__containers_states__containers7asg0nck8pn"},{"config":[{"account_id":"","columns":["k8s.container.cpu_request"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"CPU Request by Container","layout":{"_scope_id":1227175,"h":5,"w":4,"x":4,"y":0,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_default__cpu_request_by_container__containers2vbbhf98dgm"},{"config":[{"account_id":"","columns":["container.cpu.utilization"],"distinct":false,"filter":null,"granularity":{"column":"","filter_required":true,"ingest_interval":0,"is_cte":false,"is_dttm":true,"is_in_range":false,"is_sudo":false,"is_tuple_range":false,"modifier_end":"","modifier_start":"","type":"","value":0},"group_by":null,"is_pre_flight":false,"join_with":null,"limit":{"n":10},"meta_data":null,"options":null,"order_by":null,"preflights":null,"response_type":0,"schema":"","settings":null,"source":{"alias":"","dataset":null,"final":false,"name":"k8s.container"},"top":0,"type":0,"union":null,"with":[{"is_arg":true,"is_p_arg":false,"key":"SELECT_DATA_BY","swap_as":false,"value":["k8s.container.name"],"value_len":false}]}],"label":"CPU Usage by Container (Cores)","layout":{"_scope_id":1227176,"h":5,"w":4,"x":8,"y":0,"resizeHandles":["se"]},"widgetAppId":1,"key":"k8s_default__cpu_usage_by_container__containerszmtgyfg639g"},{"config":[{"columns":["sum(app.ads.ad_requests,value(avg))"],"source":{"alias":"","dataset_id":0,"name":"runtime.metrics.java"},"with":[{"is_arg":true,"key":"SELECT_DATA_BY","value":["host.id"]}]}],"label":"Untitled","layout":{"_scope_id":1238236,"h":6,"w":8,"x":0,"y":15,"resizeHandles":["se"]},"widgetAppId":1,"key":"untitled_nu3dfu0w7w"}]}
Metrics Example Widgets
- Gauge Active Connections
- Download Speeds
- User Downloads
Select 
connections.active as your primary metric, choose the Maximum By filter and aggregate by the average of all connections.active.hostnameSelect 
downloads.speeds_bucket as your primary metric, choose the Average By filter and aggregate by the minimum of all region
Select 
uploads.count as your primary metric and choose the Count By filter
You may need to adjust the format depending on how you are sending requests.
.json
Copy
Ask AI
{
"info": {
"_postman_id": "fa8bf8f1-5f53-4989-8fe8-af01e24b531e",
"name": "MW Data Ingestion API",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json",
"_exporter_id": "30495621",
"_collection_link": "https://cloudy-astronaut-491050.postman.co/workspace/New-Team-Workspace~44e7a2d0-d301-4800-97eb-28b756f9175c/collection/30495621-fa8bf8f1-5f53-4989-8fe8-af01e24b531e?action=share&source=collection_link&creator=30495621"
},
"item": [
{
"name": "Custom Metrics",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"resource_metrics\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"mw.account_key\",\n \"value\": {\n \"string_value\": \"5xrocjh0p5ir233mvi34dvl5bepnyqri3rqb\"\n }\n },\n {\n \"key\": \"mw.resource_type\",\n \"value\": {\n \"string_value\": \"custom\"\n }\n }\n ]\n },\n \"scope_metrics\": [\n {\n \"metrics\": [\n {\n \"name\": \"uploads.count\",\n \"unit\": \"1\",\n \"description\": \"Count of user uploads\",\n \"sum\": {\n \"aggregationTemporality\": 2,\n \"isMonotonic\": true,\n \"dataPoints\": [\n {\n \"asInt\": 5,\n \"startTimeUnixNano\": 1711559739191393000,\n \"timeUnixNano\": 1711559739191393000,\n \"attributes\": [\n {\n \"key\": \"uploads.count.user_email\",\n \"value\": {\n \"stringValue\": \"[email protected]\"\n }\n }\n ]\n }\n ]\n }\n },\n {\n \"name\": \"connections.active\",\n \"unit\": \"1\",\n \"description\": \"Number of active connections\",\n \"gauge\": {\n \"dataPoints\": [\n {\n \"asInt\": 215,\n \"timeUnixNano\": 1711559739191393000,\n \"attributes\": [\n {\n \"key\": \"connections.active.hostname\",\n \"value\": {\n \"stringValue\": \"vm-prod-2\"\n }\n }\n ]\n }\n ]\n }\n },\n {\n \"name\": \"downloads.speeds\",\n \"unit\": \"By\",\n \"description\": \"Download speeds of users in a particular region\",\n \"histogram\": {\n \"aggregationTemporality\": 2,\n \"dataPoints\": [\n {\n \"startTimeUnixNano\": 1711559739191393000,\n \"timeUnixNano\": 1711559739191393000,\n \"count\": 6,\n \"sum\": 258,\n \"bucketCounts\": [\n 1,\n 1,\n 1,\n 1,\n 0,\n 0,\n 0,\n 0,\n 1,\n 1\n ],\n \"explicitBounds\": [\n 0,\n 10,\n 20,\n 30,\n 40,\n 50,\n 60,\n 70,\n 80,\n 90,\n 100\n ],\n \"min\": 0,\n \"max\": 98,\n \"attributes\": [\n {\n \"key\": \"region\",\n \"value\": {\n \"stringValue\": \"us-west\"\n }\n }\n ]\n }\n ]\n }\n }\n ]\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": "https://sandbox.middleware.io/v1/metrics"
},
"response": []
},
{
"name": "Custom Logs",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"resource_logs\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"mw.account_key\",\n \"value\": {\n \"string_value\": \"5xrocjh0p5ir233mvi34dvl5bepnyqri3rqb\"\n }\n },\n {\n \"key\": \"mw.resource_type\",\n \"value\": {\n \"string_value\": \"custom\"\n }\n },\n {\n \"key\": \"service_name\",\n \"value\": {\n \"string_value\": \"nginx-123\"\n }\n }\n ]\n },\n \"scope_logs\": [\n {\n \"log_records\": [\n {\n \"severity_text\": \"WARN\",\n \"body\": {\n \"string_value\": \"{\\\"hello\\\":\\\"world\\\"}\"\n },\n \"attributes\": [\n {\n \"key\": \"server\",\n \"value\": {\n \"string_value\": \"nginx\"\n }\n }\n ],\n \"time_unix_nano\": \"1711071266178191000\"\n }\n ]\n }\n ]\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": "https://sandbox.middleware.io:443/v1/logs"
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "UID",
"value": "<uid>"
},
{
"key": "mw_key",
"value": "<mw_key>",
"type": "string"
}
]
}
Need assistance or want to learn more about Middleware? Contact us at support[at]middleware.io.