Add monitoring stack: Prometheus, Alertmanager, Grafana

This commit is contained in:
rezayaghobi-dev
2026-10-03 19:47:36 +03:30
parent a1973b97ff
commit aa6cd39b8c
7 changed files with 175 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
{
"title": "Webapp Overview",
"uid": "webapp-overview",
"schemaVersion": 39,
"refresh": "10s",
"time": { "from": "now-15m", "to": "now" },
"panels": [
{
"id": 1, "type": "stat", "title": "Webapp up (1 = yes)",
"gridPos": { "x": 0, "y": 0, "w": 6, "h": 6 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [ { "refId": "A", "expr": "up{job=\"webapp\"}" } ]
},
{
"id": 2, "type": "timeseries", "title": "Request rate by path (req/s)",
"gridPos": { "x": 6, "y": 0, "w": 18, "h": 6 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"targets": [ { "refId": "A", "expr": "sum by (path) (rate(http_requests_total[1m]))", "legendFormat": "{{path}}" } ]
},
{
"id": 3, "type": "timeseries", "title": "5xx error ratio",
"gridPos": { "x": 0, "y": 6, "w": 12, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "percentunit" }, "overrides": [] },
"targets": [ { "refId": "A", "expr": "sum(rate(http_requests_total{status=~\"5..\"}[1m])) / sum(rate(http_requests_total[1m]))", "legendFormat": "5xx ratio" } ]
},
{
"id": 4, "type": "timeseries", "title": "p95 latency (s)",
"gridPos": { "x": 12, "y": 6, "w": 12, "h": 8 },
"datasource": { "type": "prometheus", "uid": "prometheus" },
"fieldConfig": { "defaults": { "unit": "s" }, "overrides": [] },
"targets": [ { "refId": "A", "expr": "histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket[5m])))", "legendFormat": "p95" } ]
}
]
}

View File

@@ -0,0 +1,7 @@
apiVersion: 1
providers:
- name: default
folder: ""
type: file
options:
path: /var/lib/grafana/dashboards

View File

@@ -0,0 +1,8 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true