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 50x50 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.

Nhận xét

Bài đăng phổ biến từ blog này

CLEANING UP THE ZABBIX DATABASE

Configuring DHCP Relay service on the FortiGate unit

[Resolved] Amazon EC2 Redhat 7 using 6GB for the root space