Files

37 lines
759 B
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
section() {
printf '\n## %s\n' "$1"
}
section "Snapshot"
printf 'captured_at=%s\n' "$(date --iso-8601=seconds)"
uptime
section "Memory"
free -h
if command -v vmstat >/dev/null 2>&1; then
vmstat 1 5
fi
section "Storage"
df --human-readable --print-type
if command -v iostat >/dev/null 2>&1; then
iostat -xz 1 3
fi
section "Network summary"
if command -v ss >/dev/null 2>&1; then
ss --summary
fi
section "Containers"
if command -v docker >/dev/null 2>&1; then
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.NetIO}}\t{{.BlockIO}}\t{{.PIDs}}'
else
printf '%s\n' 'docker is not installed'
fi