Initialize observability stack with local monitoring and server134 deployment

This commit is contained in:
qiubaishen
2026-10-15 18:35:05 +08:00
commit f657abeed1
36 changed files with 4644 additions and 0 deletions
@@ -0,0 +1,12 @@
global:
resolve_timeout: 5m
route:
receiver: local-web
group_by: [alertname, instance]
group_wait: 30s
group_interval: 5m
repeat_interval: 4h
receivers:
- name: local-web
@@ -0,0 +1,153 @@
{
"annotations": { "list": [] },
"editable": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": null,
"links": [],
"panels": [
{
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{ "color": "red", "value": 0 },
{ "color": "green", "value": 1 }
]
}
},
"overrides": []
},
"gridPos": { "h": 5, "w": 6, "x": 0, "y": 0 },
"id": 1,
"options": {
"colorMode": "background",
"graphMode": "none",
"justifyMode": "center",
"orientation": "auto",
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
},
"textMode": "auto"
},
"targets": [{ "expr": "sum(up)", "refId": "A" }],
"title": "Targets Up",
"type": "stat"
},
{
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"fieldConfig": {
"defaults": { "unit": "percentunit", "min": 0, "max": 1 },
"overrides": []
},
"gridPos": { "h": 8, "w": 9, "x": 6, "y": 0 },
"id": 2,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "multi", "sort": "desc" }
},
"targets": [
{
"expr": "1 - avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m]))",
"legendFormat": "{{instance}}",
"refId": "A"
}
],
"title": "CPU Usage",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"fieldConfig": {
"defaults": { "unit": "percentunit", "min": 0, "max": 1 },
"overrides": []
},
"gridPos": { "h": 8, "w": 9, "x": 15, "y": 0 },
"id": 3,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "multi", "sort": "desc" }
},
"targets": [
{
"expr": "1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes",
"legendFormat": "{{instance}}",
"refId": "A"
}
],
"title": "Memory Usage",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"fieldConfig": {
"defaults": { "unit": "percentunit", "min": 0, "max": 1 },
"overrides": []
},
"gridPos": { "h": 8, "w": 12, "x": 0, "y": 8 },
"id": 4,
"options": {
"legend": {
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "multi", "sort": "desc" }
},
"targets": [
{
"expr": "1 - node_filesystem_avail_bytes{fstype!~\"tmpfs|devtmpfs|overlay|squashfs\"} / node_filesystem_size_bytes{fstype!~\"tmpfs|devtmpfs|overlay|squashfs\"}",
"legendFormat": "{{instance}} {{mountpoint}}",
"refId": "A"
}
],
"title": "Filesystem Usage",
"type": "timeseries"
},
{
"datasource": { "type": "prometheus", "uid": "victoriametrics" },
"fieldConfig": { "defaults": {}, "overrides": [] },
"gridPos": { "h": 8, "w": 12, "x": 12, "y": 8 },
"id": 5,
"options": {
"legend": {
"displayMode": "table",
"placement": "bottom",
"showLegend": true
},
"tooltip": { "mode": "multi", "sort": "desc" }
},
"targets": [
{
"expr": "ALERTS{alertstate=\"firing\"}",
"legendFormat": "{{severity}} {{alertname}} {{instance}}",
"refId": "A"
}
],
"title": "Firing Alerts",
"type": "timeseries"
}
],
"refresh": "15s",
"schemaVersion": 39,
"tags": ["observability", "host"],
"templating": { "list": [] },
"time": { "from": "now-6h", "to": "now" },
"timezone": "browser",
"title": "Monitor Host Overview",
"uid": "monitor-host-overview",
"version": 1
}
@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: Observability
orgId: 1
folder: Observability
type: file
disableDeletion: true
updateIntervalSeconds: 30
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,31 @@
apiVersion: 1
datasources:
- name: VictoriaMetrics
type: prometheus
uid: victoriametrics
access: proxy
url: http://victoriametrics:8428
isDefault: true
editable: false
- name: VictoriaLogs
type: victoriametrics-logs-datasource
uid: victorialogs
access: proxy
url: http://victorialogs:9428
editable: false
- name: Tempo
type: tempo
uid: tempo
access: proxy
url: http://tempo:3200
editable: false
jsonData:
tracesToLogsV2:
datasourceUid: victorialogs
spanStartTimeShift: -5m
spanEndTimeShift: 5m
filterByTraceID: true
filterBySpanID: false
@@ -0,0 +1,11 @@
modules:
new_api_status:
prober: http
timeout: 5s
http:
method: GET
valid_status_codes: [200]
follow_redirects: false
preferred_ip_protocol: ip4
fail_if_body_not_matches_regexp:
- '"success"\s*:\s*true'
@@ -0,0 +1,239 @@
{
"uid": "new-api-local",
"title": "New API - Local Health",
"schemaVersion": 39,
"version": 1,
"refresh": "15s",
"tags": ["new-api", "local"],
"time": {
"from": "now-30m",
"to": "now"
},
"panels": [
{
"id": 1,
"title": "Scope",
"type": "text",
"gridPos": {
"x": 0,
"y": 0,
"w": 24,
"h": 3
},
"options": {
"mode": "markdown",
"content": "Target: `http://host.docker.internal:3000/api/status` (Windows app at `127.0.0.1:3000`). Checks HTTP 200 and `success: true` every 15 seconds. **Status endpoint availability and latency only.** Model-call success rate, billing, application logs and business traces are not connected yet. No-traffic periods cannot be inferred from this probe."
}
},
{
"id": 2,
"title": "Status probe (1 = OK, 0 = failed)",
"type": "stat",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 0,
"y": 3,
"w": 8,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "probe_success{job=\"new-api-health\"}",
"legendFormat": "{{service}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
},
{
"id": 3,
"title": "HTTP status",
"type": "stat",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 8,
"y": 3,
"w": 8,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "probe_http_status_code{job=\"new-api-health\"}",
"legendFormat": "{{service}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
},
{
"id": 4,
"title": "Status endpoint duration",
"type": "stat",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 16,
"y": 3,
"w": 8,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "probe_duration_seconds{job=\"new-api-health\"}",
"legendFormat": "{{service}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
},
{
"id": 5,
"title": "Status endpoint availability",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 0,
"y": 10,
"w": 12,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "probe_success{job=\"new-api-health\"}",
"legendFormat": "{{service}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
},
{
"id": 6,
"title": "Status endpoint duration (not inference latency)",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 12,
"y": 10,
"w": 12,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "probe_duration_seconds{job=\"new-api-health\"}",
"legendFormat": "{{service}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
},
{
"id": 7,
"title": "Monitoring scrapes",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "victoriametrics"
},
"gridPos": {
"x": 0,
"y": 17,
"w": 24,
"h": 7
},
"targets": [
{
"refId": "A",
"expr": "up",
"legendFormat": "{{job}} {{instance}}"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"reduceOptions": {
"calcs": ["lastNotNull"],
"fields": "",
"values": false
}
}
}
]
}
@@ -0,0 +1,40 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
external_labels:
env: local
cluster: observability-local
scrape_configs:
- job_name: new-api-health
metrics_path: /probe
params:
module: [new_api_status]
static_configs:
- targets: [http://host.docker.internal:3000/api/status]
labels:
service: new-api
brand: local
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox:9115
- job_name: observability-components
static_configs:
- targets:
- victoriametrics:8428
- victorialogs:9428
- tempo:3200
- alertmanager:9093
- vmalert:8880
- vmagent:8429
- grafana:3000
- blackbox:9115
- job_name: mysql
static_configs:
- targets: [mysqld-exporter:9104]
labels:
service: mysql
instance: local-mysql
@@ -0,0 +1,19 @@
groups:
- name: local-application
interval: 15s
rules:
- alert: NewApiUnavailable
expr: probe_success{job="new-api-health"} == 0
for: 2m
labels:
severity: P1
annotations:
summary: "Local new-api status check failed for two minutes"
description: "This checks /api/status only; it does not measure model-call success."
- alert: LocalMonitoringTargetDown
expr: up == 0
for: 2m
labels:
severity: P2
annotations:
summary: "Monitoring scrape failed: {{ $labels.instance }}"
+28
View File
@@ -0,0 +1,28 @@
server:
http_listen_port: 3200
distributor:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
# Tempo 3 single-binary mode replaces the 2.x ingester/compactor configuration.
overrides:
defaults:
compaction:
block_retention: 720h
storage:
trace:
backend: local
wal:
path: /var/tempo/wal
local:
path: /var/tempo/blocks
usage_report:
reporting_enabled: false
@@ -0,0 +1,29 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
external_labels:
env: production
cluster: observability-server134
scrape_configs:
- job_name: node-exporter
static_configs:
- targets: [node-exporter:9100]
labels:
host: server134
service: node-exporter
- job_name: observability-components
static_configs:
- targets:
- victoriametrics:8428
- victorialogs:9428
- tempo:3200
- alertmanager:9093
- vmalert:8880
- vmagent:8429
- job_name: grafana
metrics_path: /metrics
static_configs:
- targets: [grafana:3000]
@@ -0,0 +1,29 @@
global:
scrape_interval: 15s
scrape_timeout: 10s
external_labels:
env: test
cluster: monitor-test
scrape_configs:
- job_name: node-exporter
static_configs:
- targets: [node-exporter:9100]
labels:
host: monitor-test
service: node-exporter
- job_name: observability-components
static_configs:
- targets:
- victoriametrics:8428
- victorialogs:9428
- tempo:3200
- alertmanager:9093
- vmalert:8880
- vmagent:8429
- job_name: grafana
metrics_path: /metrics
static_configs:
- targets: [grafana:3000]
@@ -0,0 +1,39 @@
groups:
- name: host-health
interval: 30s
rules:
- alert: ExporterDown
expr: up == 0
for: 2m
labels:
severity: P1
annotations:
summary: "Target {{ $labels.instance }} is unavailable"
description: "vmagent has failed to scrape {{ $labels.job }}/{{ $labels.instance }} for two minutes."
- alert: HostDiskUsageHigh
expr: 100 * (1 - node_filesystem_avail_bytes{fstype!~"tmpfs|devtmpfs|overlay|squashfs",mountpoint!~"/run($|/.*)"} / node_filesystem_size_bytes{fstype!~"tmpfs|devtmpfs|overlay|squashfs",mountpoint!~"/run($|/.*)"}) > 85
for: 10m
labels:
severity: P2
annotations:
summary: "Disk usage exceeds 85% on {{ $labels.instance }}"
description: "Mount {{ $labels.mountpoint }} has remained above 85% for ten minutes."
- alert: HostDiskPredictedFull
expr: predict_linear(node_filesystem_avail_bytes{fstype!~"tmpfs|devtmpfs|overlay|squashfs",mountpoint!~"/run($|/.*)"}[24h], 7 * 24 * 3600) < 0 and node_filesystem_avail_bytes > 0
for: 30m
labels:
severity: P1
annotations:
summary: "Disk may fill within seven days on {{ $labels.instance }}"
description: "The last 24 hours of free-space trend predicts that {{ $labels.mountpoint }} will fill within seven days."
- alert: HostMemoryUsageHigh
expr: 100 * (1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) > 85
for: 10m
labels:
severity: P2
annotations:
summary: "Memory usage exceeds 85% on {{ $labels.instance }}"
description: "Available memory has remained below 15% for ten minutes."