====== GIS Monitoring ======
{{indexmenu_n>20}}
===== Pandora FMS GIS =====
==== Introduction ====
A **GIS map** is a visual representation of the location of the agents inside the Pandora FMS installation. With this map we can see the current position, as well as a small history of the agents positions.
To be able to use the GIS maps, you must have configured the agents, the server and the console.
==== Setup ====
=== Agent configuration ===
[[:en:documentation:pandorafms:installation:05_configuration_agents|Software agent]] ''pandora_agent.conf'' file contains parameters to configure the device's position:
* Longitude.
* Latitude.
* Altitude.
* Position description.
The ''gis_exec'' parameter can also be used to indicate the path of the script that returns the coordinates of a device by means of a string with the "latitude, logitude, altitude" format.
Example:
# Agent position parameters
# Those parameters define the agent's geographical position.
# gis_exec: Calls a script that returns a string with '[latitude],[longitude],[altitude]'
# i.e.: 41.377,-5.105,2.365
#gis_exec /tmp/gis.sh
# latitude
latitude 42.70456
# longitude
longitude -3.897187
# altitude
altitude 600
# Position description
position_description Madrid, centro
==== Server Configuration ====
The GIS functionalities should be enabled in the server with the parameter [[[:en:documentation:pandorafms:installation:04_configuration#activate_gis|activate_gis]]. When this flag is set to ''1'' , the server will process all the GIS information received from the agents.
With the data positioning there is the possibility of storing agent positions in Pandora FMS, but this data comes from a source that is not completely reliable, and it can cause an agent without significant position changes to send location change information. To avoid this, the parameter [[:en:documentation:pandorafms:installation:04_configuration#location_error|location_error]] sets the distance that is considered to be the //same// position. This is an error tolerance on the position threshold, and as long as the agent's location remains at that threshold //it will be considered to be at the same position//.
=== Discovery server and location information ===
Using an inverse geolocation algorithm and a database with IP addresses and positioning information, the Discovery server can //calculate// the position of the discovered agents. For this it can either use a formatted file from [[http://www.maxmind.com/app/geolitecity|MaxMind GeoIP GeoLiteCity GeoLiteCity]], or a couple of tables in the database with that information.
Thus, there are two parameters that define this behavior of the Discovery server: the [[:en:documentation:pandorafms:installation:04_configuration#recon_reverse_geolocation_file|recon_reverse_geolocation_file]], used to point to the file with the reverse geolocation information (using the MaxMind GPL ''GeoLiteCity.dat''' ), and the parameter [[:en:documentation:pandorafms:installation:04_configuration#recon_location_scatter_radius|recon_location_scatter_radius]]]. The algorithm will calculate an approximate position for the agents and they will be randomly arranged around the calculated positions, taking into account the radius indicated in ''recon_location_scatter_radius'' .
The reverse geolocation service provided by the Google® API or OpenStreetMaps® (OSM) can also be used.
* You can enable Google® reverse geolocation by setting the parameter [[:en:documentation:pandorafms:installation:04_configuration#google_maps_description|google_maps_description]], to ''1''.
* You can activate the reverse geolocation of OpenStreetMaps® by setting the parameter [[:en:documentation:pandorafms:installation:04_configuration#openstreetmaps_description|openstreetmaps_description]], to ''1''.
* This functionality **decreases the performance of the Pandora FMS server**.
* **Internet access** is required to use the Google® or OpenStreetMaps® API and that, of course, this functionality depends on the availability of the providers of these services.
**Example configuration:**
# Flag to activate GIS (positional information for agents and maps) by default it is deactivated
activate_gis 1
# Radius of the Error in meters to consider two gis locations as the same location.
location_error 10
# Recon reverse geolocation file (databases with the reverse geolocation information using
# MaxMind GPL GeoLiteCity.dat format).
# Comment it to disable the IP geolocation on agent creation.
recon_reverse_geolocation_file /usr/local/share/GeoIP/GeoLiteCity.dat
# Radius (in meters) of the circle in where the agents will be place randomly when found by a recon task
# The center of the cicle is guessed by geolocating the IP address.
recon_location_scatter_radius 1000
# This enables realtime reverse geocoding using Google Maps public API.
# This requires internet access, and could have performance penalties processing GIS
# information due the connetion needed to resolve all GIS input.
google_maps_description 1
# This enables realtime reverse geocoding using OpenStreetMaps public API.
# This requires internet access, and could have performance penalties processing GIS
# information due the connetion needed to resolve all GIS input.
# You can alter the code to use a local (your own) OpenStreetMaps server.
openstreetmaps_description 1
=== Console setup ===
In the console, to use GIS features, they must have been previously activated in the main setup in Pandora FMS console. Go to menu **Setup > Setup > General Setup**:
{{ :wiki:enable_gis.png }}
Click Enable GIS features and then click Update. Then some new sections from the user interface will be available.
{{ :wiki:pfms-profiles-manage_users.png }}
In **Setup > Setup > GIS map connection**, it will define the connections that can be used with **map servers** to provide maps for GIS features.
== Basic Configuration ==
The connection comes with several basic parameters:
{{ :wiki:connection_configuration_basic.png?800 }}
* **Connection name**: A name for the configuration, so it can be recognized when selecting a connection on the map definition screen.
* **Group**: The group the connection belongs to. **Even if the user who is creating the GIS connection map does not explicitly** belongs to the ALL group, he/she can still assign the [[:en:documentation:pandorafms:management_and_operation:11_managing_and_administration#group_all|ALL group]] as the connection belongs to.
* **Number of zoom levels**: The number of zoom levels defined on the map.
* **Default zoom level**: The default zoom level recommended for the map (this can be redefined on the map) and it is the zoom in level used when the map is open.
Once the basic parameters are set, the administrator is required to select a connection type. Depending on the type, there will be different options, and so are the types of connections and their options.
{{ :wiki:pfms-setup-setup-gis_map_connection-create_new.png }}
== OpenStreetMap ==
The default Pandora FMS installation comes with a predefined connection with [[http://www.openstreetmap.org/|OpenStreetMap®]] so the users are able to directly see and test the GIS features.
In order to use an Open Street Maps type of map, the only parameter required is the URL of the **title server**, as shown on the image below.
{{ :wiki:pfms-setup-setup-gis_map_connection-create_new-openstreetmaps.png }}
Examples:
http://tiles.example.com/${z}/${x}/${y}.png
http://tile.example.com/${z}/${x}/${y}.png
You may check an [[https://wiki.openstreetmap.org/wiki/Tile_servers|official server list in OpenStreetMap®]] website, read and follow carefully the instructiond for naming and identification.
== Google Maps ==
Pandora FMS also includes connection to Google Maps®. therefore it is necessary to obtain a valid **password** from Google® (see [[http://developers.google.com/maps/documentation/directions/#api_key|Google Maps API policy]]) and to be placed in the corresponding field in connection's definition.
{{ :wiki:pfms-setup-setup-gis_map_connection-create_new-google.png?nolink& }}
With this password it is possible to define several connections using different types od base maps: //Hybrid//, //Physical// or //Satelite//.
It is possible that this key takes a few minutes to work after being retrieved.
== Static Image ==
Other type of connection provided is using a **Static Image** as map. To use this type of map, the image must be as [[http://en.wikipedia.org/wiki/EPSG:4326|EPSG:4326]] ([[:en:documentation:pandorafms:management_and_operation:WGS84|]]).
In this case, the parameters needed for map definition are image **url**, image **height** and **width** and positional limits (//longitude// and //latitude//) from the image edges (right, left, top and bottom).
{{ :wiki:pfms-setup-setup-gis_map_connection-create_new-static_image.png?nolink& }}
== WMS Server ==
If Pandora FMS servier is somwhere with no access to the Internet, it is not possible to use an online map service. You may also prefer to use your own map server for higher flexibility, work faster or define your own mosaic type.
From version 723, it is possible to add connections to WMS (Web Map Service) server, such as GeoServer. For that it is necessary to enter the address where the service is provided and the name or names of the layers to be obtained from it.
{{ :wiki:pfms-setup-setup-gis_map_connection-create_new-wms_server.png?nolink& }}
You may see how to carry out an installation and minimum configuration of a GeoServer in this [[:en:documentation:pandorafms:technical_annexes:13_geoserver_installation|technical annex]].
== Map Center and Default Position ==
The last thing to define in a map connection is the map center and the default position without positional data. To define them, it is possible to preview the map and click on it to fix those parameters, depending on which (**Map center** or **Default position for agents without GIS data**) you selected with the selector **Change in the Map**.
In this preview map, it is possible to move around using the green arrows at the top left, change the zoom level with icons + or - or use the zoom in option.
It is also possible to fix the position by entering the values in their corresponding entry cells (the decimal separator is the dot).
{{ :wiki:connection_configruation_set_center_default.png?nolink& }}
Once all connection parameters have been fixed, it will be possible to save the connection to use it in the map configurator using **Save**.
=== GIS Maps ===
Once you have defined the connections, they could be used to define maps in the menu **GIS Maps**.
{{ :wiki:gis_map_menu.png }}
The menu takes the user to a screen with defined maps, where it is possible to edit a map, view the map, fix the default map or delete a map.
Sample layer:
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps_sample.png }}
There is also a button to create new maps (**Create** button).
Set a **default map**, that will be used in the agent view to show its position.
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-default_map.png }}
=== Creating a GIS Map ===
{{ :wiki:gis_map_builder_main.png }}
Once on the map creation page, the first thing to do is to add a **map name** and a **map connection** from the ones available. You may add more than one, which will be available later on as base layers (only one of them can be active at once).
{{ :wiki:pfms-topology_maps-gis_maps-builder_map-add_map_connection.png }}
When the connection is selected, or if the default connection for the map is changed, the Pandora FMS Console will ask whether you intend to use the default data from the connection for the map. If the answer is 'Accept', the console will fill out or update **all positional data** with the ones defined in the connection, and the user will just set the default zoom in level. If use of the default values is denied, **no changes will be made** and the connection will just be added.
**Layer definition**{{ :wiki:gis_grupo.png }}
Once the basic map parameters are set, it is time to define the map's layers used to select which elements are shown on the map - except if it is the default map - on which there is no need to define any layer, because it will be used to display the agent's position in the agent view.
Each map has one or more layers to display agents. Each layer was designed to display the //group agents//, //a list of agents// and/or //a group with an agent as a sample//. That way, it is easy to define the agents shown on each layer.
Layers can be defined as //visible// or //hidden// and it is possible to:
* Choose the group with the selector to add agents.
* Add agents with the cell individually.
* Add a group with only one agents as sample.
Once you have created a group in a layer with its representative agent, you cannot generate the same group with another agent.
Once the layer is defined (it is not completely saved until the complete map is, by clicking **Save map**), it will be moved to the left column of defined layers, where it is possible to arrange (move them up or down), delete or edit them again.
Once the map layer definition is complete, it is saved by clicking on the **Save Map** button (**Update Map** button in case the map was edited instead).
==== Operation ====
Once there is at least one map defined, it is possible to start using GIS features.
=== GIS Maps ===
The GIS map menu displays all defined maps. Each one can be viewed by displaying the map with the parameters defined in the map.
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-setup_gear.png }}
== Moving around on the Map ==
The controls for the map include four green arrows on the top left corner which allow to move around on the map. The '+' and '-' icons are intended to increase and decrease the zoom level. There is also a 'zoom bar', designed to directly select the desired zoom level.
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-control_navigation.png }}
It is also possible to move around by dragging the map to the desired position.
Click on the agents shown on the map to have more information about the agent displayed (once the extra information is displayed, the agent's name becomes a link to the **Agent view**).
== Layers ==
The white '+' icon at the right opens the layer's controls. It displays a green box in which it is possible to select the base layer (the connection to the map's server, if there were more than one are defined for that map) and see which layers are **visible**.
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-control_layers.png }}
There is also a special system-defined layer called **Agent Hierarchy**. If this layer is visible, it will display some red dashed lines, connecting an agent to its parent element (if both of them are visible).
== Filters ==
Above the map there are filtering options for the agent states:
* Ok
* Critical
* Warning
* Other
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-filter_status.png }}
== Map Refresh ==
Next to the filter buttons, there is a combo box called **Refresh** to select the map update rate. The map uses [[http://en.wikipedia.org/wiki/AJAX **AJAX Calls**]] to refresh the agents on the map by using the defined period.
== Auxiliary buttons ==
The last three buttons at the top of the map are:
* A public link to the Visual Console
* A button to see the **Full screen** map.
* A button to access again the GIS map list.
{{ :wiki:pfms-topology_maps-gis_maps-list_of_gis_maps-link-screen-list.png }}
=== Agent View ===
The Pandora FMS console agent view also comes with new GIS features. The main view now displays the agent location in terms pf longitude, latitude and altitude.
== Historical GIS view ==
There is a new button on the top bar to display the agent's **GIS view** (if GIS is enabled).
This view displays the agent's current position on the **default map**. It contains a table that shows the history of the agent's previous positions and their route on the map.
Each position on the map is represented by a dot (except the current one which is represented by the agent's icon). It is possible to click on any of these dots in order to get position-related information. It is also possible to click on the agent's icon in order to display the agent's current information. The following information shows the way covered by the Pandora FMS agent for Android devices.
{{ wiki:Pandroid_GIS22.png?800 }}
You are also able to display a table which contains all the agent's reported information, including a reverse geolocation system which was designed to display the agent's address including the street, city and country in which the Pandora FMS agent is located.
{{ wiki:Pandroid_GIS23.png }}
=== The Agent's GIS Setup ===
Among the agent's administration tabs, there is a new tag to manually set the agent's position. The 'agent manage' tab also has some parameters which affect the GIS features.
== Ignoring GIS Data ==
On the //agent manage// tab, there is a new switch called //Update new GIS data//. If this switch is activated, the server will ignore all positional information received from the agent and use the last valid values for it. This is useful in case an agent reports a wrong position or it gets its own fixed place.
{{ :wiki:agent_management_icon_ignore_gis_data2.png }}
== Manual agent position ==
The **GIS Data** view displays the default map by default. It is possible to click on it in order to define the agent's new position. It is also possible to determine the position by using the input boxes below the map.
{{ :wiki:pos_manual.png }}
Defining the agent's position will activate the** Ignore GIS Data **option that will later take the opposite value in the option [[:en:documentation:pandorafms:monitoring:20_gis#update_gis_data|Update new GIS data]] in order to avoid the agent's next positional information data package to reset the agent's position again.
If this is **not** the desired performance, we recommend deactivating the **Ignore GIS Data** option before clicking **Update**.
==== Useful links ====
This is a collection of interesting links which are quite useful for implementing test environments and development with OpenLayers.
=== OpenLayers ===
* Wikipedia page about [[http://en.wikipedia.org/wiki/OpenLayers|OpenLayers]]
* Openlayer documentation made by using [[http://www.naturaldocs.org|Natural Docs]] [http://dev.openlayers.org/docs/files/OpenLayers Openlayers Documentation]
* More information about Openlayers [[http://docs.openlayers.org/library/feature_styling.html|Official documentation about styles]]
* Help with OpenLayer styles: [[http://trac.openlayers.org/wiki/Styles|OpenLayers Styles]]
* Debugging by Firebug [[http://openlayers.org/dev/examples/debug.html|OpenLayers Debug]]
=== OpenStreetMap ===
* [[http://wiki.openstreetmap.org/wiki/OpenLayers|Some examples of OpenLayers]]
* [[http://wiki.openstreetmap.org/wiki/Using_OpenStreetMap|Using OpenStreetMap]]
* File download [[http://planet.openstreetmap.org/|OSM]]
* [[http://wiki.openstreetmap.org/wiki/Osm2pgsql|Osm2qgsql]]
=== OS Geo ===
* [[http://www.osgeo.org/|The Open Source Geospatial Foundation ]]
=== Geo Server ===
* Main website [[http://geoserver.org|geoserver.org]]
* [[http://geoserver.org/display/GEOS/Stable|Stable version]]
=== PostgreSQL ===
* Documentation for GIS extensions for [[http://www.postgresql.org/docs/8.1/interactive/index.html|PostgreSQL 8.1]]
=== Blogs ===
* SIG portal and Cartography l'UPV [[https://cartosig.webs.upv.es/|CartoSIG]]
* Resources [[https://cartosig.webs.upv.es/recursos/|"Cartographie et SIG"]]
[[:en:documentation:start|Go back to Pandora FMS documentation index]]