mirror of
https://github.com/fosrl/newt.git
synced 2026-03-26 20:46:41 +00:00
docs+examples: document direction=ingress|egress, initiator and error_type enums; add cardinality relabel tips; provide Collector variants; add scripts/smoke-metrics.sh
This commit is contained in:
42
scripts/smoke-metrics.sh
Normal file
42
scripts/smoke-metrics.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
NEWTHOST=${NEWTHOST:-localhost}
|
||||
NEWTPORT=${NEWTPORT:-2112}
|
||||
METRICS_URL="http://${NEWTHOST}:${NEWTPORT}/metrics"
|
||||
|
||||
probe() {
|
||||
local name=$1
|
||||
local pattern=$2
|
||||
echo "[probe] ${name}"
|
||||
curl -sf "${METRICS_URL}" | grep -E "${pattern}" || {
|
||||
echo "[warn] ${name} not found"
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
# Basic presence
|
||||
probe "newt_* presence" "^newt_" || true
|
||||
|
||||
# Site gauges with site_id
|
||||
probe "site_online with site_id" "^newt_site_online\{.*site_id=\"[^\"]+\"" || true
|
||||
probe "last_heartbeat with site_id" "^newt_site_last_heartbeat_seconds\{.*site_id=\"[^\"]+\"" || true
|
||||
|
||||
# Bytes with direction ingress/egress and protocol
|
||||
probe "tunnel bytes ingress" "^newt_tunnel_bytes_total\{.*direction=\"ingress\".*protocol=\"(tcp|udp)\"" || true
|
||||
probe "tunnel bytes egress" "^newt_tunnel_bytes_total\{.*direction=\"egress\".*protocol=\"(tcp|udp)\"" || true
|
||||
|
||||
# WebSocket metrics (when OTLP/WS used)
|
||||
probe "websocket connect latency buckets" "^newt_websocket_connect_latency_seconds_bucket" || true
|
||||
probe "websocket messages total" "^newt_websocket_messages_total\{.*(direction|msg_type)=" || true
|
||||
|
||||
# Proxy metrics (when proxy active)
|
||||
probe "proxy active connections" "^newt_proxy_active_connections\{" || true
|
||||
probe "proxy buffer bytes" "^newt_proxy_buffer_bytes\{" || true
|
||||
probe "proxy drops total" "^newt_proxy_drops_total\{" || true
|
||||
|
||||
# Config apply
|
||||
probe "config apply seconds buckets" "^newt_config_apply_seconds_bucket\{" || true
|
||||
|
||||
echo "Smoke checks completed (warnings above are acceptable if the feature isn't exercised yet)."
|
||||
|
||||
Reference in New Issue
Block a user