# NagVis Dynamic Maps

## Introduction

The NagVis Dynamic Map source was introducted in NagVis 1.8. It has been created to make it easier to create schematic maps which contain equal kinds of objects.

For example if you like to have one single map which contains several host objects, maybe all hosts which name starts with `srv-`. Without the dynamic maps you would always have to add a host object to your map if you add a new host to your monitoring and also remove it if some of those hosts is being removed.

Using the dynamic maps you can now compute your rule definitions once and every time the monitoring configuration changes, the map checks itselfs if some host needs to be added, removed or repositioned.

Please Note: This feature is only available when you are using the livestatus backend (at the moment).

## How to configure?

You could simply create a new map in the NagVis user interface, configure it to use the source `dynmap` and then change all the `dynmap_*` options to fit your needs.

An alternative way is to create the map configuration by hand. Browse to the map config directory and create a new file, for example named `test-dynmap.cfg`.

Now add the necessary options to the map configuration file you just created:

    global {
        sources=dynmap
        alias=Test Dynmap
        iconset=std_medium
        backend_id=demo
        # Dynmap Parameters
        dynmap_object_types=host
        dynmap_object_filter=Filter: name ~ srv-.*\n
    }

The `sources=dynmap` line tells the map to use the dynmap source for altering the map configuration. The `dynmap_object_types=host` line tells the dynmap source to gather objects of the type host to be shown on the map.

The `dynmap_object_filter=Filter: name ~ srv-.*\n` line contains one or several livestatus filter definitions to be used to filter the map objects.

## Configuring dynmaps

The dynmap uses the following map configuration attributes in the global section of the maps.

Parameter | Default | Description
--- | --- | ---
dynmap_object_types |  | The type of objects to be shown on this map, either host, service, hostgroup or servicegroup.
dynmap_object_filter |  | One or several livestatus filter definitions, seperated by "\n".
dynmap_init_x | 20 | The left px coordinate of the object grid.
dynmap_init_y | 700 | The top px coordinate of the object grid
dynmap_offset_x | 30 | The offset in pixel to seperate the objects of a row horizontally.
dynmap_offset_y | 30 | The offset in pixel to seperate the lines of objects with.
dynmap_per_row | 30 | Objects to add in the grid per row. The Y offset is applied once a row reaches this number.
dynmap_sort |  | Sort method to use. Can be `a` for alphabetically order (default), `s` to sort objects by state or `k` to keep the order of the backend.
dynmap_order | asc | Order of the objects (Available: asc/desc)