create zabbix network maps_step by step tutorial with examples

Create Interactive Zabbix Maps | Learn with Examples (Tutorial)

Zabbix maps are one of many tools we can use to visualize the collected data on Zabbix. Usually overlooked, because not many people know what can be done with Zabbix maps and how powerful they are. Some even use Weathermap plugin to view their network topology without knowing that the same can be done with the network maps in Zabbix. Weathermap plugin looks nice, but it’s too complicated to administer and it often breaks down after Zabbix upgrade.

Don’t complicate your administration with plugins like Weathermap – use Zabbix maps.

In this tutorial, we learn how to create interactive Zabbix network map that can show link traffic (bandwidth) and change the color of the link if there are some problems (red if link goes down or yellow if there is high utilization).

Don’t worry if you have never created a Zabbix map, because I will guide you step-by-step using various examples.

We will configure Zabbix topology map consisting of three hosts just as shown in the picture below.

example of zabbix map with two links between hosts

Check out my post “Monitor Cisco Switch or Router with SNMP template” if you are just starting with Zabbix and you need to monitor your network routers and switches.

As a bonus, in this guide, I will show you how to use the Zabbix Geomap functionality that was introduced in Zabbix version 6.0 (jump to that section).

Zabbix Geomap example
Zabbix Geomap example

Step 1: Create Zabbix network map

To create a network map go to “Maps” under the “Monitoring” tab and click on “Create map” option just as shown in the picture below.

Picture showing how to create a network map in Zabbix - Step 1
Picture showing how to create a network map in Zabbix – Step 1

Name your map and choose dimensions – I will set 900 to the width and 700 for height. Select “Number of problems” under “Display problems” options.

Then, under “Advance labels” select “Label” from the dropdown menu “Host Label type” and select “Nothing” from the “Image label type” dropdown menu.

You can change other things, but for now that will not be necessary. Hit the “Add” button when you are done with configuring.

Picture showing how to create a network map in Zabbix - Step 2
Picture showing how to create a network map in Zabbix – Step 2

You can always return later and change map settings using “Properties” option under “Monitoring” → “Maps” just as shown in the picture below.

Picture showing where you can create or edit Zabbix maps
Picture showing where you can create or edit Zabbix maps

Let’s put some hosts and links on our newly created maps! Click on the “Constructor” option and move to the next step.

Step 2: Add host (map element) on Zabbix map

Just for convenience’s sake we will change some options on the map editor (constructor). Set “On” for “Expand macros” and “20×20” distance for grid lines. Also, make sure that grids are shown on the map.

Picture explaining map editor (constructor) options
Picture explaining map editor (constructor) options

Now add your hosts on the map using steps from the image below.

Picture showing how to add hosts on the Zabbix network map
Picture showing how to add hosts on the Zabbix network map

If the above image is not self-explanatory, here are the steps explaining how to add a host to a Zabbix map:

  1. Click on “Add” on “Map element
  2. Select newly added element on the map
  3. Change “Type” to “Host
  4. Describe “Label” on the host using free text input, or macros or live data from items (more about this later)
  5. Select you host
  6. Select icon for your host, I will use the icon “Router_symbol_(96)”, but you can select something else or even upload a custom icon.
  7. Click on “Apply” button
  8. Update map (don’t forget this!)

Step 4 is a bit confusing so I will explain it with more details.

In my example, I m using macro “{HOSTNAME}” to display hostname that is set on Zabbix host and macro “{HOST.IP}” to display his IP address.

You can display live data from any item inside the host label on Zabbix map using the {host:key.func(param)} macro, but only with avg, last, min and max trigger functions.

In my example, I m displaying the latest value from the item called “ICMP response time” (key “icmppingsec“):

New syntax expression (Zabbix 5.4 and later)
{HOSTNAME} ({HOST.IP})
Latency: {?last(/{HOST.HOST}/icmppingsec)}

Old syntax expression (Zabbix 5.2 and older)
{HOSTNAME} ({HOST.IP})
Latency: {{HOST.HOST}:icmppingsec.last(0)}

Function “last()” tells Zabbix to display the latest data from the item, but you can also use avgmin and max  functions like this:

New syntax expression (Zabbix 5.4 and later)
Latency (now):                   {?last(/{HOST.HOST}/icmppingsec)}
Latency (avg. in last 30 min):   {?avg(/{HOST.HOST}/icmppingsec,30m)}
Latency (max. in last 24h):      {?max(/{HOST.HOST}/icmppingsec,24h)}

Old syntax expression (Zabbix 5.2 and older)
Latency (now):                   {{HOST.HOST}:icmppingsec.last(0)}
Latency (avg. in last 30 min):   {{HOST.HOST}:icmppingsec.avg(30m)}
Latency (max. in last 24h):      {{HOST.HOST}:icmppingsec.max(24h)}

If you don’t know the item key name, you can find that out using “Latest data” tool with enabled “Show details” in filter just as shown in the picture below.

Picture showing where you can create or edit Zabbix maps
Picture showing how to find out item key names in Zabbix using latest data option

Now that we have our hosts on the map let’s add some links between them.

We will configure links to display current network interface inbound/outbound bandwidth and max. hardware speed.

Also, we will connect links with triggers so they will change color if there are some problems: green if everything is OK, red if the interface is down and yellow if bandwidth utilization is over 90%.

All the necessary steps to configure links are shown below.

Picture showing how to add link between two host on Zabbix map
Picture showing how to add link between two host on Zabbix map
  1. Click on one host, then hold the CTRL key and click on another host
  2. Click on “Add” beside “Link” menu to add a link – a new window will appear
  3. Click on “Edit” under “Links” sections
  4. Describe “Label” on the link using free text input, or macros or live data from items (more about this later)
  5. Add triggers on the link and select colors that will appear if they are in a problem state
  6. Click on “Apply” button
  7. Update map (don’t forget this!)

Remember how we displayed live data inside the host label using the “{host:key.func(param)}” macro? We can do the same with the link label, for example you can set this inside the label:

New syntax expression (Zabbix 5.4 and later)
In:{?last(/re01internetgw/net.if.in[ifHCInOctets.2])} / Out:{?last(/re01internetgw/net.if.out[ifHCOutOctets.2])} [{?last(/re01internetgw/net.if.speed[ifHighSpeed.2])}]
re01internetgw:Gi0/0 <> Gi0/1 (core)

Old syntax expression (Zabbix 5.2 and older)
In:{re01internetgw:net.if.in[ifHCInOctets.2].last(0)} / Out:{re01internetgw:net.if.out[ifHCOutOctets.2].last(0)} [{re01internetgw:net.if.speed[ifHighSpeed.2].last(0)}]
re01internetgw:Gi0/0 <> Gi0/1 (core)

And it will resolve to this when viewed on the map:

Picture showing Zabbix map with live data on label

Unfortunately, Zabbix maps are not perfect, they can’t display labels on two or more links without overlapping and links themselves are barely visible.

Luckily there is a workaround for that. You need to upload a transparent image that we will use to route links via a different path.

Download image circle_transparent_4x4 (right click + save links as) and import in Zabbix as custom icon just as shown in the picture below.

Picture showing how to upload a custom icon to Zabbix
Picture showing how to upload a custom icon to Zabbix

Next, add new map element with “Add” button, then click on that element, select type as “Image“, set icons to “circle_transparent_4x4” and hit “Apply” and “Update” map afterwards.

Picture showing how to add additional link without overlapping between two hosts on Zabbix map - Step 1
Picture showing how to add additional link without overlapping between two hosts on Zabbix map – Step 1

Well done! Now you have a barley visable circle on the map that you can use to route links via diffrent path. Using instructions from the picture bellow add one link from that circle to the host A and another link from the circle to the host B.

Picture showing how to add additional link without overlapping between two hosts on Zabbix map – Step 2

The final outcome should look like this:

Picture showing a example of Zabbix map with live data display

You can also use more circles to draw multiple parallel links on a map like this one:

Picture showing how to set two links between hosts

CONGRATULATIONS!
Now you know how to configure Zabbix maps!

CONTINUE TO LEARN MORE
Examples of Zabbix maps (screenshots)
How to configure Zabbix “Geomap” widget on dashboard
How to configure map navigation tree on dashboard
Setting custom background image on map

Step 5: Examples, Tips and Tricks

a. Zabbix maps examples (screenshots)

Run out of ideas for Zabbix maps? Need more examples? Check out these screenshots:

b. How to configure “Map navigation tree” widget on dashboard

Zabbix has a “Map navigation tree” widget that you can use on the dashboard. “Map navigation tree” widget enables you to sort and view maps hierarchically just as shown in the example below.

Example of Zabbix map navigation tree
Picture shows an example of Zabbix map navigation tree

First, create a dashboard just for maps or use the existing dashboard if you want to combine a “Map navigation tree” widget with others.

Picture showing how to configure a Zabbix map navigation tree widget - Step 1
Picture showing how to configure a Zabbix map navigation tree widget – Step 1

On your new dashboard add “Map navigation tree” widget.

Picture showing how to configure a Zabbix map navigation tree widget - Step 2
Picture showing how to configure a Zabbix map navigation tree widget – Step 2

Then add tree element (map) on the “Map navigation tree” widget.

Picture showing how to configure a Zabbix map navigation tree widget - Step 3
Picture showing how to configure a Zabbix map navigation tree widget – Step 3

Great job! Now we must define “Map” widget on the same dashboard that will render maps from “Map navigation tree” widget.

Picture showing how to configure a Zabbix map navigation tree widget - Step 4
Picture showing how to configure a Zabbix map navigation tree widget – Step 4

Add other maps in a hierarchical way or as you wish.

Picture showing how to configure a Zabbix map navigation tree widget - Step 5
Picture showing how to configure a Zabbix map navigation tree widget – Step 5

c. How to configure Zabbix “Geomap” widget on dashboard

Great news! Zabbix can display hosts on a geographical map since the 6.0 version. Unfortunately, it is only possible to display hosts and their active alarms (triggers). You can’t display links between hosts, for that you still need to use a background image – more about that in the next step.

Nevertheless, this widget is extremely useful so let’s see how to configure it.

By default, the geomap displays all hosts with valid geographical coordinates defined under the host inventory. Therefore, first we need to configure the hosts before we can configure the geomap.

For example, I have network switches in London, Amsterdam, Brussels and Frankfurt, so I will copy / paste geographical coordinates  from Google Maps on the hosts in Zabbix.

How to find out latitude and longitude using Google maps
How to find out latitude and longitude using Google maps

Need more details? Here are step-by-step instructions. Navigate to Configuration → Hosts →  Select your Host. Switch to tab Inventory →  Change inventory mod to “Manual” →  Enter coordinates into “Location latitude” and “Location longitude” fields.

How to set latitude and longitude inventory fields on a host in Zabbix
How to set latitude and longitude inventory fields on a host in Zabbix

Great job! Now go to the dashboard section and create a new dashboard or use an existing one.

How to configure"Geomap" widget on Zabbix dashboard - Step 1
How to configure”Geomap” widget on Zabbix dashboard – Step 1

Then create a Geomap widget on the newly created dashboard. Click on that little “Add” button, then select the host groups that contain all the hosts you want to display on the map.

Optionally, in the field “Initial view” you can use the center coordinates and set the default zoom level to be used when the widget is initially loaded. Use format ” <latitude>,<longitude>,<zoom>“, for example 50.896097198252015, 4.195197934217,6. In my example, I will use the latitude and longitude of my center city and zoom level of 6

How to configure"Geomap" widget on Zabbix dashboard - Step 2
How to configure”Geomap” widget on Zabbix dashboard – Step 2

If you did everything correctly, after saving your dashboard you should have a geomap similar to the one in the image below.

Zabbix Geomap example
Zabbix Geomap example

Nice job! You have now learned how to manually define geographic coordinates on hosts and display them on the dashboard.

However, what if you need to set geo coordinates on hundreds or thousands of hosts? Well, you have multiple options for that.

One option involves writing a script that will populate the inventory latitude and longitude fields via the Zabbix API. In this case, you must have coordinates in some database such as CMDB.

Another option would be to use inventory in automatic mode and configure items to gather latitude and longitude information from devices using SNMP protocol or something similar.

d. Custom background image in Zabbix map

You can set custom background image in Zabbix maps.

First, you need to upload the image to Zabbix image repository just as shown in the picture below.

Picture showing how to add custom background image on Zabbix for use on maps
Picture showing how to add custom background image on Zabbix for use on maps

Second, you need to open “Properties” of the map and set your newly added image file as a “Background image”.

Picture showing how to set custom background image on Zabbix map
Picture showing how to set custom background image on Zabbix map


Thank you for reading.

24 thoughts on “Create Interactive Zabbix Maps | Learn with Examples (Tutorial)”

  1. Hi, in the Zabbix maps examples screenshots 1 & 2, i can see the GREEN tick for Up and RED cross for DOWN, how do i get this option? or are these all different icons which need to be created?

  2. Hi
    Label macros/items don’t work in version 6.0. I’ve already checked the documentation and other places, nothing works.
    Any suggestion?

    1. Aldin Osmanagic

      I just tried it on Zabbix 6.0.4 and it works without a problem, just use a questionmark like this: {?last(/{HOST.HOST}/icmppingsec)}

      1. I have a problem with adding hosts. I add about 14 hosts, I can still update and change. But add host 15 cannot update to apply changes.

      2. Hi Everyone,

        We have installed latest zabbix version 6.0 on Ubuntu 22.
        Maps are not working like link indicators , labels on connection between two devices anyone facing this issues or any suggestions on This????

        1. Aldin Osmanagic

          Everything works fine in 6.0. Make sure to replace host macro with real hostname on links – for example “Zabbix server” instead of “{HOST.HOST}”)

    2. The link bandwidth macro not working in 6.0.5 it show *UNKNOWN*. Other marcro working fine. Could you please help?

  3. Cool guide but there’s a small typo in 5.2+ format regarding incoming/outgoing packets:
    net.if.out[ifHCOutOctets.2]) instead of net.if.in[ifHCOutOctets.2])

  4. There is a strange thing – lets say I define width of map 1200, however I am unable to move item/icon further than 900 (size of grid), while actual width shows a lot more space to the right, is that a bug?
    Seems like grid size (width) limitation?

  5. Hi, really nice tutorial !
    Is it possible to display an host / template defined macro on a map ? I searched but no success…

  6. Really, your tutorial really help me how tu use zabbix. I hope that you will also make tutorial how to make own template for zabix in xml format. because this is my problem when I wan to add unfamiliar/unfamous brand to zabbix, cacti or something lik this

  7. Peter Franca

    Very explanatory. Good work mate.

    I’ve been using Zabbix for 4+ years and the trick to bend the link between device was awesome.
    Thanks for sharing your knowledge with us.

  8. How are you getting the various status of the hosts in your examples to display status icons next to the hosts (green check marks, red X, etc.)

    1. Aldin Osmanagic

      Hello,
      When you add a map element to the map, you can set the type to be “host” and then you will see options for setting the type of icon to be displayed depending on the host status (default / ok, problem, maintenance, disabled). However, for this to work, you must first import the appropriate icons (red x or something else) under the Administration section.
      Regards
      Aldin

Leave a Comment

Your email address will not be published.