See for the official Zabbix site.


Jump to: navigation, search

Automatic selection of map icon element depending on element type


Status: Draft



Zabbix will optionally support automatic selection of map icons based on host profile information depending on information in a host inventory field.


Users will be able to create icon maps. An icon map will consist of mappings. Each mapping will have the following properties (in this order):

  • linked inventory field
  • expression
  • icon

When deciding on which icon to be used, regular expression (perl compatible) will be matched against specified inventory field. Individual mappings will be tried from the top of the list. It will be possible to reorder list by dragging elements.

On a network map level user will be able to specify icon mapping.

Icon mapping will only be available for network map elements "Host" and "Host group". For the latter it will only be available if individual hosts are displayed in an area.

Mapping can be enabled or disabled per element with a checkbox (only visible for "Host" and "Host group" elements). By default, mapping is enabled for elements if specified on the map level. If no mapping is specified on network map level, checkboxes are visible for these elements, but they are disabled and a tooltip informs user why Automatic icon selection is not available.


  • Icon mapping will work only for Monitoring section of Zabbix.
  • if Automatic icon mapping is enabled for map element, in configuration this element will use icon map default icon.
  • Administration -> General -> Icon mapping entry will be added to the dropdown menu, after Images entry.

iconmap properties design :

Iconmap proprties design.png

Buttons/functionality for iconmap properties page : Save, Clone, Delete, Cancel.

  • Icon preview is limited to 24px*24px square.
  • Full size icon can be seen in tooltip after clicking on item preview.
should be specified how exactly is it seen --Richlv 18:52, 31 July 2011 (SAST)
what do you mean by "exactly"? --Vedmak 12:23, 10 August 2011 (SAST)
is it a new page ? is it some javascript "popup" ? if a popup, how can it be closed ? what if full size image is bigger than window size ? --Richlv 12:33, 10 August 2011 (SAST)
it might also be useful to indicate which icons are not displayed at full size, maybe by displaying a small icon of magnifying glass in one corner or something --Richlv 17:35, 13 August 2011 (SAST)
it will be our standard popup, all nice to have features like mag. glass etc, we leave for another issue.--Vedmak
hmm, what is the standard popup ? how does it work (see questions above), do we actually use it anywhere already ? --Richlv 15:33, 21 August 2011 (SAST)
  • Entry sequence can be changed by dragging them up and down with a symbol, located on the left hand side. If there is only one entry in the list, dragging symbol is disabled.
  • Each entry in the list is numbered.
    • Entry priority is top-bottom.
    • Rearranging entries, adding or removing them updates the numbering immediately.
  • On the iconmap level, a "fallback" icon can be configured. For this entry, only icon dropdown and preview are available. It is always positioned at the bottom of iconmap editing form, below Add button. If no expressions match, this icon will be used for the element.
  • In the expression field, global expressions may be used same way as elsewhere. A global expression is referenced by name, prefixed with '@', for example, @global_expression. It is only considered if '@' symbols is the first. Everything after '@' is considered to be a global expression name.
    • If there's an incorrect global regexp reference, matching fails.
  • Only super administrators will be able to manage icon mappings. Read access through the API will be available for everyone.
  • UTF8 is supported for iconmap name.
  • A new drop-down will be added to Map Edit form: 'Automatic icon mapping' (<manual>, 'Icon mapping 1', 'Icon mapping2', etc). It will be located after Background image drop-down. Link next to this dropdown will open icon mapping configuration same way as for item value maps
  • Network map element properties form is changed:
    • Advanced icons checkbox is removed and all icon dropdowns are always visible.
    • For element types 'host' and 'host group' (only if area selected) a new check box will be introduced before Icon (default) : Automatic icon selection (if available) X <- selected by default. If this checkbox is marked, all other icon controls (dropdowns and checkboxes - section Manual icon selection) are disabled.
  • if Automatic icon selection is enabled for map element, all manually defined icons for this element are not removed.
  • if we delete icon that is used in map element, but that element has "Automatic icon selection" enabled, manual icon is removed, and element is assigned with first icon in db in case of default icon, or "Default" in other cases.

Network map element properties mockup: Element properties.png

  • mass update form will be changed too, to be consistent with individual forms.

XML Export/Import

  • Map import/export should be extended. Only icon map name should be exported. XML tag name "iconmap".
  • If importing a map with icon map that does not exist on server, import fails.

Validation & errors

  • For a mapping entry, uniqueness criteria will be "inventory field + expression". Attempting to add another mapping entry with same expression and referencing same inventory field will show a message Icon mapping entry "<expression>" against "<inventory field>" already exists..
  • Name of iconmap must be unique. Error: Icon map with name "<iconmapname>" already exists..
  • Mapping cannot have empty expression. Error: Icon map "<iconmapname>" cannot have a mapping with empty expression..
  • Icon map cannot be deleted if used in a map. Error: Icon map "<iconmapname>" cannot be deleted. Used in map "<mapname>"..
  • Icon cannot be removed if used for icon mappings. Error: Icon "<iconname>" cannot be deleted. Used in icon map "<iconmapname>"..
  • Cannot create/update mapping with wrong inventory link. Error: Icon map "<iconmapname>" has mapping with incorrect inventory link "<inventory_link value>"..
  • If attempting to save icon mapping with incorrect global regexp reference, it fails. Error: Icon map "<iconmapname>" has incorrect global regular expression reference "@<global expression name"..
  • If deleting a used global regexp, it is not checked against used ones in iconmaps.

API changes

  • API will be extended to support management of icon mappings: iconmap.get, iconmap.create, iconmap.update, iconmap.delete.
  • Existing map methods will be updated to support iconmaps; map.create, map.update will have additional parameter "iconmapid"; map.get will return additional parameter "iconmapid".

Database changes

  • Two new tables will be created and two modified:
 FIELD |iconmapid |t_id | |NOT NULL |0
 FIELD |name |t_varchar(64) |'' |NOT NULL |ZBX_SYNC
 FIELD |default_iconid |t_id | |NOT NULL |ZBX_SYNC  |1|images|imageid|RESTRICT
 INDEX |1 |name
 FIELD |iconmappingid |t_id | |NOT NULL |0
 FIELD |iconmapid |t_id | |NOT NULL |ZBX_SYNC |1|icon_map
 FIELD |iconid |t_id | |NOT NULL |ZBX_SYNC  |2|images|imageid|RESTRICT
 FIELD |inventory_link |t_integer | |NOT NULL |ZBX_SYNC
 FIELD |expression |t_varchar(64) |'' |NOT NULL |ZBX_SYNC
 FIELD |sortorder |t_integer |'0' |NOT NULL |ZBX_SYNC
 INDEX |1 |iconmapid
  • Table sysmaps, new field:
 FIELD |iconmapid |t_id | |NULL |ZBX_SYNC |2|iconmap | |RESTRICT 
  • Table sysmaps_elements, new field:
 FIELD |use_iconmap |t_integer |'1' |NOT NULL |ZBX_SYNC

1 - use icon map from map configuration, if available
0 - do not use