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 82: Tracking a cruise ship

Breadcrumbs

Breadcrumb

  • Home
  • Part 82: Tracking a cruise ship

Main page content

By whatsuphome | 9:57 PM EEST, Thu June 13, 2024

TL;DR

I monitor a colleague's cruise ship location by scraping vessel data from myshiptracking.com using the Zabbix HTTP agent item type. Dependent items parse longitude, latitude, speed, and heading via regex preprocessing. The data feeds a Zabbix dashboard
What's up, home? part 82 cover image

One of my colleagues still has not learned that if she goes for a vacation, she should not give me the exact name of the cruise ship she's going to. What do I do? Of course, I monitor the cruise ship location with Zabbix.

Tracking a cruise ship? WHY?

Because I can. This all started when she sent me a link to one of the ship tracking sites, like FlightRadar, but for maritime vessels. My response back was "I need to add this to my Zabbix", and here we are.

The challenge

Originally, she sent me to visit Vessel Finder, but it quickly became clear that scraping the geo-coordinates from that site would not be fun at all.

Next, I tried to find a site that would offer an API for tracking these vessels -- yes, quickly found multiple, but they all wanted my money, and I didn't want to pay anything for this fun little experiment.

Finally, I found out myshiptracking.com, which might not have an API, but the page content is easy enough to scrape with the traditional Zabbix HTTP agent item type and some item preprocessing.

So many ships out there!

There are so many ships out there! Anyway, if I click on any of them, I get this. Here's just some random vessel from that flock of ships.

Boat details

On source code, those details are good old HTML.

Longitude

 

Scraping the details

How to track a ship by using Zabbix, then? First, I created a new host, and added a new HTTP agent item to it. The item acts as the master data.

HTTP agent

Next, I created few dependent items ... 

Dependent items

... and parsed any details with some not-pretty-but-working regular expressions. Here's longitude as an example.

LongitudePreprocessing

.. and the regexp as plain text:

.*Longitude.*<\/th>\r\n\s+<td>(.*)°<\/td>

Of course, on item tab, I also made sure that the longitude populates the Longitude inventory field automatically, and same for latitude.

Longitude inventory

Creating a dashboard

Finally, I just added a simple dashboard with a geomap, a new honeycomb widget (admittedly not the best option in this case, as would look ugly with full-length coordinates and speed/course with five decimals....), and a graph.

Dashboard

And I'm done! Not creating triggers for this one, as that would be too much. I really don't need any "Ship has stopped moving" or "Ship is turning" stylish notifications. Not that I would need to track any of this, but such is monitoring nerds life, having some fun in the middle of serious work.

whatsuphome
zabbix
geomap
vesseltracking
scraping
httpagent
  • Add new comment

Comments (4)

  • 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.

speed of ship

misterx (not verified)

2 years 3 months ago
Permalink
New

Hi,
Great post as Always!
I made the same tracking as you described. But i cannot get the value of speed. What regex did you use for this value?

thx!

  • Reply

speed of ship regexp

whatsuphome

2 years 3 months ago
Permalink
New

Yep getting the speed was painful as the table format data there would show there anchor icon and the content would change if vessel was stationary... so I used the longer description text that's available about each ships status (still on same page), and used this regexp

.*<strong>([0-9\.]+) Knots</strong>.*

Cheers,

Janne

  • Reply

In reply to speed of ship by misterx (not verified)

course

Morten (not verified)

2 years 1 month ago
Permalink
New

I tried getting the course from simular regex as longitude, but no luck.Tried feeding the html through regexr to see if I found a working regex, but still no luck. Would you share the coarse regex? Perhaps also the "Status" one would be possible as well. I tried thisone, with no luck.
Latitude.*\n*\t*.*\n*\t*.*\n*\t*\n*\t*Status<\/th>\n\t+(.*)<

  • Reply

In reply to speed of ship regexp by whatsuphome

course regexp

whatsuphome

2 years 1 month ago
Permalink
New

Hi! For course, this works for me: 

.*Course.*<\/th>\r\n\s+<td>(.*)°<\/td>

  • Reply

In reply to course by Morten (not verified)

I monitor a colleague's cruise ship location by scraping vessel data from myshiptracking.com using the Zabbix HTTP agent item type. Dependent items parse longitude, latitude, speed, and heading via regex preprocessing. The data feeds a Zabbix dashboard

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