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.

32 thoughts on “Making the best of Zabbix maps

  • 2013-05-24 at 16:09
    Permalink

    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 !

    Reply
    • 2013-05-24 at 16:23
      Permalink

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

      Reply
      • 2013-05-28 at 11:28
        Permalink

        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

        Reply
        • 2013-05-28 at 23:37
          Permalink

          You forgot to use .last(0)

          Reply
    • 2013-07-17 at 13:28
      Permalink

      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?

      Reply
  • 2014-03-25 at 04:32
    Permalink

    Thank you for your article,it’s very nice!

    Reply
  • 2014-03-25 at 05:00
    Permalink

    I have a question about the map,how to do this with hostgroup?

    Reply
  • 2014-07-17 at 11:07
    Permalink

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

    Reply
    • 2015-04-15 at 11:45
      Permalink

      use “Host name” from host configuration instead of “Visible name” or FQDN

      Reply
  • 2014-10-09 at 10:31
    Permalink

    Thanks so much, my map have In/Out speed now

    Good day!

    Reply
  • 2015-01-15 at 11:01
    Permalink

    Thank you for sharing this.
    The icon is cute , where did you get these icons?

    Reply
  • 2015-01-15 at 13:05
    Permalink

    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.

    Reply
  • 2015-04-12 at 17:53
    Permalink

    Could you add a icon to the link’s label ?

    Reply
  • 2015-04-30 at 17:13
    Permalink

    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.

    Reply
    • 2015-04-30 at 17:22
      Permalink

      I’ve got it!

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

      Now it’s working.

      Reply
  • 2015-05-22 at 20:41
    Permalink

    This still usefull!

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

    Have a nice day.

    Reply
  • 2015-06-24 at 17:05
    Permalink

    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

    Reply
  • 2016-02-27 at 23:32
    Permalink

    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

    Reply
    • 2016-06-17 at 05:42
      Permalink

      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)}

      Reply
  • 2016-06-21 at 09:07
    Permalink

    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?

    Reply
  • 2016-06-21 at 09:08
    Permalink

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

    Reply
    • 2016-06-21 at 09:18
      Permalink

      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.

      Reply
  • 2016-06-21 at 09:30
    Permalink

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

    Reply
  • 2016-06-21 at 10:24
    Permalink

    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?

    Reply
    • 2016-06-21 at 10:28
      Permalink

      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.

      Reply
  • 2016-06-21 at 16:12
    Permalink

    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.

    Reply
  • 2016-06-22 at 10:30
    Permalink

    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?

    Reply
  • 2016-06-22 at 15:11
    Permalink

    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.

    Reply
    • 2016-06-22 at 15:47
      Permalink

      Either the zabbix-agent or SNMP is the way to go.

      Reply
  • 2016-11-20 at 23:32
    Permalink

    the maps has been remove why dir you remove it

    Reply

Leave a Reply

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

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close