Интерактивная карта Zabbix

Will you creating a Zabbix 4.0 version?

Step 4: Add multiple links between two hosts on the map

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

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

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:

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

CONGRATULATIONS! Now you know how to configure Zabbix maps!CONTINUE TO LEARN MOREExamples of Zabbix maps (screenshots)Configure map navigation tree on dashboardSetting custom background image on map

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

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

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

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

Step 3: Add a link between two hosts on the Zabbix map

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

  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 “” macro? We can do the same with the link label, for example you can set this inside the label:

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

Установка Zabbix 3.2 на Freebsd

Теперь начинаем установку непосредственно сервера мониторинга zabbix.

Сначала посмотрим, какие там есть версии:

# pkg search zabbix

Когда вы будете устанавливать, скорее всего выйдет более свежая версия, используйте ее для установки. В моем случае я ставлю самую последнюю версию на момент написания статьи:

# pkg install zabbix32-server-3.2.0

После установки zabbix-server, создадим для него базу данных mysql. Можно установить phpmyadmin и сделать все через него. Но если у вас на этом сервере не будет полноценного web сервера, то делать это излишне. Сделаем все в командной строке. Подключаемся к консоли mysql и выполняем несколько команд.

# mysql -u root -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> flush privileges;

Импортируем схемы базы данных. Идем в каталог со схемами и загружаем их в mysql:

# cd /usr/local/share/zabbix32/server/database/mysql
# cat schema.sql images.sql data.sql | mysql -u zabbix -p zabbix

На запрос пароля вводим ранее установленный пароль password.

Данные для подключения к базе нужно добавить в конфиг сервера. Сначала создадим его, скопировав файл с примерами настроек:

# cp /usr/local/etc/zabbix3/zabbix_server.conf.sample /usr/local/etc/zabbix3/zabbix_server.conf

Открываем его на редактирование и задаем следующие параметры, которые относятся только к подключению в базе данных mysql. Все остальное можно оставить по-умолчанию.

# mcedit /usr/local/etc/zabbix3/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

Добавляем сервер в rc.conf и запускаем:

# sysrc zabbix_server_enable=YES
# service zabbix_server start

Продолжаем установку

Теперь нам надо поставить web морду для zabbix. Устанавливаем из пакетов zabbix32-frontend-3.2.0. В вашем случае посмотрите сами последнюю версию и устанавливайте ее.

# pkg install zabbix32-frontend-3.2.0

frontend тянет за собой все зависимости по php. Но нужно будет вручную установить mod_php. Проверяем какая версия php у нас установлена на предыдущих шагах:

# pkg info | grep php
# pkg search mod_php56
# pkg install -y mod_php56-5.6.26

Поле завершения установки, нужно будет подредактировать конфиги apache24 и php, для удовлетворения требований zabbix.

Открываем /usr/local/etc/apache24/httpd.conf :

�?щем строчку:

DirectoryIndex index.html

и добавляем в конец index.php, чтобы стало вот так:

DirectoryIndex index.html index.php

Далее находим параметр ServerName = и пишем что-то типа:

ServerName=zabbixserver.local

Далее в самый конец добавляем:

   SetHandler application/x-httpd-php

   SetHandler application/x-httpd-php-source

Еще нужно добавить в конфиг Alias и директорию, где лежат файлы web интерфейса zabbix. Добавляем ниже:

Alias /zabbix /usr/local/www/zabbix32


  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
  Allow from all

Сохраняем, закрываем файл.

Теперь создадим конфиг для php и подредактируем его:

# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
# mcedit /usr/local/etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Europe/Moscow
always_populate_raw_post_data = -1

Первые 3 параметра надо изменить, вторые два раскомментировать и установить нужные значения.

Меняем владельца файлов на www у папки usr/local/etc/zabbix:

chown -R www:www /usr/local/www/zabbix3

После этого перезапускаем апач:

# service apache24 restart

Теперь у нас все готово для перехода в web панель и завершения установки. Открываем в браузере страницу http://ip-сервера/zabbix. Вас встретит стартовая страница установки.

Нажимаем «Next step«

На данном этапе проверятся php, если все сделали по инструкции — все будет в статусе OK, если все OK, нажимаем «Next step«

Тут оставляем все в default, в поля User и Password вписывается данные для доступа в mysql, которые мы создали выше и нажимаем «Next step»

Оставляем по default и нажимаем «Next step»

Станица сведений, нажимаем «Next step»

Frontend установлен! Я Вас поздравляю. Нажимаем кнопку «Finish» и попадаем на страницу Авторизации

По умолчанию:

Login: Admin (Обязательно с большой буквы)
Password: zabbix

Далее вы попадете на главную страницу

На этом установка zabbix 3.2.0 закончена

Далее нам не помешал бы zabbix agent на нашем сервере

Размещение объектов на карте

Давайте рассмотрим как же разместить объекты на карте. В первую очередь необходимо в настройках узла выставить «инвентарные данные» в положение «вручную».

Далее у нас есть 2 способа размещения объектов.

Первый способ — прописывание точных координат в самих инвентарных данных. Для этого листаем вниз и находим 2 поля «широта» и «долгота» и в них вписываем координаты.

Второй способ — размещение непосредственно на самой карте. Тут мы переходим на интерактивную карту и справа видим надпись «Узлы сети». При наведении на нее мышкой раскрывается список узлов. Те узлы, которые еще не нанесены на карту будут перед названием иметь значок «мишень», которые уже нанесены на карту — соответственно будут без этой иконки.

Чтобы разместить узел, нажимаете на эту «мишень» и далее просто тыкаете левой кнопкой мыши на то место, куда необходимо разместить данный узел.

Вот и все. На этом размещение узла закончено. Если вы не будите переставлять узел в другое место, то можно вернуть инвентарные данные опять в положение «Авто», если это Вам требуется.

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

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


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 “” to display hostname that is set on Zabbix host and macro “” 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 , and max trigger functions.

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

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

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 how to find out item key names in Zabbix using latest data option

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:

  • Zabbix maps – Example 1
  • Zabbix maps – Example 2
  • Zabbix maps – Example 3
  • Zabbix maps – Example 4

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


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

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


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

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

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


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

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

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

Thank you for reading.

Рейтинг
( Пока оценок нет )
Понравилась статья? Поделитесь с друзьями:
Технарь
Добавить комментарий

Нажимая на кнопку "Отправить комментарий", я даю согласие на обработку персональных данных и принимаю политику конфиденциальности.