Skip to header Skip to main navigation Skip to main content Skip to footer

Search form

Site branding

Home
What's up, home?

Main navigation

  • Home
  • Story mode
  • About
  • Features
  • Hardware list
  • Videos
  • GitHub (opens in new tab)
  • Daily AI generated stories (opens in new tab)

Part 133: Some proper train-ing material

Breadcrumbs

Breadcrumb

  • Home
  • Part 133: Some proper train-ing material

Main page content

By whatsuphome | 7:00 AM EEST, Fri October 24, 2025

TL;DR

I used Finland's Digitraffic open data API to fetch real-time train departure and arrival data for my local station, then built a Zabbix HTTP Agent template to parse the JSON response. The template tracks delays, cancellations, and status changes with
What's up, home? part 133 cover image

This blog post again belongs to topic I spoke about back in Zabbix Summit 2025 -- how do I monitor my nearby environment with Zabbix and how it can help planning my day.

You probably know how annoying it would be to go to train station, only to find out that your train has been cancelled, badly delayed or that you just missed the train for some reason. Zabbix to the rescue!

Let's monitor if

  • my train is on time
  • if it is not, how badly it is delayed
  • or worse, if the train is cancelled

And more.  But how do we even start?

Train info is open data

In Finland, we have tons and tons of official open data available, both APIs and datasets. No matter if you need data about traffic, weather, nature, population, you have it.

One of the places is Digitraffic, which contains way too many details about trains (among other things).

For my purposes, I only wanted to get some data about the train(s) I care about. For that, here's the query I came up with: 

https://rata.digitraffic.fi/api/v1/live-trains/station/MLA?minutes_befo…

Adding that to Zabbix

Like so many times before, the story begins with a new template, which contains a HTTP Agent item acting as a master item.

Master data item

Then there's bunch of dependent items, parsing interesting pieces from the JSON response.

Items list

Each of the items then does relevant preprocessing, such as in the case if the train is cancelled or not. Note that it also converts a boolean to decimal so I can keep track of the status in numeric format.

Item preprocessing

Dashboard time

Finally, with all the items added, it is of course easier to spy the results through a dashboard. Here we go -- this is part of my unified single pane of glass dashboard providing me info about many details related to my day and life.

Trains

Those of you who might be new to Zabbix might be wondering how I created those "Difference to scheduled time" kind of widgets. For that, I used a very simple Calculated item:

Calculated item

 

Formula in plain text: last(//traffic.trains.actualtime) - last(//traffic.trains.scheduledtime)

To complete this, I could add alerting if a train is badly delayed or cancelled -- but this particular blog post is more proof-of-concept, as in reality I don't need to travel with train very often. :D 

 

 

whatsuphome
zabbix
zabbixsummit2025
trains
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
I used Finland's Digitraffic open data API to fetch real-time train departure and arrival data for my local station, then built a Zabbix HTTP Agent template to parse the JSON response. The template tracks delays, cancellations, and status changes with

Search

Who am I?

  • Janne Pikkarainen from Finland 🇫🇮
  • Began with computers in 1986 with C64
  • Doing IT for living since 1999
  • Principal Site Reliability Engineer at Forcepoint
  • A Zabbix Summit speaker every year since 2022
  • Walking, talking Zabbix commercial

Support my project

Buy me a coffee 

Footer menu

  • Contact

What's up, home? | Janne Pikkarainen | contact(at)whatsuphome.fi | 2022 - 2026

Developed and Designed by Janne Pikkarainen