Making the best of Zabbix maps

There are different ways to access the data that Zabbix has gathered for you. If you are looking for a graphical way then you will want to try out maps. In this article I will give you an example on how to create useful maps and add live data to labels.

First a sorry to everyone who has eagerly waited for this article that was actually supposed to become a screencast. But I spent wasted lots of our trying to find a decent workflow to produce WebM videos. So I decided to put this article in writing and deal with screencasts later.

The default map

Let us begin. Make sure that you have a Zabbix server and Zabbix web frontend up and running and log in. Navigate to Configuration and Maps and you will get the list of available maps. By default you will only have the “Local network” map which is quite boring. Note that there are two links here. One is called “Local network” and it will take you to the graphical map editor:

The other is called “Edit” and would show the properties of the map:

The graphical editor

The important settings are explained in the diagram above. But let’s take a deeper look at the graphical editor:

You see a map with a grid that shows squares of 50×50 pixels. If you placed icons here they would snap to the next grid location. Also there are “+” and “-” on the top to add or remove icons and links. Icons can be one of:

  • Host
    A host icon represents a host that you monitor with Zabbix. Its label can directly show problems affecting that host.
  • Map
    A map icon is a link pointing to another map. You could create an overview map and if the user clicked on such a map icon it would load another map with a more detailed view.
  • Trigger
    This is an icon that can have different appearance depending on the status of a trigger (disabled, maintenance, problem or normal operation).
  • Host group
    This kind of icon represents an entire group of hosts. It is useful if your map is a bird’s eye view and you just want to know if there are any problems in your group of hosts (e.g. Linux hosts or hosts in a certain geographical location). This way you don’t have to add all the single hosts to the map.
  • Image
    Just a static image. You can give it a custom label. You can add further Images using Configuration, General, Images, Create image.

Labels and macros

A propos labels. Let me show you an example that adds some coolness to your maps:

I hope that this diagram is not too confusing. The red captions are just explanations and are not contained in the map. But the green lines and boxes are part of my example map. As you can see the two hosts fry and screenshots are connected to the Internet icon. The two hosts have a custom label showing the hostname and the current CPU load. Let’s see how this magic works. By clicking on an icon a new popup window will appear containing settings regarding that icon. The icon I use is a host icon. The most interesting part is how I define the label:

The term put in curly braces “{ … }” is called a macro. See also the Zabbix documentation on macros. The {HOSTNAME} macro is expanded to the name of the host connected to the icon (which is selected in the fourth line called “Host”). Since Zabbix 2.0 you should rather use {HOST.HOST} because {HOSTNAME} has been deprecated. “system.cpu.load[,avg1]” refers to the minute-average CPU load on this system – I took this name from an item’s key using copy/paste. And “.last(0)” is important so you get the newest value of this item and not just the item itself. To see what the macro is expanded to you must switch on the “Expand macros” feature in the top line of the maps editor.

Links

So far I am sure that you can follow me and add your own icons and set labels. Adding links is not tricky either – if you know how to create them. Imagine that you created two new icons:

Let us create a link between these two icons. A link is nothing special – just a visual line connecting two icons. To create a link you need to select both icons (holding the Ctrl key while clicking each of them) and click on “Link +” on the top:

To configure the appearance of the line and what label is displayed on it you can edit its settings. This is a bit non-intuitive because the popup window does not show the link – it rather offers a “mass update” of the properties of all selected icons. So just click on one of the two icons and the popup window will change to this:

The diagram will give you an idea on how to reach the settings of the links. Just follow the numbers in order. Now if you want to add live data on the link as in my previous example you can use macros again. Just that you cannot use the {HOSTNAME} macro here because there is no such thing as “this host” as the link is connected to two hosts. So you must specify the hostname explicitly. Other than that the macro should look familiar to you:

Obviously “net.if.in” and “net.if.out” specify the network throughput on the “eth0” interface here. On the bottom there is a Link indicators box that allows you to change the appearance of the link line depending on triggers. In this example the line is a solid bold green line by default. But if the configured trigger fires the line will be displayed as a red dashed line. That way you can visualize any information you want. For example I use it to visualize the connections of the network backbone or the lag between database masters and slaves.

I hope that this article helped you understand basic maps and what you can do with labels and macros. More about maps can be found in the Zabbix documentation. Have fun creating your own maps. And let me know if this has helped you.

34 thoughts on “Making the best of Zabbix maps”

  1. Thank you so much, article very usefull !!

    I have a problem with macro chen i want to show a real time data on a map like you. For cpu load, it’s ok but for a key receveid by zabbix trapper item, i have a “???” instead of the string value that is received by the server.

    Can you help please. thanks !

    1. Christoph Haas

      I'm using trapper items in my maps, too. Works well. Are you sure you are using the correct item key name?

      1. First of all thank you for putting great stuff,

        I am actually trying to put the ASA interface in the link but I dont know if I am doing something wrong becasue it is not picking latest data but showing me my itemkey.

        Here what I am doing,

        I put two host ASA and core Switch and linked them.

        in the Label Field I put ( Inside{ITEM.KEY:ifInOctets2}

        let me know please if you an idea about this.

        thanks

    2. Hi, I’m also seeing ‘???’ when displaying an aggregate in an icon.

      The aggregate is {HOST_NAME:grpsum[HOST_GROUP,item_key,last,0].last(0)}

      I have googled far and wide, but no luck, hoping someone here can help?

  2. The macros don’t work for me on lables. I got: *UNKNOWN*.
    I checked hostname, item, etc.
    Zabbix server version 2.2.2.

  3. Christoph Haas

    I believe that these are the icons of the old 1.x version of Zabbix. I'm not terribly happy with the newer choice of icons myself.

  4. Help with macro

    Hi!
    Thanks for the explanation.

    I’m trying to put this macro in a label’s link, but I only get *UNKNOWN” as result.

    What’s wrong?
    In: {cczswrack4:Item.LastValue[interfaces.ifTable.ifEntry.ifInOctets.14].last(0)}

    Thanks in advance.

    1. I’ve got it!

      ccswrack4 – P14
      In: {cczswrack4:ifInOctets.14.last(0)}
      Out: {cczswrack4:ifOutOctets.14.last(0)}

      Now it’s working.

  5. This still usefull!

    Thanks for share your knowledge, i’ll use on my maps.

    Have a nice day.

  6. GOD BLESS YOU

    THANK YOU SO MUCH !! I’m not really good at using zabbix, it was so painfull to understand how to create a map and add the ! that’s my first time and this article is the perfect response to what I was looking for ! thx a lot again ! #Sorry #ImFrench #MyEnglishIsLikeApproximative

  7. Hello,
    I have a 3COM switch and I’m using discovery rule in my template configuration.
    I made an example “In: {cczswrack4: ifInOctets.14.last (0)}” and did not work.

    As dicovery rule use to 50 port switch, I’m trying to identify this port like this: IN: {SWT-3COM-BTW-DC01: ifInOctets.49.last (0)}, but shows only * UNKNOWN * ..

    Thanks

    1. Hi Danilo,
      Hope you found the error in your syntax? There seems to be a spaces in the syntax, remove the spaces and it should work OK.
      Like this:
      IN: {SWT-3COM-BTW-DC01:ifInOctets.49.last(0)}

  8. Im trying this to monitor port 16 on switch P0-SWITCH
    IN:{P0-SWITCH:ifInOctets.16.last(0)}
    OUT:{-P0-SWITCH:ifOutOctets.16.last(0)}
    and I am getting
    IN:*UNKNOWN*
    OUT:*UNKNOWN*

    where am I going wrong?

  9. sorry I meant
    IN:{P0-SWITCH:ifInOctets.16.last(0)}
    OUT:{P0-SWITCH:ifOutOctets.16.last(0)}

    1. Christoph Haas

      The syntax is more like:
      {P0-SWITCH:ifInOctets[port16].last(0)}

      Zabbix uses the ifDescr table to read the names of the switch ports. So you need to specify the name of the interface/port. “port16” is just an example. Check what your hardware names it.

  10. I also did but am stil getting the same error as *UNKNOWN*
    >>:{p0-switch:ifHCOutOctets.16.last(0)}>>
    <<:{p0-switch:ifHCInOctets.16.last(0)}<<

  11. so im using a hp procurve switch and
    when i do a show tech all
    ifInDiscards.16 = 0
    ifOutDiscards.16 = 0
    so the new command I am using is
    In:{P0-SWITCH:ifInDiscards.16.last(0)}
    OUT:{P0-SWITCH:ifOutDiscards.16.last(0)}
    still getting Unknown anyone used a Hp Procurve to get map results in zabbix?

    1. Christoph Haas

      The point is that Zabbix expects the name of the interface.

      Wrong:
      ifInDiscards.16

      Right:
      ifInDiscards[…]

      The “…” is the name of the interface according to the ifDescr SNMP table.

  12. Thanks that worked. Do you know how I go about doing this on the dell switches( force10). Im getting IN: UNKNOWN and OUT: UNKNOWN. Using the same syntax as I did on the HP Procurve.

  13. How do you write the sum of 2 octet values?
    so if i have 4 IfinOctets from 4 different ports how do i do a sum of all the values together to get a total IfinOctets value in Kbps or Mbps?

  14. I have now got my dell switches showing correct network IN and OUT. I was wondering do you know how I can monitor a specific network card port like eth0 and eth1 as snmp is not enabled on this server as it is a firewall and I do not want to enable snmp. Or do I need snmp for this to work?, zabbix agent is also not installed.

  15. Does anyone know how to automatically create map in zabbix when a host is added in the server?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top