A dashboard with fifty graphs does not tell you much at 3 in the morning. These are the few measurements that explain most problems on a streaming server, how to read each by hand, and when it should wake you.
1. Bandwidth, per interface
The first limit you hit.
ip -s link show eth0
sar -n DEV 1 5
Alert when outgoing traffic stays above 85 percent of the port for 5 minutes. At that point new viewers start to buffer.
2. CPU: look past the total
top
mpstat -P ALL 1 5
us(user): your processes. High during transcoding, and expected.wa(iowait): the CPU waits for the disk. Above 10 percent for long, the disk is the problem, not the CPU.st(steal): on a VPS, time the host gave to other customers. Above 5 percent for long means an oversold host.
Load average is only meaningful next to the core count. A load of 16 is idle on 32 cores and overloaded on 4. Alert at load above 1.5 times the cores for 10 minutes.
3. Memory: available, not free
free -h
Read the available column. Linux uses spare memory as file cache, so free is always small and that is healthy. Alert when available drops below 10 percent, or when swap use keeps growing.
4. Disk space and inodes
df -h
df -i
A disk can be “full” with space left, when it runs out of inodes. That happens with millions of small files, such as segments that are never cleaned up. Alert at 85 percent on either.
5. Open files and connections
cat /proc/sys/fs/file-nr
ss -s
Each viewer connection is a file descriptor. When a service reaches its limit, it refuses new connections while everything else looks fine. Compare with the limit of the service itself:
cat /proc/$(pgrep -o nginx)/limits | grep 'open files'
6. Retransmissions
nstat -az TcpRetransSegs TcpOutSegs
Retransmitted segments divided by sent segments is the retransmission rate. Up to 1 percent is normal on the public internet. Above 3 percent, viewers see stalls, and the cause is usually the network path or a saturated port.
7. The processes that do the work
Count them, and compare with what should be running.
pgrep -c ffmpeg
systemctl list-units 'restream@*' --state=failed --no-pager
A stream that restarts every few minutes never shows as “down” in a simple check. Count restarts too:
journalctl -u 'restream@*' --since "1 hour ago" | grep -c 'Scheduled restart'
8. What the web server answers
The share of 5xx answers is the best single health number for delivery.
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
Alert when 5xx goes above 1 percent of requests.
9. Certificates
An expired certificate takes everything down at once, and it is fully predictable.
echo | openssl s_client -connect HOST:443 -servername HOST 2>/dev/null | openssl x509 -noout -enddate
Alert 14 days before the date.
Summary of alerts
| Measurement | Alert when |
|---|---|
| Outgoing bandwidth | above 85 percent of the port for 5 minutes |
| Load average | above 1.5 times the cores for 10 minutes |
| iowait | above 10 percent for 10 minutes |
| Steal | above 5 percent for 10 minutes |
| Available memory | below 10 percent |
| Disk space or inodes | above 85 percent |
| Retransmission rate | above 3 percent |
| 5xx answers | above 1 percent |
| Stream restarts | more than a few per hour for one stream |
| Certificate | fewer than 14 days left |
Tools
For one or two servers, a small script from cron that checks these numbers and sends a message is enough. There are examples in Scripts & Source Codes. For a fleet, node_exporter with Prometheus and Grafana collects all of the above with history, and Netdata gives the same view with almost no setup.
Whatever you use, keep the list of alerts short. An alert that fires every day and needs no action teaches you to ignore the one that matters.