Skip to main content

Examples

Common recipes using curl and jq. Set this once so the examples run as-is:

export JWT="<YOUR-JWT>" # see Authentication

Recent high-priority alerts

Active critical and high alerts from the last 24 hours:

curl -sG "https://api.stealthium.online/api/v1/alerts/" \
--data-urlencode "filter[severity][in]=critical,high" \
--data-urlencode "filter[state][equals]=active" \
--data-urlencode "from=$(date -u -v-24H +%Y-%m-%dT%H:%M:%SZ)" \
-H "Authorization: Bearer $JWT" |
jq -r '.alerts[] | [.created_at, .severity, .hostname, .title] | @tsv'

On Linux, replace the date call with date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ.

Alerts from one host

Everything whose hostname starts with gpu-node-1:

curl -sG "https://api.stealthium.online/api/v1/alerts/" \
--data-urlencode "filter[hostname][startsWith]=gpu-node-1" \
-H "Authorization: Bearer $JWT" | jq '.total'

Page through all alerts

Follow next_cursor until it's null:

cursor=""
while :; do
page=$(curl -sG "https://api.stealthium.online/api/v1/alerts/" \
--data-urlencode "limit=1000" \
${cursor:+--data-urlencode "cursor=$cursor"} \
-H "Authorization: Bearer $JWT")
echo "$page" | jq -r '.alerts[].id'
cursor=$(echo "$page" | jq -r '.next_cursor // empty')
[ -z "$cursor" ] && break
done

Ignore an alert

Mark a false positive as ignored (set it back with "active"):

curl -s -X PUT "https://api.stealthium.online/api/v1/alerts/<alert-id>/state" \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{"state": "ignored"}'

Severity breakdown for a dashboard

Counts per severity, type, and state in one call:

curl -s "https://api.stealthium.online/api/v1/alerts/facets" \
-H "Authorization: Bearer $JWT" |
jq -r '.severity[] | "\(.value)\t\(.count)"'

Find unhealthy GPUs

GPUs that aren't healthy, with host and temperature:

curl -s "https://api.stealthium.online/api/v1/gpus" \
-H "Authorization: Bearer $JWT" |
jq -r '.gpus[] | select(.health != "healthy")
| [.health, .hostname, .model, .temperatureC] | @tsv'

Fleet health at a glance

Key numbers from the metrics summary:

curl -s "https://api.stealthium.online/api/v1/metrics" \
-H "Authorization: Bearer $JWT" |
jq '.metrics.metrics_summary
| {gpu_count, avg_gpu_utilization, avg_gpu_temperature, total_xid_errors}'