by acls us

Using InfluxDB and Grafana to monitor TFL Underground Rail Stations

TFLTransport for London (TFL) publishes a lot of Open Data for Public consumption about the status of the London Underground, in real time. This data is updated every 30 seconds in XML format and is mostly documented.

As a proof of concept I wanted to setup InfluxDB to hold the status of the Underground Stations and present the results on a Grafana Dashboard.

The first step was getting hold of the XML data. Unfortunately the SDK does not say what the Domain is to get the XML from. A little Googling allowed me to find the XML I needed here.

The next step was to extract the data needed from the XML. I wanted to get the name of the TFL Underground Station, It's status and a description of any issues. A simple PHP script was used to get this data, format it and use an Influx file import to add the data to an Influx Database. The PHP script is runs under cron every 60 seconds.

Finally I created a simple Grafana Dashboard using "Table Panel" panels to show the data.