Engineering Field guide

Game server monitoring with Prometheus: node_exporter and alerts

Game server infrastructure monitoring with Prometheus: CPU/RAM tracking with node_exporter, tick rate observation, and automated Telegram alert rules.

Game server monitoring with Prometheus: node_exporter and alerts

Diagnosing game server performance bottlenecks often happens too late—after players flood Discord with lag complaints, avatars begin rubber-banding, and tick rates drop precipitously. Meanwhile, standard aggregate CPU graphs in hosting dashboards frequently show a deceptive 25–30% total utilization, masking the reality that the primary game simulation thread is pinned at 100% on a single core.

A modern monitoring stack built around Prometheus, the node_exporter metrics agent, and Grafana visualization enables operators to track essential real-time health indicators: per-core thread saturation, UDP packet receive rates, available physical RAM, and tick stall events. This guide outlines how to configure a lightweight monitoring pipeline on Linux with proactive Alertmanager notifications.

Installing and isolating node_exporter on the host#

The node_exporter daemon exposes Linux kernel performance telemetry (CPU cycles, disk I/O, memory allocations, network queues) over HTTP on port 9100.

Create an unprivileged system user and install the binary:

bash
sudo useradd --no-create-home --shell /bin/false node_exporter
curl -LO https://github.com/prometheus/node_exporter/releases/download/v1.8.2/node_exporter-1.8.2.linux-amd64.tar.gz
tar -xvf node_exporter-*.tar.gz
sudo mv node_exporter-*.linux-amd64/node_exporter /usr/local/bin/
sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
rm -rf node_exporter-*

Create a systemd unit to supervise the daemon:

bash
cat << 'EOF' | sudo tee /etc/systemd/system/node_exporter.service
[Unit]
Description=Prometheus Node Exporter
After=network.target

[Service]
User=node_exporter
Group=node_exporter
Type=simple
ExecStart=/usr/local/bin/node_exporter --web.listen-address=127.0.0.1:9100
Restart=always

[Install]
WantedBy=multi-user.target
EOF

Note the --web.listen-address=127.0.0.1:9100 argument. It binds telemetry strictly to the local loopback interface, shielding host metrics from public network scanning.

Start and verify the daemon:

bash
sudo systemctl daemon-reload
sudo systemctl enable --now node_exporter
curl -s http://127.0.0.1:9100/metrics | head -n 10

Configuring scrape targets in prometheus.yml#

Configure your Prometheus instance to scrape node metrics at a tight 15-second interval to catch transient tick spikes:

bash
cat << 'EOF' | sudo tee /etc/prometheus/prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'gamehost_node'
    static_configs:
      - targets: ['127.0.0.1:9100']
EOF

Apply the updated scrape definition:

bash
sudo systemctl restart prometheus
sudo systemctl status prometheus --no-pager

Essential PromQL expressions for game performance#

To isolate performance anomalies in game engines, execute these PromQL queries:

  1. Per-core CPU utilization (Single-core saturation):Reveals load distribution across individual cores. If any single core reaches 100%, tick rates drop regardless of aggregate CPU headroom:
text
100 - (avg by (cpu) (rate(node_cpu_seconds_total{mode="idle"}[1m])) * 100)
  1. Available physical memory excluding caches:Signals impending Linux OOM Killer invocation:
text
node_memory_MemAvailable_bytes / 1024 / 1024 / 1024
  1. Inbound UDP packet rate (PPS):Identifies incoming packet floods or sudden surges in player connections:
text
rate(node_network_receive_packets_total{device="eth0"}[1m])

Configuring automated alerting rules in Alertmanager#

To trigger automated notifications when a game instance starves for memory or experiences CPU throttle events, define Prometheus alert rules:

bash
cat << 'EOF' | sudo tee /etc/prometheus/alert_rules.yml
groups:
  - name: game_server_alerts
    rules:
      - alert: HostMemoryCritical
        expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes < 0.10
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Host memory critically low (< 10% available)"

      - alert: SingleCorePinned100
        expr: 100 - (avg by (cpu) (rate(node_cpu_seconds_total{mode="idle"}[1m])) * 100) > 98
        for: 3m
        labels:
          severity: warning
        annotations:
          summary: "CPU core pinned above 98% for 3 minutes (Game tick throttle risk)"
EOF

Verify syntax validity using promtool:

bash
promtool check rules /etc/prometheus/alert_rules.yml

When the tool reports SUCCESS, link the rules file in the rule_files directive of prometheus.yml and reload the service.

When overseeing extensive game server clusters, assembling custom Prometheus and Grafana stacks requires considerable maintenance effort. Modern infrastructure via an end-to-end server management platform integrates real-time game telemetry, per-thread monitoring, and automated performance alerts out of the box.

Sources#