How to Set Up Datadog Monitoring for a First Server
Datadog is a hosted monitoring platform that collects metrics, logs and traces through a lightweight agent. The free tier covers up to 5 hosts with 1-day metric retention, which is enough to get a real picture of a single production server.
This guide installs the agent on one Linux box, ships nginx logs into Datadog, builds a dashboard with four charts, and sets one alert. Budget an hour. Most of it is waiting for data to arrive.
How do you install the Datadog agent?
Create a Datadog account, then grab the API key from Organization Settings → API Keys. The install command embeds it, so generate a fresh key for this and don’t paste it into a shared document.
On Debian or Ubuntu:
DD_API_KEY=YOUR_DD_API_KEY DD_SITE="datadoghq.com" \
bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh)"
For a US1 org datadoghq.com is right; EU orgs use datadoghq.eu. Getting the site wrong produces an agent that installs fine and reports nothing — the log line in /var/log/datadog/agent.log reads 403 Forbidden and it’s easy to miss.
Verify:
sudo datadog-agent status | head -30
You want API Key Status: Valid and a set of green checks. The agent ships core checks automatically: CPU, memory, disk, network, processes. Within 60 seconds system.cpu.user shows up under Metrics → Summary.
If nothing appears, check that outbound HTTPS to agent-http-intake.logs.datadoghq.com and api.datadoghq.com isn’t blocked. Corporate proxies silently break the agent.
How do you get logs into Datadog?
Log collection is off by default in the agent config. Edit /etc/datadog-agent/datadog.yaml:
logs_enabled: true
Then create a log config for nginx at /etc/datadog-agent/conf.d/nginx.d/conf.yaml:
logs:
- type: file
path: /var/log/nginx/access.log
service: web
source: nginx
- type: file
path: /var/log/nginx/error.log
service: web
source: nginx
Restart with sudo systemctl restart datadog-agent. Logs take 1-3 minutes to appear under Logs → Live Tail.
The source: nginx line is not cosmetic. It tells Datadog which pipeline to apply, and that pipeline extracts the status code, request path and response time into facets you can filter on. Without it you get raw text and none of the useful fields.
Cost warning: log ingestion is the fastest way to blow a budget. Free tier includes limited indexing, and paid log management starts at $0.10 per GB ingested plus indexing. On a busy server, access logs alone can be 3-8 GB/day. Set exclusion filters early — drop 2xx and 3xx access log lines before indexing, keep errors. That cut one client’s log bill by 70% with no loss of useful information.
What should go on the first dashboard?
Four charts, in this order. Resist adding more; a dashboard nobody reads is decoration.
- CPU by core —
avg:system.cpu.user{host:web-1} by {cpu}. Watch for a single pegged core, which an average hides. - Memory used, with a 90% line — a timeseries with a marker at the threshold. Memory that climbs steadily is a leak; memory that jumps and holds is a cache.
- Disk free — the boring chart that prevents the 3am page. Remove the root filesystem from the volume you don’t monitor. Set the graph to show absolute free GB, not percent.
- Requests per minute by status code — from the nginx logs, grouped by
@http.status_code. This is the chart that tells you a deploy broke something.
Build it under Dashboards → New Dashboard, add widgets, and use the Template variables feature with host so the same dashboard works when you add a second server.
How do you set an alert that isn’t noise?
One metric monitor, not five. A good first alert is disk space, because it’s unambiguous.
Create it under Monitors → New Monitor → Metric, metric avg:system.disk.in_use{device:/dev/sda1}, threshold 0.90 for 5 minutes. Set the notification to your team channel, and add a runbook link in the message field.
Two settings decide whether you’ll ignore this monitor within a month.
Evaluation window. 5 minutes avoids pages from a log rotation spike. 1 minute will page you constantly.
Auto-resolve. Turn it on. Monitors that stay open after the problem clears train people to stop reading alerts.
Start with one. Add the second only after the first has proven it fires for real problems and stays quiet otherwise. New Datadog users typically create 8 monitors on day one and mute all of them by day 20.
What does it cost after the free tier?
Per-host infrastructure pricing starts at $15/host/month (Pro) for hosts with full metric retention — 15 months instead of the free tier’s 1 day. APM is a separate $31/host/month, billed per host with a trace-apm agent.
That separation catches people. Running the agent gives you infrastructure metrics; you do not get traces until you enable APM explicitly and pay for it.
For one to three servers, the free 5-host tier with 1-day retention is genuinely usable — dashboards work, alerts work, logs cost extra. What 1-day retention costs you is the ability to compare this week to last week. If you find yourself wanting that, that’s the signal to upgrade.
Who should skip Datadog?
Solo projects on a $6 VPS where uptime isn’t revenue-critical. A cron job and uptime monitoring from a free service covers it. The agent’s memory footprint (roughly 200-300 MB with several checks) is a real fraction of a small box.
It earns the money once there are multiple services, a team, or an on-call rotation. At that point the alternative isn’t nothing — it’s Prometheus plus Grafana plus Loki, which is three systems you now operate.
Quick Summary
- Install with the agent script, match the DD_SITE to your org region, and check
agent statusfor a valid API key. - Log collection needs
logs_enabled: trueand a per-source config; thesourcefield drives parsing. - Index only error logs — log ingestion is where budgets disappear.
- Four dashboard charts cover most incidents: CPU, memory, disk, requests by status.
- One disk monitor with a 5-minute window and auto-resolve beats eight noisy ones.
- Pro is $15/host/month; APM is separate at $31/host/month.</}
