Add cAdvisor container health monitoring - #2599
technowhizz wants to merge 1 commit into
Conversation
📝 SummaryUpdates the Grafana cAdvisor dashboard with container health, CPU, and memory monitoring, modernised Prometheus queries, templates, panels, and layout. Adds a WalkthroughThe cAdvisor Grafana dashboard was migrated to newer Grafana and Prometheus formats. It now shows container health and resource data. Prometheus adds an alert for containers that remain unhealthy for more than 10 minutes. Release notes document these additions. ChangescAdvisor observability
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: 🔵 Low · up to Parts of the dashboard will be blank or misleading under ordinary selections, but alerting and underlying monitoring remain unaffected. The PR is mergeable with these bounded dashboard issues acknowledged or fixed. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Warning Some tools did not complete. Review the errors below. 🔧 Biome (2.5.10)etc/kayobe/kolla/config/grafana/dashboards/openstack/cadvisor.jsonFile contains syntax errors that prevent linting: Line 1: unexpected character Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 4741cbca-bec0-4ebd-9cfa-c1fcd13602de
📒 Files selected for processing (3)
etc/kayobe/kolla/config/grafana/dashboards/openstack/cadvisor.jsonetc/kayobe/kolla/config/prometheus/cadvisor.rulesreleasenotes/notes/cadvisor-container-health-8e05e02c88f047ad.yaml
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: stackhpc/check
- GitHub Check: Ansible 2.19 lint with Python 3.12
- GitHub Check: Ansible 2.20 lint with Python 3.12
- GitHub Check: Tox pep8 with Python 3.12
🧰 Additional context used
🪛 Biome (2.5.10)
etc/kayobe/kolla/config/grafana/dashboards/openstack/cadvisor.json
[error] 2-1849: End of file expected
(parse)
🔇 Additional comments (2)
releasenotes/notes/cadvisor-container-health-8e05e02c88f047ad.yaml (1)
1-6: LGTM!etc/kayobe/kolla/config/prometheus/cadvisor.rules (1)
24-24: 🎯 Functional CorrectnessThe configured Kolla images use the
2026.1release. Kolla 2026.1 uses cAdvisor0.56.2, which exportscontainer_health_state. In this release,1means healthy,0means unhealthy, and-1means no health check. The alert expression correctly matches unhealthy containers. The concern that this deployment predates metric support is refuted.
| "expr": "sort(sum(container_health_state{name=~\"$name\"}==-1))", | ||
| "format": "time_series", | ||
| "instant": true, | ||
| "legendFormat": "{{name}}", | ||
| "range": false, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fix the No Health check target in the status-history panel.
The sum() aggregation removes the name label and combines all matching -1 samples. With multiple containers, the result is -N, which does not match the -1 value mapping. instant: true also returns only the current point, so the target does not provide history across the selected time range.
Use one range series per container:
🐛 Proposed fix
- "expr": "sort(sum(container_health_state{name=~\"$name\"}==-1))",
+ "expr": "container_health_state{name=~\"$name\"}==-1",
"format": "time_series",
- "instant": true,
+ "instant": false,
"legendFormat": "{{name}}",
- "range": false,
+ "range": true,
"refId": "No Health check"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "expr": "sort(sum(container_health_state{name=~\"$name\"}==-1))", | |
| "format": "time_series", | |
| "instant": true, | |
| "legendFormat": "{{name}}", | |
| "range": false, | |
| "expr": "container_health_state{name=~\"$name\"}==-1", | |
| "format": "time_series", | |
| "instant": false, | |
| "legendFormat": "{{name}}", | |
| "range": true, |
🧰 Tools
🪛 Biome (2.5.10)
[error] 2-1849: End of file expected
(parse)
| { | ||
| "datasource": { | ||
| "type": "prometheus", | ||
| "uid": "${datasource}" | ||
| }, | ||
| "editorMode": "code", | ||
| "exemplar": false, | ||
| "expr": "container_health_state{name=~\"$name\"}==1", | ||
| "format": "time_series", | ||
| "instant": false, | ||
| "legendFormat": "{{name}}", | ||
| "range": true, | ||
| "refId": "A" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove the duplicate target.
The target with refId: "A" repeats the expression of the Healthy target exactly. Grafana runs both queries and renders every healthy container twice in the status history and the legend.
♻️ Proposed fix
- },
- {
- "datasource": {
- "type": "prometheus",
- "uid": "${datasource}"
- },
- "editorMode": "code",
- "exemplar": false,
- "expr": "container_health_state{name=~\"$name\"}==1",
- "format": "time_series",
- "instant": false,
- "legendFormat": "{{name}}",
- "range": true,
- "refId": "A"
}🧰 Tools
🪛 Biome (2.5.10)
[error] 2-1849: End of file expected
(parse)
| }, | ||
| "unit": "percent" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add the "Please select only one node" message to both new per-container panels. The node variable now defaults to All, and both new panels use the exact matcher instance="$node", so they return no data by default. The host and network panels received a noValue message for this reason, but these two panels did not.
etc/kayobe/kolla/config/grafana/dashboards/openstack/cadvisor.json#L1159-L1160: add"noValue": "Please select only one node"to the defaults of the CPU Usage per Container panel.etc/kayobe/kolla/config/grafana/dashboards/openstack/cadvisor.json#L1270-L1271: add the samenoValueentry to the defaults of the Memory Usage per Container panel.
🧰 Tools
🪛 Biome (2.5.10)
[error] 2-1849: End of file expected
(parse)
PR to add more monitoring around container health statuses