Running a switch: uptime, success rates per bank and connecting to other switches
A switch sits between every sender and every receiver, so every failure lands on its dashboard and the question is whose it is. Count success by the bank that answered, not by the network, and page the switch only when many banks fail together
In the lab's week, the bank B07 was unavailable on Wednesday from 11:02 to 11:49. B07 is a large bank. In that window, how many transfers to or from B07 show a failed first response, and how does the number of transfers compare with the same 47 minutes on other days?
A switch operator watches one network and answers one question all day: is it the sender, the receiver, the link between them, or us? Every transfer crosses all four. Chinedum’s centre can see messages, not accounts, ledgers or customers. Each message shows who sent it, who it was for, and what answer came back and how fast. The rest is inference. The earlier chapters taught the clients of a switch: Nigeria’s rails the rails themselves, and payment states and refunds the unknown outcome. This chapter takes the other seat. The later chapters of this module cover the inside of a switch, its settlement files, and what happens when a bank or a switch goes down; here you build the instrument panel.
What counts as a success
Start with the transfers table. Each row has a first_response, the answer the sender got when it asked the switch, and a final_status, what a later status query established. The lab’s codes are illustrative, modelled on the instant-payment codes you met in module 1, and are not any switch’s real list. Across the lab’s 17,998 transfers the first answers are:
| First answer (lab code) | What it means in the lab | Whose signal it is | Counts as a fault of |
|---|---|---|---|
00 |
credited | none | nobody |
57 (86 transfers) |
refused: account frozen | the receiving bank’s own policy | nobody: the system did its job |
07 (403 name enquiries, 43 transfers) |
no such account: at a name enquiry a mistyped number; at a transfer, a closed account | the sender’s customer, or the receiving bank’s own record | nobody |
51 (4 transfers) |
the sender is over its collateral limit | the sender | the sender, not the receiver |
91 (11 name enquiries, 4 transfers) |
the receiving bank says it is unavailable | the receiver | the receiver |
97 (101 transfers) |
no answer within the lab’s 30 seconds | unknown | decided by what else is failing |
96 (none this week) |
a system error; the lab’s code, never produced in the week | the receiver | the receiver |
Two rules follow, and the lab enforces both. A refusal is a success of the network: the receiving bank answered, correctly (a 07 at a transfer is a closed account, refused as it should be). A 51 belongs to the sender, so it must never count against the bank it was heading for. Count refusals as faults and the hourly table puts B16 in red on the lab’s Thursday afternoon, when it only refused one frozen account.
The lab’s 97 is the hard one (other platforms define 97 differently). It is not a failure: it is “I do not know”. In the lab 38 of the 101 timeouts (38%) ended credited after a status query, and 63 did not; the receiving banks’ own logs show four more of those 63 credited, payments that no status query ever resolved. This is the pending state seen from the switch, and the switch cannot settle it at the time. A real-time success rate that counts every 97 as a failure calls at least 38 transfers faults that were in fact credited, and one that ignores the 97s hides the incident. The compromise is to keep 97 as its own column, never fold it into either side, and treat a burst of it as a symptom.
That is the first design decision: success rate is not one number. Report answered, refused, unavailable and unknown separately, and alert on the ones that point at a party.
Why per-bank, per-hour rates mislead
The obvious dashboard groups transfers by receiving bank and clock hour and shows the share answered 00. The lab’s week gives 4,079 such cells, an average of 4.4 transfers each (17,998 ÷ 4,079). Most are tiny: 2,632 of them, 65%, hold fewer than five transfers. In a cell with three transfers, one timeout is a 67% success rate, and one in one is 0%. A rule “alert when the rate is below 95%” fires 216 times in the week; 73 of those alerts rest on fewer than five transfers. Dropping the refusals and counting only technical failures (91, 96, 97) cuts it to 93, and 34 of those still rest on fewer than five.
The lab is deliberately small. A large bank in a busy hour sees far more transfers than that, so a rate is a better measure there. But every network has small institutions and quiet hours (a microfinance bank at 03:00 is a lab-sized sample anywhere), and a rule written on rates alone pages someone for each of them. The remedy is old: for small samples, count events, and let a rate matter only when there is enough traffic. A page should say “four failures across four banks”, not “62.5%”. A rate does help with a large bank: B07 at 11:00 on the Wednesday of its outage is 2 of 6, but that cell is only complete, and only red, at noon.
This is the same advice the site reliability engineering (SRE) literature gives for any service. Google’s book separates symptoms (what is broken) from causes (why), and recommends paging on symptoms a user would notice; the four signals it names are latency, traffic, errors and saturation. A switch has all four: how long the receiving banks take to answer, how many messages arrive, how many come back with a fault, and how close a participant is to a limit such as the lab’s collateral cap. Your work is to attach each signal to a party.
An alert that names a party
The lab’s detector has two rules, and each names who to call.
A bank rule. Page a receiving bank when the bank itself says it is unavailable (a 91), or when it times out three times in an hour. In the lab’s week this fires once, for B07 at 11:07:38 on Wednesday, on a name enquiry that answered 91. The second clause never fires on its own: even at B19’s higher timeout rate, three in an hour does not happen. It would fire once by accident, for B03 at 15:28:15 on Thursday, in the middle of the switch’s incident, so the lab tests the breadth rule first and names the switch.
A switch rule. Page the switch’s own on-call engineer when at least four timeouts or unavailable answers arrive in 15 minutes from at least four different banks. Breadth is the evidence: four unrelated banks do not fail together by coincidence, and one switch can make them fail together. In the lab this fires once, on Thursday at 15:21:54. The incident began at 15:20, and the first timeout was at 15:20:08; the rule fires 1 minute 54 seconds into it, at the fourth distinct bank.
Neither rule uses a percentage. Both use small counts that are rare in a normal week, which is why the week stays quiet: 116 technical failures in seven days, and two pages.
Where did the thresholds come from? From the lab’s own week, and that is a weakness to state plainly. Moving the switch rule from four banks to two raises ten alerts in the same week; three raises two; four and five each raise one. That is a tuning on the same data that it is then judged on. Step 4 of the lab re-runs the rule on three other generated weeks: four and five again raise one switch alert each, while two raises 10 to 11 and three raises 2 or 3. A real operator would also test on weeks of real traffic, including real outages other than the one the rule was built for. The margin matters more than the exact number: here two is too sensitive, three gives a false alert in some weeks, and four and five agree.
A drop in traffic is a signal too
The rule that caught B07 caught it only as fast as a customer happened to ask. B07 is a large bank, in 2,077 of the week’s transfers (12%) and about 20 in a typical 47 minutes at that hour. Its outage began at 11:02. The first 91 was a name enquiry at 11:07:38, 5 minutes 38 seconds in, and the bank page fires then. A rule that read only the transfers table would wait until the first 91 there, at 11:29:37, 27 minutes 37 seconds in, because about a third of transfers pay a saved beneficiary and reuse an earlier name enquiry, so most senders met the 91 before any transfer existed. Read the name enquiries too.
Traffic carries a second signal if you compare it with the same hour on other days. In the 47 minutes from 11:02 to 11:49, B07 normally sees 19, 19, 22 and 22 transfers (Monday, Tuesday, Thursday, Friday) and saw 6 on Wednesday: the two it sent in the first 90 seconds and four paid to it, all answered 91. If arrivals are random with a mean of 20.5, the chance of a window with 6 or fewer is about 0.02%, roughly one in 5,600. So the drop is strong evidence, but only once the window is as long as the outage; it confirms the 91s and is no faster than them.
That points to the one thing that is not in the lab: an active probe. The switch can send its own name enquiry to every participant every minute, against a test account, so that a bank’s state does not depend on customers’ traffic. This is a design option, not a description of what any particular operator does. It costs a little traffic and a test account at every participant, and it turns a detection that waits for a customer into one or two minutes. It also gives you a healthy denominator for banks that are quiet at night.
Quiet is not healthy
B19 never raises a page. Yet it timed out on 11 of 348 transfers (3.16%) in the week, against 90 of 17,650 (0.51%) for every other receiver: about six times as often. A page rule built on bursts stays quiet for a chronic fault because there is no burst. Put it somewhere else: a weekly league table of timeout rates per participant, reviewed with the participant, in the way an SLO is reviewed. An SLO, a service level objective, is a target for a measure such as “99.5% of name enquiries answered within a few seconds”. The SRE workbook’s chapter on alerting on SLOs pairs a long window with a short one so that an alert needs both a sustained problem and a current one. You can borrow the idea without the arithmetic: page on a fast, breadth-based signal, and report on a slow, rate-based one.
The two do different jobs. A page asks a person to act in the next few minutes. A report starts a conversation with a participant about a bank that is slow, and that conversation is part of running a switch.
The Central Bank of Nigeria’s (CBN) 2016 Guidelines on Transaction Switching in Nigeria supersede the earlier switching guidelines and the operational rules for the Nigeria Central Switchas of 2026-11. That description rests on search summaries; the CBN’s PDF came back only as a link, so read it for what a switch must report and to whom. This chapter found no primary document that sets an availability target or a downtime-reporting duty for a switch or for a participant, and states none. Check the current guidelines for both before you design an SLO around a number.
Connecting to another switch
So far the switch is alone. Real card and account switching is not. Where more than one switch exists, how one reaches another has a regulatory answer as well as a technical one.
A search summary of the CBN’s 2009 operational rules for the Nigeria Central Switch (NCS) says licensed switching companies had to connect to the NCS by 30 July 2009 to ensure interoperability, and that the mandate to run the NCS was given to NIBSS (the Nigeria Inter-Bank Settlement System) in 2006; the 2016 guidelines are reported to supersede these rulesas of 2026-11. The CBN’s Payments System Vision 2025 page says interoperability continues as a core principle of Nigeria’s payments systemas of 2026-11. The CBN’s 2020 guidelines on electronic payment channels cover ATMs, point-of-sale terminals and web acceptance, and their contents list a section on transition to interoperability; a later CBN circular, as summarised in search results, cites them for the rule that point-of-sale terminals must accept cards from any Nigerian bank, and a March 2026 CBN ATM guideline, listed by a regulatory-alert aggregator, is reported to supersede their ATM requirementsas of 2026-11. All of this comes from search summaries, not from reading the PDFs, so read the current documents. Where the sources agree: interconnection and interoperability are stated aims and rules, not an option. This chapter found no source on how one switch connects to another in practice, and none on any particular operator’s connections, and says nothing about them. A Guardian Nigeria opinion column (advocacy, not a rule; a search could not find the BusinessDay original) argues that Nigeria’s card rails should stay open to all processors and that providers should publish quarterly metrics on card uptime, routing and feesas of 2026-11. This chapter found no reply from the operators or the CBN, so treat it as one side of a contested question.
For an engineer the arrangement reduces to a routing question. A switch receives a message for a receiving bank it does not host. It looks up the bank in a routing table, finds the next hop (another switch), forwards the message, and waits for the answer to come back along the same path. Three things go wrong, and the lab’s third step shows each.
- Shared fate. If the link between two switches fails, every transfer that crosses it fails, whichever banks are involved. A per-bank view then shows many unrelated banks failing.
- Loops. If switch Y forgets that a bank is its own and sends the message back to X, and X forwards it again, the message circles. A hop limit stops it.
- A budget spent twice. The original sender waits a fixed time for an answer. Each hop uses some of it; a slow second switch can make the first one time out, and the sender cannot tell which hop was slow. A timeout through a link is even more ambiguous than a timeout from a bank.
The lab does not model a second switch. Step 5 makes an exercise of it: it splits the participants arbitrarily into two groups, X and Y, joined by one link, and asks what the dashboard would show if that link failed. The split is invented for the exercise. It says nothing about how any real switch is connected.
What the dashboard should name
Put the rules together and the dashboard has a small vocabulary. Each pattern has a name, and the name decides who is phoned.
| What the switch sees | The dashboard names | First action |
|---|---|---|
| a 91 from one bank, or repeated timeouts at one bank | that bank | phone its operations team; tell the senders it affects |
| timeouts across four or more banks within minutes | the switch | page the switch’s own on-call first; hold the bank calls |
| every failure crosses one link between two switches | the link, and the peer switch | page the peer’s operations centre |
| a bank slower than its peers, with no burst | that bank, in the weekly report | review it with the participant |
| a bank whose traffic has dropped against its usual, or has gone silent | that bank, after the window | run a probe; do not wait for customers |
a 51 |
the sender, not the receiver | the sender’s treasury (see the chapter on how banks settle with each other) |
The last row ties to the settlement chapters: a collateral limit is the sender’s own, and the dashboard that blames the receiver sends the call to the wrong team.
Where this goes wrong
Four mistakes recur.
- Averaging over time and banks. Over the whole of Thursday the share of transfers answered
00is 98.13% (2,942 of 2,998); over the 14 minutes of the incident it is 54.35% (25 of 46). The day’s figure shows a blemish, and the incident only shows in the minutes. A switch needs a per-participant view and a breadth view, over short windows; one daily figure gives the incident nowhere to show. - Counting
97as a failure and retrying. Senders that treat the unknown as a no and send again create a second wave and a duplicate-payment risk, the very thing payment states warned against. The switch’s own graphs go up while the problem is getting worse. - Blaming the receiver for a link. Phoning thirteen banks to say they are down, when one link is, wastes the hour and spends credibility. Group by the pair of switches before you group by bank.
- Tuning to the incident you have. A threshold set so that last week’s outage fires, and nothing else did, may be fitted to last week. State the data it was tuned on, and test it on another week.
Later in this module, the chapter on what happens when a bank or a switch goes down follows the other half of the story: the senders’ retries after the outage and what each party’s customers saw.
You work in labs/finance. This lab reads one database, data/rails.sqlite, with Python’s own sqlite3 module; the sqlite3 command-line tool is not needed. Every code, threshold and timing is the lab’s own, not any switch’s.
1. Generate the week and check it. It takes about a second.
cd labs/finance
python3 rails.py
python3 check.py --rails-onlyrails.py prints:
32 participants, 22,835 accounts, 17,998 transfers, 12,158 name enquiries, 136 status queries
21 settlement sessions, 125 batch files, 193 RTGS payments, 3,412 USSD sessions, 3,453 PSB postings
planted (answers/rails_truth.csv): credited_without_settlement 4, customer_fee_not_charged 6, customer_reversed_twice 3, levy_not_charged 5, mmo_trust_shortfall 1, participant_limit 4, participant_outage 1, psb_cash_out_fee_not_posted 1, psb_cash_out_posted_twice 1, reversed_after_late_success 4, same_number_two_banks 8, switch_incident 1, telco_record_missing 12and check.py prints rails week: 17,998 transfers, 21 settlement sessions, 22,835 accounts; checks 21-25 run and then OK: all invariants hold. Seed 42 gives the same numbers every time. Leave answers/ closed: this chapter does not need it.
2. Success per receiving bank per hour, the naive way. Run this from labs/finance.
python3 - <<'PY'
import sqlite3
db = sqlite3.connect("data/rails.sqlite")
# One row per receiving bank per clock hour: how many transfers, how many answered 00,
# how many failed for a technical reason (91, 96, 97), how many were a refusal (57, 51).
cells = db.execute("""
SELECT dest, substr(at, 1, 13) AS hour, COUNT(*) AS n,
SUM(first_response = '00'), SUM(first_response IN ('91', '96', '97'))
FROM transfers GROUP BY dest, hour""").fetchall()
print(f"bank-hours with traffic: {len(cells):,}")
small = sum(1 for c in cells if c[2] < 5)
print(f" with fewer than 5 transfers: {small:,} ({100 * small / len(cells):.0f}%)")
naive = [c for c in cells if c[3] / c[2] < 0.95]
print(f"naive rule, share answered 00 below 95%: {len(naive)} alerts")
tech = [c for c in cells if 1 - c[4] / c[2] < 0.95]
print(f"technical failures only, below 95%: {len(tech)} alerts")
for label, rows in (("naive", naive), ("technical", tech)):
few = sum(1 for c in rows if c[2] < 5)
print(f" {label}: {few} of {len(rows)} alerts rest on fewer than 5 transfers")
print("\nthe busiest hours among the naive alerts")
print(f" {'bank':<5} {'hour':<14} {'n':>3} {'00':>3} {'rate':>6}")
for dest, hour, n, ok, bad in sorted(naive, key=lambda c: -c[2])[:5]:
print(f" {dest:<5} {hour:<14} {n:>3} {ok:>3} {100 * ok / n:>5.0f}%")
print("\nwhy: the 57 answers (account frozen) are the receiving bank doing its job")
for code, n in db.execute("SELECT first_response, COUNT(*) FROM transfers GROUP BY 1 ORDER BY 2 DESC"):
print(f" {code}: {n:,}")
PYbank-hours with traffic: 4,079
with fewer than 5 transfers: 2,632 (65%)
naive rule, share answered 00 below 95%: 216 alerts
technical failures only, below 95%: 93 alerts
naive: 73 of 216 alerts rest on fewer than 5 transfers
technical: 34 of 93 alerts rest on fewer than 5 transfers
the busiest hours among the naive alerts
bank hour n 00 rate
B06 2026-06-16T08 19 18 95%
B12 2026-06-17T10 19 18 95%
B01 2026-06-17T08 18 17 94%
B01 2026-06-18T08 18 16 89%
B06 2026-06-15T13 18 17 94%
why: the 57 answers (account frozen) are the receiving bank doing its job
00: 17,760
97: 101
57: 86
07: 43
91: 4
51: 4The 216 alerts are 5.3% of the 4,079 cells. The first line of the table, B06 at 18 of 19, is 94.7% and displays as 95%: one failure in a busy hour is enough. Notice how few 91s the first answers hold: four, all to B07. A transfer to a bank that is down usually stops at the name enquiry, which answers 91; only a sender paying a saved beneficiary, whose earlier name enquiry is reused, reaches the transfers table with one. That is why step 3 reads the name enquiries too.
3. Build the alert. This reads technical failures from both the transfers and the name enquiries, applies the bank rule and the switch rule, and then asks four questions of the week. It is saved as alerts.py, because step 4 runs it again on other weeks.
cat > alerts.py <<'PY'
import sqlite3
import sys
from datetime import datetime, timedelta
db = sqlite3.connect(sys.argv[1] if len(sys.argv) > 1 else "data/rails.sqlite")
# Every technical failure the switch saw, blamed on the receiving bank at first sight:
# a transfer answered 91, 96 or 97, or a name enquiry answered 91.
events = []
for at, dest, kind in db.execute(
"SELECT at, dest, first_response FROM transfers WHERE first_response IN ('91', '96', '97')"):
events.append((datetime.fromisoformat(at), dest, kind))
for at, dest in db.execute("SELECT at, dest FROM name_enquiries WHERE response = '91'"):
events.append((datetime.fromisoformat(at), dest, "91"))
events.sort()
print(f"{len(events)} technical failures in the week")
def window(i, minutes):
"""The events in the `minutes` before event i, including it."""
t = events[i][0]
return [e for e in events[:i + 1] if t - timedelta(minutes=minutes) < e[0] <= t]
def alerts(k_banks=4, minutes=15):
out = []
for i, (t, bank, kind) in enumerate(events):
w = window(i, minutes)
banks = {e[1] for e in w}
if kind == "91":
out.append((t, "bank", bank, f"{bank} answered 91"))
elif len(w) >= k_banks and len(banks) >= k_banks:
# breadth first: failures at many banks are the switch's, not each bank's
out.append((t, "switch", "", f"{len(w)} failures across {len(banks)} banks in {minutes} minutes"))
elif len([e for e in window(i, 60) if e[1] == bank and e[2] == "97"]) >= 3:
out.append((t, "bank", bank, f"{bank} timed out 3 times in an hour"))
# one line per episode: ignore a repeat of the same kind and subject within 30 minutes
shown, last = [], {}
for a in out:
key = (a[1], a[2])
if key in last and a[0] - last[key] <= timedelta(minutes=30):
last[key] = a[0]
continue
last[key] = a[0]
shown.append(a)
return shown
for t, who, bank, why in alerts():
print(f" {t:%a %d %b %H:%M:%S} page the {who:<6} {why}")
print("\nhow many episodes each threshold would raise in the same week")
for k in (2, 3, 4, 5):
n = len([a for a in alerts(k_banks=k) if a[1] == "switch"])
print(f" {k} banks in 15 minutes: {n} switch alert(s)")
print("\nthe naive hourly rule over the incident hour (Thursday 15:00 to 16:00)")
red = db.execute("""SELECT dest, COUNT(*), SUM(first_response = '00') FROM transfers
WHERE at >= '2026-06-18T15:00' AND at < '2026-06-18T16:00'
GROUP BY dest HAVING 1.0 * SUM(first_response = '00') / COUNT(*) < 0.95 ORDER BY dest""").fetchall()
print(f" {len(red)} banks red: " + ", ".join(f"{b} {ok}/{n}" for b, n, ok in red))
print("\nthe whole of Thursday against the 14 minutes of the incident, share answered 00")
for label, lo, hi in (("all of Thursday", "2026-06-18T00:00", "2026-06-19T00:00"),
("15:20 to 15:34", "2026-06-18T15:20", "2026-06-18T15:34")):
n, ok = db.execute("SELECT COUNT(*), SUM(first_response = '00') FROM transfers WHERE at >= ? AND at < ?",
(lo, hi)).fetchone()
print(f" {label:<16} {ok:>5,} of {n:>5,} {100 * ok / n:.2f}%")
print("\nB07 on Wednesday, 11:02 to 11:49, against the same 47 minutes on the other weekdays")
for day in (15, 16, 17, 18, 19):
n, to = db.execute("""SELECT COUNT(*), SUM(dest = 'B07') FROM transfers WHERE (src = 'B07' OR dest = 'B07')
AND at >= ? AND at < ?""", (f"2026-06-{day}T11:02", f"2026-06-{day}T11:49")).fetchone()
print(f" {day} June: {n:>2} transfers to or from B07, {to:>2} of them to it")
n, ok, bad = db.execute("""SELECT COUNT(*), SUM(first_response = '00'), SUM(first_response = '91') FROM transfers
WHERE dest = 'B07' AND at >= '2026-06-17T11:00' AND at < '2026-06-17T12:00'""").fetchone()
print(f"\nthe hourly rule's view of B07 at 11:00 on Wednesday: {ok} of {n} answered 00 ({100 * ok / n:.0f}%), {bad} answered 91")
print("\nquiet is not the same as healthy: first-answer timeout rate for the week")
for label, cond in (("B19", "dest = 'B19'"), ("every other receiver", "dest <> 'B19'")):
n, to = db.execute(f"SELECT COUNT(*), SUM(first_response = '97') FROM transfers WHERE {cond}").fetchone()
print(f" {label:<21} {to:>3} of {n:>6,} {100 * to / n:.2f}%")
PY
python3 alerts.py116 technical failures in the week
Wed 17 Jun 11:07:38 page the bank B07 answered 91
Thu 18 Jun 15:21:54 page the switch 4 failures across 4 banks in 15 minutes
how many episodes each threshold would raise in the same week
2 banks in 15 minutes: 10 switch alert(s)
3 banks in 15 minutes: 2 switch alert(s)
4 banks in 15 minutes: 1 switch alert(s)
5 banks in 15 minutes: 1 switch alert(s)
the naive hourly rule over the incident hour (Thursday 15:00 to 16:00)
14 banks red: B01 12/14, B02 5/7, B03 8/11, B06 9/10, B07 14/16, B09 4/5, B10 6/8, B15 11/12, B16 10/11, B17 12/13, B21 2/3, B22 11/13, B24 0/1, S02 1/2
the whole of Thursday against the 14 minutes of the incident, share answered 00
all of Thursday 2,942 of 2,998 98.13%
15:20 to 15:34 25 of 46 54.35%
B07 on Wednesday, 11:02 to 11:49, against the same 47 minutes on the other weekdays
15 June: 19 transfers to or from B07, 5 of them to it
16 June: 19 transfers to or from B07, 11 of them to it
17 June: 6 transfers to or from B07, 4 of them to it
18 June: 22 transfers to or from B07, 12 of them to it
19 June: 22 transfers to or from B07, 10 of them to it
the hourly rule's view of B07 at 11:00 on Wednesday: 2 of 6 answered 00 (33%), 4 answered 91
quiet is not the same as healthy: first-answer timeout rate for the week
B19 11 of 348 3.16%
every other receiver 90 of 17,650 0.51%Two pages in a week of 116 technical failures. The bank page for B07 comes 5 minutes 38 seconds after the outage began at 11:02, from a name enquiry; the first 91 in the transfers table is not until 11:29:37, so a rule that read only transfers would page 27 minutes 37 seconds in. The switch page comes 1 minute 54 seconds after the incident began at 15:20. Of the fourteen banks in red over the incident hour, thirteen had timed out, some on one transfer in one or two (B24 0 of 1, S02 1 of 2, B21 2 of 3); B16 had only a frozen-account refusal (57). On Wednesday, B07’s hourly cell at 11:00 is 2 of 6: red, but small, and complete only at noon. The four 51s of the week are all B13 as sender, on Friday between 12:16 and 12:18, before the 12:19 top-up, when its net debit in the open session would have passed its collateral; no rule here counts them, so they raise no page. The thresholds were chosen on this one week, so you cannot judge them from it. Step 4 runs them on three other weeks.
4. Test the thresholds on other weeks. Step 3 tuned the rule on one week. rails.py --seed draws a different week, with different customers and different random timeouts. The B07 outage and the Thursday incident are fixed in the generator, so they recur at the same clock times. This tests whether the rule stays quiet on ordinary failures; it does not test whether it would catch a different kind of incident.
for s in 3 7 11; do
python3 rails.py --seed $s --out data/seed$s > /dev/null
echo "seed $s"
python3 alerts.py data/seed$s/rails.sqlite | sed -n 1,9p
doneseed 3
120 technical failures in the week
Wed 17 Jun 11:06:13 page the bank B07 answered 91
Thu 18 Jun 15:21:48 page the switch 4 failures across 4 banks in 15 minutes
how many episodes each threshold would raise in the same week
2 banks in 15 minutes: 11 switch alert(s)
3 banks in 15 minutes: 2 switch alert(s)
4 banks in 15 minutes: 1 switch alert(s)
5 banks in 15 minutes: 1 switch alert(s)
seed 7
113 technical failures in the week
Wed 17 Jun 11:04:46 page the bank B07 answered 91
Thu 18 Jun 15:23:40 page the switch 4 failures across 4 banks in 15 minutes
how many episodes each threshold would raise in the same week
2 banks in 15 minutes: 11 switch alert(s)
3 banks in 15 minutes: 3 switch alert(s)
4 banks in 15 minutes: 1 switch alert(s)
5 banks in 15 minutes: 1 switch alert(s)
seed 11
111 technical failures in the week
Wed 17 Jun 11:16:45 page the bank B07 answered 91
Thu 18 Jun 15:23:41 page the switch 4 failures across 4 banks in 15 minutes
how many episodes each threshold would raise in the same week
2 banks in 15 minutes: 10 switch alert(s)
3 banks in 15 minutes: 2 switch alert(s)
4 banks in 15 minutes: 1 switch alert(s)
5 banks in 15 minutes: 1 switch alert(s)On all three weeks, and on seed 42, four banks and five banks each raise exactly one switch alert and the bank rule pages only for B07. Two banks raises 10 or 11 and three raises 2 or 3, so those two are the unstable choices. The first 91 for B07 comes between 11:04 and 11:17 in these weeks (11:07 on seed 42), 2 to 15 minutes after the outage began: the page waits for whichever customer asks first, which shows how much detection time depends on traffic. Four held on four weeks, but it is still four weeks of one generator with the same two planted events.
5. Join two switches. The lab has one switch. This step splits the participants into two arbitrary groups to ask what a link between two switches does to the view.
python3 - <<'PY'
import sqlite3
from collections import Counter
from datetime import datetime
db = sqlite3.connect("data/rails.sqlite")
# An arbitrary split, made for this exercise only: the lab has one switch. Suppose the
# participants were attached to two switches, X and Y, joined by one link.
Y = {f"B{n}" for n in range(13, 25)} | {"S02", "M01", "M02"}
home = lambda p: "Y" if p in Y else "X"
rows = db.execute("SELECT at, src, dest, first_response FROM transfers").fetchall()
cross = [r for r in rows if home(r[1]) != home(r[2])]
print(f"{len(cross):,} of {len(rows):,} transfers ({100 * len(cross) / len(rows):.1f}%) would cross the link")
# A hypothetical link outage: Tuesday 16 June, 10:00 to 10:20. Not in the data: we ask
# what the hourly bank view would show if it happened.
start, end = datetime.fromisoformat("2026-06-16T10:00:00+01:00"), datetime.fromisoformat("2026-06-16T10:20:00+01:00")
hit = [r for r in cross if start <= datetime.fromisoformat(r[0]) < end]
print(f"\nlink down {start:%H:%M} to {end:%H:%M}: {len(hit)} transfers would fail")
dests = sorted({r[2] for r in hit})
print(f" receiving banks that would show failures: {len(dests)}")
print(" " + ", ".join(dests))
sides = {h: sorted({r[2] for r in hit if home(r[1]) == h}) for h in "XY"}
print(f" senders on X would blame {len(sides['X'])} banks, senders on Y would blame {len(sides['Y'])}")
pairs = Counter(f"{home(r[1])} to {home(r[2])}" for r in hit)
print(" grouped by the pair of switches instead of by bank: " + ", ".join(f"{k}: {v}" for k, v in sorted(pairs.items())))
inside = [r for r in rows if home(r[1]) == home(r[2]) and start <= datetime.fromisoformat(r[0]) < end]
print(f" transfers inside X or inside Y in those 20 minutes: {len(inside)}, all unaffected")
# Routing by the receiving bank's code, with a hop limit so a bad table cannot loop.
def route(table, switch, dest, hops=0, trail=()):
if hops > 2:
return f"dropped after {hops} hops: {' > '.join(trail)}"
owner = table[switch].get(dest)
if owner == "local":
return f"delivered at {switch} after {hops} hop(s): {' > '.join(trail + (switch,))}"
return route(table, owner, dest, hops + 1, trail + (switch,))
good = {"X": {p: ("local" if home(p) == "X" else "Y") for p in ("B05", "B20")},
"Y": {p: ("local" if home(p) == "Y" else "X") for p in ("B05", "B20")}}
print("\ncorrect tables")
print(" B05 from X:", route(good, "X", "B05"))
print(" B20 from X:", route(good, "X", "B20"))
bad = {"X": dict(good["X"]), "Y": dict(good["Y"])}
bad["Y"]["B20"] = "X" # Y forgets that B20 is its own and sends it back
print("table with a mistake")
print(" B20 from X:", route(bad, "X", "B20"))
PY9,056 of 17,998 transfers (50.3%) would cross the link
link down 10:00 to 10:20: 31 transfers would fail
receiving banks that would show failures: 17
B01, B02, B04, B05, B06, B07, B09, B11, B12, B13, B15, B17, B18, B19, B20, B22, M01
senders on X would blame 8 banks, senders on Y would blame 9
grouped by the pair of switches instead of by bank: X to Y: 12, Y to X: 19
transfers inside X or inside Y in those 20 minutes: 24, all unaffected
correct tables
B05 from X: delivered at X after 0 hop(s): X
B20 from X: delivered at Y after 1 hop(s): X > Y
table with a mistake
B20 from X: dropped after 3 hops: X > Y > XThe split is arbitrary, and half of all traffic crosses it (50.3%), which is a property of the split and not of any network. The 20-minute outage is hypothetical too. What the numbers show is the shape: 31 failures that a bank-by-bank view spreads across 17 receivers, and that the grouping by pair of switches puts in two groups with one cause. The 24 transfers inside X or inside Y in the same window would all have succeeded. The mistaken table sends the message X, Y, X and the hop limit stops it at the third hop.
Make the switch rule too sensitive. In alerts.py, change the call alerts() to alerts(k_banks=2) and run it again. Two banks in 15 minutes is a lower bar than a week of random timeouts clears, and the list fills with coincidences: the rule raises ten switch alerts in the week instead of one, nine of them outside the incident (Wednesday 11:11, 11:59 and 12:55, Thursday 08:37, 09:45 and 13:34, Friday 12:15, Sunday 07:13 and 10:22). Then restore four and set the window to 60 minutes with alerts(k_banks=4, minutes=60). It raises two switch alerts: Thursday 15:21:54 for the incident, and Wednesday 12:06:41, reporting 18 failures across four banks, of which 15 are B07’s own outage. A longer window lets one bank’s outage count as breadth, and it also remembers failures long after they stop. A threshold is a trade between missing an incident and waking someone for nothing, and the lab’s week cannot tell you where that balance lies for a real network.
Template
# Alert definitions and on-call runbook: <switch or service>
Written by <operations-centre engineer> · Approved by <head of switch operations> · Version <n>, <date>
Decision needed: <what the approver is asked to sign off, and by when>
## What this covers
In scope: <alerts that page a person>. Out of scope: <reports, other systems>.
## Alert: <name>
- Page: <who, by what channel>
- Fires when: <rule in counts and window, not a percentage on a small sample>
- Reads: <tables or logs it uses>
- Points at: <bank, switch, link or sender>
- Last measured: <how often it fired in <data>, and when>
- Not an alert: <answers that look like faults but are not>
## First response
1. <minute 0: acknowledge, open the incident note>
2. <what to check on our own side before calling anyone>
3. <who to hold off phoning, and until when>
4. <first notice to participants: what you observe, not what you suspect>
5. <what makes you escalate or stand down>
## Reports, not pages
<slow problems and the weekly report that carries them, with an owner>
## False-alarm review
<when, who attends, which pages are reviewed, what may change a threshold, how a change is tested>
## Known limits
<what the thresholds were tuned on; what this cannot see> WORKED EXAMPLE
Written by Darasimi, the analyst on call at the switch from this chapter, and approved by Chinedum, who leads the centre. At a real switch an operations-centre engineer writes this page and the head of switch operations signs it. Version 1, 22 June. Decision needed: Chinedum’s sign-off on two alerts before they page anyone.
Bank alert, pages the bank’s operations team through the analyst on call. Fires when a receiving bank answers 91, on a name enquiry or a transfer, or times out three times in an hour (never fired alone in the week). Reads both tables, because a transfer-only rule would have paged B07 at 11:29:37 instead of 11:07:38. Last measured: once in the lab’s week, for B07 on Wednesday. Not an alert: 57 and 07 (the bank doing its job) and 51 (the sender’s own limit; four in the week, all B13 on Friday).
Switch alert, pages the switch’s on-call engineer. Fires on four or more failures from four or more banks in 15 minutes. Last measured: once, Thursday 15:21:54, 1 minute 54 seconds into the incident. Two of the week’s 116 technical failures raised a page.
First response to the switch alert. Acknowledge and open the incident note; check the switch’s own health first; hold the bank calls for ten minutes; post one notice saying timeouts are seen across several banks; stand down or phone banks at minute ten.
Reports, not pages. B19 timed out on 11 of 348 transfers (3.16%) against 0.51% for every other receiver. It goes in the weekly league table, owned by Darasimi.
False-alarm review. Darasimi and Chinedum review every page each Monday. Only Chinedum may change a threshold, and a change is re-run on seeds 3, 7 and 11 first.
Known limits. Four banks was chosen on one week and held on seeds 3, 7 and 11; two banks raised 10 or 11 alerts. The week holds one switch fault, so a different kind of incident may not trip the rule. A flurry of alerts at one bank across several weeks would show it is wrong.
Now you
A month later the switch from the chapter is about to connect to a peer switch, and its head of switch operations will not approve the connection without alert definitions for the link. You write the page. Use step 5 of the lab as your only data: the participants split arbitrarily into X and Y, 9,056 of 17,998 transfers (50.3%) crossing the link, and a hypothetical 20-minute outage of the link that fails 31 transfers across 17 receiving banks, grouped as X to Y: 12 and Y to X: 19, with 24 transfers inside X or Y unaffected. Define one alert for the link and say how it differs from the switch alert, who is paged (the dashboard table names the peer’s operations centre), and what you check first. The lab has no real link events, so say what you could not measure. Your reader is the head of switch operations, who decides whether the link goes live with this alert.
Self-check
At 15:22 four different receiving banks have timed out within two minutes. Chinedum leads the switch's operations centre and Darasimi is the analyst on call. They have the breadth signal and no cause yet. They have to decide who to contact first, knowing that a call to a bank's operations team costs that team twenty minutes if the bank is not at fault.
- BOOK Site Reliability Engineering, chapter 6: Monitoring Distributed Systems (Google) Beyer, Jones, Petoff and Murphy (eds.), O'Reilly, 2016
The source for separating symptoms from causes and for the four signals of latency, traffic, errors and saturation. Read both sections and the one on alerting; skip the tool-specific examples. The chapter's wording is the one to check against this chapter's summary. Read: Symptoms versus causes; The four golden signals.
- BOOK The Site Reliability Workbook, chapter 5: Alerting on SLOs (Google) Beyer, Murphy, Rensin, Kawahara and Thorne (eds.), O'Reilly, 2018
How to page on a long and a short window together, so that an alert needs a sustained fault and a current one. Read the section on burn-rate alerts; secondary summaries give different tier numbers, so take the figures from the chapter itself. Read: Chapter 5, the burn-rate alerting sections.
- DOC Approved Guidelines on Transaction Switching in Nigeria (CBN, 2016) Central Bank of Nigeria, 2016
The regulator's own text on what a switch must be and do. Read it for obligations on connectivity, reporting and availability. This chapter's account rests on search summaries, so check each section.
- DOC Operational Rules and Regulations for the Nigeria Central Switch (CBN, 2009) Central Bank of Nigeria, 2009
The early rules for the central switch that links approved switches. Read the purpose and the connectivity sections to see the interoperability idea in its first form. It is dated, and the 2016 guidelines supersede it, so read it for history.
- DOC Payments System Vision 2025 (CBN) Central Bank of Nigeria
The central bank's own statement of its payments aims, including the place of interoperability. Read it for the stated principles. It is a vision, not a rule, so it gives direction and no obligation.
- DOC Reviewed and Approved Guidelines on Operations of Electronic Payment Channels in Nigeria (CBN, 2020) Central Bank of Nigeria, 2020
The channel rules for ATMs, point of sale and web acceptance, with a section on interoperability. Read the interoperability section and the roles of switches. Parts have been superseded since, so check the CBN's current circulars.
- POST Nigeria built open rails for money: do not let them close (Guardian Nigeria, opinion) Guardian Nigeria opinion column
Press opinion, labelled as such, arguing that card rails should stay open to all processors. Read it as one side of a contested question, and look for the replies it lacks. It is not a source for any rule.
All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.