๐ Amazon CloudWatch: cheat sheet
๐จ The analogyA delivery van's dashboard: gauges, a trip log and warning lights that come on when a reading stays red.
๐ The regular explanationAWS's monitoring service. It stores time-series metrics, evaluates alarms on them that notify or act, collects and queries logs, and draws dashboards, for AWS services and your own applications.
- As the van drives, it keeps sending readings to its gauges, like engine heat once a minute.
- It also writes what happens into the trip log, line by line.
- The engine runs hot and stays hot. The warning light watching that gauge sees the reading stay past its red line, and comes on.
- The light gets your attention, and you open the trip log to find out why it's so hot.
- Van 1 sends an engine heat reading every minute. Its gauge sits on the engine panel and is tagged "van 1".
- Van 2 sends the same kind of reading, but its tag says "van 2", so it gets a gauge of its own.
- Van 1 climbs a steep hill for one minute, then cools down again.
- You ask for the average heat over those five minutes. Van 1 looks calmer than van 2.
- Then you ask for the hottest reading instead. Now the hill shows up on van 1's gauge.
- The light's red line is 80, and it comes on only if 2 of the last 3 readings are over it. Readings are normal, so the light is off.
- One hot reading on a hill. That's only 1 of the last 3, so the light stays off.
- A normal reading, then another hot one. Now 2 of the last 3 are over the line, so the light comes on.
- The light texts the boss and asks the depot to send another van out to share the deliveries.
- With help on the road, the engine cools. The light goes off and texts the boss that all is well.
- Then the van stops sending readings at all. After a few silent minutes the light turns grey, because it can't tell.
- Each van writes lines on its own pages, and both vans' pages go into the deliveries logbook.
- Van 2 writes "flat tyre". The helper reading new lines spots it and nudges the flat tyre gauge up by one.
- More lines arrive, and van 1 gets a flat tyre too. The gauge goes up again.
- You ask the search helper which vans had a flat tyre this morning. It searches every page in the logbook and finds two lines.
- Finally, you tell the logbook to shred pages older than 30 days, so the shelf stops growing.
- You slide the morning check card out of the glovebox. It lists what to show, but holds no readings itself.
- The card fetches the latest engine heat for every van, the warning lights, and the last flat-tyre lines from the trip log.
- The screen shows it all side by side, so you see in one look that everything is fine.
- You switch the screen to last week. The card fetches a week of readings and lines, and every picture redraws.
- Each time a parcel is delivered, the van's meter-reader adds one to its count. Nothing leaves the van yet.
- Once a minute the meter-reader sends one short summary to the dashboard, instead of one message per parcel.
- Meanwhile the van writes its trip log. The ride-along helper copies the new lines onto the dashboard's shelf.
- The helper also reads what the van's own gear can't see, like how full the cargo area is, and sends that to the gauges.
๐งฉ Key questions
- The light's red line is 80 and it needs 2 of the last 3 readings over it. Readings come in as 90, 60, 70. Is the light on?
- Off, because only 1 of the last 3 readings is over the line. The light waits for 2 bad readings out of 3, so a single hot minute on a hill doesn't set it off.
- Van 1's engine got very hot for one minute, but the five-minute average looks calm. Which summary would have shown the hot minute?
- The hottest reading in each stretch. An average smooths a short burst away. The hottest reading keeps it.
- You fit a parcels gauge and tag every reading with the customer's name, so each customer gets their own gauge. Why is that a bad idea?
- Every new name makes a new gauge, and each gauge costs money every month. Thousands of customers means thousands of gauges. Write the customer's name in the trip log instead.
- You set up a helper to count every "flat tyre" line in the trip log, starting today. The log already has last month's flat tyres. What does the gauge show?
- Only flat tyres written from today on. The helper only reads new lines as they're written. To count old ones, ask the search helper instead.