IT Support Technician

Case File: Which Ticket First

Thirty tickets are open and the loudest caller is not always the one that matters. Turn the ITIL priority matrix into code: impact plus urgency gives P1 to P4, a VIP moves a ticket up one level, and a ticket that affects 50 users or more is at least P2. Build the queue, find the tickets that the adjustments changed, and write a function that prioritises any list, including an empty one. The tickets are generated for you alone.

50 min

Sabi Logistics · Service Desk 1

Which Ticket First

The service desk works on whichever ticket was opened last, and a till outage waited behind a monitor that flickered

Emeka Support lead · Phone call

Emeka. Yesterday afternoon the till software failed at the depot with a queue of customers, and the ticket sat in our list for forty minutes because three people were working on a flickering monitor, a password and a printer that somebody had opened a few minutes earlier. Nobody did anything wrong by their own rules: we work on whatever is at the top, and the top is whatever came in last.

I want a priority rule that everybody can read and nobody can argue with. We already have the idea: how many people are affected (impact), how soon it must be fixed (urgency), and a table that turns those two into P1 to P4. We have two exceptions we have always applied by feel: a VIP ticket goes up a level, and anything that affects fifty people or more is at least a P2.

I would like it as code, so the same rule is applied to every ticket, and so I can see, afterwards, which tickets the exceptions changed. Then I will know if we have too many exceptions.

The brief

What you need to know first.

  • Incident management is the part of a service desk that restores service when something breaks. Many tickets arrive at once, and the desk cannot work on all of them. Triage is deciding the order.
  • Impact and urgency. In the common ITIL approach, impact says how much the business is affected (here 1 is high, 2 medium, 3 low) and urgency says how soon it has to be fixed (1 high to 3 low). The two together decide the priority. Using both stops a loud but small problem from beating a quiet but serious one.
  • The matrix, as an addition. Add impact and urgency: a sum of 2 is P1, 3 is P2, 4 is P3, and 5 or 6 is P4. (High impact and high urgency, 1 and 1, is P1.)
  • Adjustments. First, a VIP ticket moves up one level: P2 becomes P1, and P1 stays P1 (max(1, p - 1)). Then, a ticket that affects 50 users or more is at least P2: if the priority is lower than P2 it is raised to P2 (min(p, 2)). Apply them in this order, and write the order down: a different order can give a different answer.
  • Reading the file. csv.DictReader(open("tickets.csv")) gives one dict per ticket with text values: write int(t["impact"]). t["vip"] == "yes" is a comparison of text.
  • One function, used everywhere. Write priority(t) once and call it for the counts, the queue and the list of changed tickets. A rule written in three places will, one day, differ in two of them.
  • Sorting the queue. sorted(rows, key=lambda r: (priority(r), r["id"])) puts P1 first and, within a priority, the smaller id (the older ticket) first. [:8] keeps the first eight.
  • Counting by priority. A dictionary that starts with all four keys at zero: counts["P" + str(priority(r))] += 1.
  • Checking the exceptions. Keep the base priority (from the matrix alone) in a second function, and compare: tickets whose two priorities differ were changed by an exception.
  • Your function. priorities(req) takes a list of dicts with numbers and text and returns the list of priorities as text such as "P1", in order. The checks also run it on lists that you cannot see: ones with exactly 49, 50 and 51 affected users, and an empty list.

The lab gives you a service desk’s open tickets, generated for you alone. All names and tickets are invented.

Preparing your data…

On a real system

The lab modelled the rules with a script. These are the commands that you would type on the real thing.

You want toTypeWhat you get
sort a ticket export by priority and age in PowerShellImport-Csv tickets.csv | Sort-Object priority, opened | Format-Tablethe most urgent and oldest tickets first
look at a CSV as a table on Linuxcolumn -s, -t tickets.csv | headaligned columns
apply the impact and urgency matrixIn the service management tool (for example ServiceNow or Jira Service Management): a priority lookup from impact and urgencythe priority is set by rule, not by how loudly the caller asks

Only run commands on systems that you own or have written permission to test.

🔒 The debrief unlocks when you close the case. Finish the lab above.

Write the priority policy

Write the short priority policy for the service desk: what impact and urgency mean, how the matrix turns them into P1 to P4, the two exceptions and the order in which they are applied, how many tickets the exceptions changed in this queue and what you would do if that number were large, why one function is used everywhere, and how the desk will keep the exceptions honest (limits, approvers, review).

0 words

🧪 Want to practise this on your own computer? See how to set up your lab →

📝

Knowledge Check

1 of 4

In the ITIL priority matrix, what do impact and urgency mean?

Report a problem

About: /lessons/case-the-ticket-queue