writing

How to monitor services with Gagarin dashboards: a practical setup

Ten minutes of setup puts eight kinds of trouble on your phone, and ten minutes a week catches the slow kind. The switch to flip, the order to read the console in when a push lands, what to watch on a web service, a worker, a database and a cron job, and the gaps Gagarin leaves to you.

Your Gagarin project came with its monitoring already running. The platform samples CPU, memory, disk, network and HTTP for each service every 30 seconds and keeps 30 days of it. It keeps a week of logs and checks eight alert rules once a minute. You install nothing and write no rules.

Two parts still need you. Alerts reach nobody until a person turns them on for their own phone, and a dashboard helps only if you know which chart answers which question.

Step 1: turn alerts on, on the phone you carry

Gagarin sends alerts as web push notifications from the console. It sends no email, Slack or SMS, so the device you switch them on from is the device that buzzes.

  1. On your phone, open https://my.gagarin.cloud/projects/<id>/alerts. On an iPhone or iPad, tap Share, then Add to Home Screen, and open the console from the new icon. iOS delivers web push to Home Screen sites and nowhere else.
  2. Flip Notify me about this project to On. The phone asks whether Gagarin may send notifications. Tap Allow.
  3. Press Send a test.
Alerts on an iPhone, step 1 of 6
shopserviceslogsmetricsalerts
FOR YOUonly you, not the team
YOUR DEVICESmanage →

0 devices of yours receive alerts.

This device

On iPhone and iPad, notifications only reach a site added to the Home Screen. Tap Share, then Add to Home Screen, and open the console from there.

my.gagarin.cloud
‹›

Open the project’s alerts page in Safari. The console says what iOS needs. Tap Share.

The flow on an iPhone, drawn rather than screenshotted. Tap the lit control to move on, or pick a step. Android and desktop browsers skip the first three steps.

The test arrives as <project>: alerts are on. If it doesn't, the page names the missing piece: alerts off for you, no device on your list, or notifications blocked in this browser. If you switched alerts on from a laptop first, your phone shows Allow on this device under This device instead. Press it to add the phone.

Each person opts in for themselves, viewers included. Your switch signs up you and nobody else, so ask whoever shares the pager to run the same three steps on their own phone. The Your devices panel lists each device you've allowed and when it last got a push.

gg has no alerts command, so this part happens in the console. An agent connected over MCP can check it afterwards: the alerts tool says whether you're opted in and how many devices you have, and test_alerts sends the test from step 3. Only a browser can add a device, so steps 1 and 2 stay with you.

Step 2: know what wakes you

pushfires whentells you again when
a service is downnothing has served for three minutesit serves again
a deploy will not startthe new revision stalls and the old one keeps servingthe deploy gets unstuck
a container crashed and restarteda container exits, with the reason, at most once an hourno recovery push
memory is running short80% of its limit for five minutesback under 75%
CPU is running short80% of its limit for ten minutesback under 70%
a volume is filling up85% fullback under 80%
requests are failing5% of at least 20 requests answer 5xx over five minutesunder 2%
a scheduled run faileda cron job's latest run failsthe next run succeeds

You can't move a threshold, mute a kind or pick a channel. Each clear line sits below its fire line, so a service hovering at 80% memory sends you one push and, once it settles, one recovery. Gagarin also folds everything one check finds into a single push, so a bad deploy that takes three services down arrives as 3 services need attention and buzzes once.

Two hours at the edge of 80%
fires at 80%, pushes sent
4
time spent alerting
48 min
what actually happened
one problem

A made-up service sitting on the memory line, run through the real rule. Clear at 80% and each wobble is a fresh push. Clear at 75% and you get one alert, open until the service comes down.

Step 3: when a push lands, hand it to your agent

A push says what broke, by how much, and the two commands to type next:

One push, three answers
Gagarinnow
shop: api is running out of memory 1

api: memory at 82% of its 1 GiB limit for 5 minutes; it is killed at 100% 2

gg status shop · gg logs shop/api 3

  1. 1What broke. The project, the service and the kind of trouble.
  2. 2How much. The figure, the limit it is measured against, and for how long.
  3. 3Where to look. The two commands you would type next.

A memory alert with made-up numbers. The wording is the engine's.

Tap a memory, CPU, disk or 5xx push and the console opens the Metrics tab with that service picked. The other kinds open the service's sheet on the project page.

You don't have to take it from there yourself. The commands at the bottom of the push work for your agent as well as for you. Paste the push into Claude Code, Codex or whichever agent works in your repository:

shop: api is running out of memory. Find out why and propose a fix.

Your agent reads what the console shows, through gg or the Gagarin MCP server. The status, logs and metrics tools match the gg commands of the same names, and history lists what went out when. It also has your source code, which the console doesn't. If memory started climbing when a nightly import began, the agent can find the loop that holds every row in memory.

The fix goes out as a deploy too: a bigger --size, gg rollback to the last good revision, or a patched image. Your agent can ship any of the three. A deletion or a released address waits for a person: Gagarin emails the account owner a button and does nothing until somebody presses it.

Whoever does the reading, do it in this order, cheapest read first. To check your agent's work, read the same three things:

An out-of-memory kill, read three ways
  1. 01 status is it serving?
    ○ api s 0/1 ○ api: the container ran out of memory and was killed (it exceeded the 1Gi ceiling of size s); try --size m, which gets 2Gi
  2. 02 logs what was it doing?
    $ gg logs shop/api --previous import: 38000 of 120000 rows import: 39000 of 120000 rows import: 40000 of 120000 rows (and then nothing)
  3. 03 metrics what moved first?

One made-up incident. Each card is one call, as a gg command or the MCP tool of the same name. The status lines are abridged, and the log lines are invented.

Status. gg status shop, or the project page. It compares what you asked for with what the cluster runs. A ○ and READY 0/1 mean the service is not serving, and the cluster's own message sits on the line under it.

Logs. If the service crashed, read the container that died. Its replacement started clean and has nothing to say about it:

gg logs shop/api --previous
gg logs shop/api --since 2h --grep timeout

Gagarin keeps a week of lines, crashed and replaced containers included. The kernel kills an out-of-memory process without warning, so the log stops mid-task. The last lines tell you what it was doing, and the crash push names the cause: the container ran out of memory and was killed (it exceeded the 1Gi ceiling of size s); try --size m, which gets 2Gi.

Metrics. gg metrics shop/api --window 24h gives your agent the last value, average, peak and limit of each series. The console gives you the curve. Its charts share one cursor, so the instant you hover shows on memory, CPU, requests and latency at once, and you can see which line moved first.

Step 4: what to watch on each kind of service

The Metrics tab draws CPU, CPU throttled, memory, disk and network for each service. A service with a public address also gets requests, 5xx and p95 latency, which Gagarin measures at the edge. CPU, memory and disk carry the service's limit as a dashed line. Each point is the peak of its step, so on the 30-day window you read the worst moment of each two hours.

The Metrics tab in the Gagarin console: one service selected, six charts for CPU, CPU throttling, memory, network, requests and 5xx over the last hour, each with a shared cursor at 11:43 PM

The cursor sits on a burst of requests, and every chart reads 11:43 PM.

A web service

Alerts cover its memory, CPU and 5xx. Latency has no alert, so p95 is the chart you read yourself. This is a real week of one of our own sites, with the project renamed:

$ gg metrics shop/web --window 7d
shop/web, last 7d (1800s steps)

              LAST        TAKEN     AVG        PEAK        LIMIT      PEAK/LIMIT
  cpu         0.01        25m ago   <0.01      0.01        0.5        3%
  memory      81.9 MiB    25m ago   89.2 MiB   107.6 MiB   1.00 GiB   11%
  throttled   9.8%        25m ago   3.1%       24.6%       -          -
  net in      4.6 KiB/s   25m ago   691 B/s    4.8 KiB/s   -          -
  net out     2.6 KiB/s   25m ago   852 B/s    7.2 KiB/s   -          -
  requests    0.37/s      25m ago   0.05/s     0.37/s      -          -
  5xx         0%          25m ago   0%         0%          -          -
  p95         189 ms      25m ago   209 ms     903 ms      -          -

CPU peaked at 3% of its limit, and at its worst a quarter of CPU periods came out throttled. The two figures don't contradict each other. Throttling counts the 100 ms slices in which the container used up its quota, and a render or a cold start can do that in a burst too short for the CPU line to show. Drag the cursor to the p95 spikes on the tab. If they land on the throttling spikes, give the service a bigger size.

One request, in 100 ms periods
the request took
250 ms
periods throttled
2 of 3
CPU line, one such request a minute
<0.01 of 0.5

A size s service gets 50 ms of CPU in each 100 ms period. Give one request 150 ms of work and it waits out two periods and takes 250 ms, while the CPU chart, averaged over a minute, barely leaves the floor. Simplified to one thread starting on a period boundary.

The readiness check is a TCP connect to your port. A service that accepts the connection and answers 500 counts as running. The 5xx alert catches it once 20 requests arrive within five minutes, and a quiet internal tool may never get that many. Check its 5xx chart after each deploy.

A worker

A worker without an address has no requests, 5xx or p95, because no traffic of its own crosses the edge. Watch memory and throttling. A consumer that leaks memory draws a saw on the memory chart: the line climbs, the kernel kills the container at the limit, the line breaks, and it starts again from the floor. Each break also sends a crash push that names the out-of-memory kill.

Memory, a worker that leaks · last 12 hours
12h agonow

Made-up samples. Each orange mark is a kill, and the gap after it is the time nothing was running to measure.

A Postgres

You get CPU, memory and disk against its size. Gagarin doesn't measure connections or query time yet, so too many clients shows up in your app's logs first. Five copies, sixty connections has the arithmetic for each size. Read disk on the 30-day window: the alert fires at 85%, and a line that rises week on week tells you the date before the alert does.

A cron job

The Metrics tab lists services and resources, and a job's container is gone by the time you'd look. Watch the run line under the job in gg status. A good run and a bad one:

  ✓  └ run 2 finished 53m ago, took 3s, exit 0
  ○  └ run 4 failed 4m ago after 60s, exit 3: the container exited with code 3

A failed scheduled run sends a push. A one-off job started with gg run sends none, so check its run line yourself.

Step 5: a ten-minute read once a week

Alerts catch the fast failures. A memory line climbing 2% a week stays under 80% for months and then crosses it on a Saturday. Once a week, read the whole project:

$ gg metrics shop
project shop

  SERVICE   KIND                CPU              MEMORY                   DISK                     THROTTLED   NET IN/OUT          REQ/S    5XX   P95
  db        resource:postgres   <0.01/0.5 (0%)   88.7 MiB/1.00 GiB (9%)   49.3 MiB/9.75 GiB (0%)   0%          54 B/s / 41 B/s     -        -     -
  web       container           <0.01/0.5 (0%)   82.8 MiB/1.00 GiB (8%)   -                        0%          108 B/s / 228 B/s   0.04/s   0%    24 ms

That table shows each service now. For anything that looks warm, run gg metrics shop/SERVICE --window 30d and read the PEAK/LIMIT column:

  • A memory peak above 70% of the limit means resize before the 80% alert picks the hour for you.
  • Throttling in double digits that lines up with p95 spikes calls for a bigger size or more copies.
  • Divide a disk's free space by its monthly growth and you have the months left.

Hand the habit to your agent. It has the same reads as MCP tools (status, metrics, logs), so a prompt like "every Monday, check each of my projects and tell me any service whose 30-day peak passed 70% of its limit" runs from the numbers.

What Gagarin won't watch for you

The dashboards are fixed. You get no query box, no custom panels and no metrics from inside your code. We explain why in the worst moment of every two hours. Plan for these gaps:

  • Uptime from outside. Nothing probes your address from the internet. If a public outage must page you inside a minute, point an external uptime checker at your URL.
  • Latency. Gagarin draws p95 and never alerts on it.
  • Business signals. Signups an hour, queue depth and failed payments live in your code. Send them to your own analytics or error tracker.
  • Long history. Metrics go back 30 days and logs seven. Copy out anything you need longer with gg logs before it ages out.
  • Team channels. Pushes go to the devices each person allowed. There is no Slack, email or PagerDuty route.

Open your project's Alerts tab on your phone at my.gagarin.cloud and press Send a test before you need it.