Fix Rancher Monitoring Stack β Metrics or Alerts Not Working
DodaTech
Updated 2026-06-24
3 min read
In this tutorial, you'll learn about Fix Rancher Monitoring Stack. We cover key concepts, practical examples, and best practices.
You install the Monitoring app from Rancher's Apps & Marketplace. The pods are running, but Grafana shows "No data" on every dashboard. Or you configure an alert rule but it never fires.
Wrong β
Monitoring App:
Version: 100.0.0+up19.0.0
Status: Deployed
```bash
kubectl get pods -n cattle-monitoring-system
NAME READY STATUS
alertmanager-0 2/2 Running
<a href="/devops/prometheus-grafana/">grafana</a>-7f8d9c5b9c-xxxxx 1/1 Running
<a href="/devops/prometheus-grafana/">prometheus</a>-kube-<a href="/devops/prometheus-grafana/">prometheus</a>-stack-<a href="/devops/prometheus-grafana/">prometheus</a>-0 2/2 Running
But <a href="/devops/prometheus-grafana/">Grafana</a> dashboards show:
No data points
You check <a href="/devops/prometheus-grafana/">Prometheus</a> targets:
```bash
kubectl port-forward -n cattle-monitoring-syste prometheus-0 9090
# β Many targets are DOWN
## Right β
**Check ServiceMonitor and PodMonitor CRDs:**
```bash
kubectl get servicemonitors --all-namespaces
If no service monitors exist, <a href="/devops/prometheus-grafana/">Prometheus</a> has nothing to scrape for custom workloads.
**Deploy a ServiceMonitor for your app:**
```yaml
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: my-app-monitor
namespace: cattle-monitoring-system
spec:
selector:
matchLabels:
app: my-app
endpoints:
- port: metrics
interval: 30s
namespaceSelector:
any: true
**Enable default metrics for system components:**
1. **Rancher β Cluster β Tools β Monitoring**
2. **Advanced Options** β **Deploy Default Dashboards** β β
3. **Prometheus** β **Default ServiceMonitors** β β **Kubernetes API Server**, **Kubelet**, etc.
4. Click **Save**
**Fix persistent volume for Prometheus:**
If Prometheus restarts, it loses all data unless a PVC is configured:
```yaml
# In the Monitoring chart values:
<a href="/devops/prometheus-grafana/">prometheus</a>:
prometheusSpec:
storageSpec:
volumeClaimTemplate:
spec:
storageClassName: standard
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 50Gi
**Fix alerts not firing:**
1. **Rancher β Cluster β Monitoring β Alerting β Route**
2. Ensure a route exists matching your alert names
3. **Alertmanager Config** β check the `receiver` matches a configured notifier (Slack, email, etc.)
After fixing, <a href="/devops/prometheus-grafana/">Grafana</a> shows:
π Cluster CPU Usage
Avg: 34.2%
Max: 67.8%
π Pod Memory (Top 10)
my-app: 256 Mi
...
## Root Cause
The Rancher Monitoring stack installs <a href="/devops/prometheus-grafana/">Prometheus</a>, <a href="/devops/prometheus-grafana/">Grafana</a>, and Alertmanager, but without ServiceMonitors, <a href="/devops/prometheus-grafana/">Prometheus</a> has no scrape configuration. Default dashboards and system monitors must be explicitly enabled.
## Prevention
- Enable **Default dashboards** and **Default ServiceMonitors** during initial installation.
- Deploy a `ServiceMonitor` alongside every application that exposes <a href="/devops/prometheus-grafana/">Prometheus</a> metrics.
- Configure **Alertmanager** receivers immediately after installation.
- Set retention and PVC sizes for production installs.
## Common Mistakes with monitoring stack
1. **Forgetting `deriving (Show, Eq)` on custom data types needed for debugging**
2. **Placing the wildcard pattern first in case expressions, making all subsequent patterns unreachable**
3. **Using `head` and `tail` instead of pattern matching, causing runtime errors on empty lists**
These mistakes appear frequently in real-world RANCHER code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.
## Practice Exercise
**Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.**
This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.
## FAQ
<details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Why is <a href="/devops/prometheus-grafana/">Prometheus</a> using so much memory?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Increase <code>storage</code> size or adjust retention: <code><a href="/devops/prometheus-grafana/">prometheus</a>.prometheusSpec.retention: 15d</code>. Also tune <code>scrapeInterval</code>.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Can I use an existing <a href="/devops/prometheus-grafana/">Prometheus</a> instance?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes β in the Monitoring chart, set <code><a href="/devops/prometheus-grafana/">prometheus</a>.enabled: false</code> and configure <code>externalPrometheus.url</code>.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: How do I silence a noisy alert?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Create a <strong>Silence</strong> in Alertmanager's UI (portβforward to <code>alertmanager:9093</code>) or via Rancher's Alerting β Silences.</p>
</div></details><details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">**Q: Does the monitoring stack work with RKE2 or K3s?**</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>A: Yes β tested with both. ServiceMonitors use the same API regardless of Kubernetes distribution.</p>
</div></details>
---
*Monitoring stack deepβdive is in the [DodaTech Rancher Observability course](https://dodatech.com/courses/rancher).*
β Previous
Fix Rancher Logging Fluentd β Logs Not Collected
Next β
Fix Rancher Node Pool β Nodes Not Provisioning
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro