Difference between revisions of "Pandora: Documentation en: GIS"

From Pandora FMS Wiki
Jump to: navigation, search
(GIS Historical View)
(Blogs (Spanish only))
Line 356: Line 356:
 
* [http://www.gisandchips.org GIS & Chips]
 
* [http://www.gisandchips.org GIS & Chips]
 
* [http://weait.com/ Weait]
 
* [http://weait.com/ Weait]
* Portal de GIS y Cartografía de la UPV [http://cartosig.upv.es/ CartoSIG]
+
* UPV Portal and Cartography [http://cartosig.upv.es/ CartoSIG]
** Recursos sobre [http://cartosig.upv.es/es/recursos-sig?page=1 Cartografía y SIG]
+
** Resources on [http://cartosig.upv.es/es/recursos-sig?page=1 Cartografía y SIG]
** Imagen Virtual: [http://cartosig.upv.es/es/blogs/jomarlla/own/2008/11/23/imagen-virtual-sig-con-vmware-opensuse-gis-02-nov-2008 OpenSUSE + Software de GIS]
+
** Virtual Image: [http://cartosig.upv.es/es/blogs/jomarlla/own/2008/11/23/imagen-virtual-sig-con-vmware-opensuse-gis-02-nov-2008 OpenSUSE + Software de GIS]
** Cálculo de distancias teniendo en cuenta la curvatura terresre en [http://franchu.net/2007/11/16/gis-calculo-de-distancias-sobre-la-tierra/ Franchu's lair]
+
** Calculation of distances taking into account the earth curvature at [http://franchu.net/2007/11/16/gis-calculo-de-distancias-sobre-la-tierra/ Franchu's lair]
  
 
[[Pandora:Documentation_en|Go back to Pandora FMS documentation index]]
 
[[Pandora:Documentation_en|Go back to Pandora FMS documentation index]]
  
 
[[Category:Pandora FMS]]
 
[[Category:Pandora FMS]]

Revision as of 10:32, 22 October 2013

Go back to Pandora FMS documentation index

1 Pandora GIS

With the version 3.1 Pandora FMS will start to support positional information and interactive maps to show the position of the agents. This is a completely OpenSource feature. Only for Unix agents

1.1 Setup

1.1.1 Agent Configuration

The agent now accepts new parameters to send the positional data, so in the agent.conf now there some new parameters for longitude, latitude, altitude and position_description. Other parameter for an alternative way of get the coordinates is in the file now: gis_exec. This parameter has a script path that will return a string with the coordinates in the format "latitude,longitude,altitude".

This is one example of use:

# Agent position parameters
# Those parameters define the geographical position of the agent 

# gis_exec: Call 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

1.1.2 Server Configuration

The GIS features must also be enabled on the server, for that there is a new flag called activate_gis, when this flag is set to 1 the server will process all the GIS information received from the agents.

With the positional data now there is the possibility of storing agent positions on Pandora FMS, but this data is coming from a source without high accuracy, it's possible to store a lot of different points very close to each other without an important difference on the position. To avoid this the location_error parameter sets the distance that it's considered as the same location, this is an error threshold on the positio, and all data received from an agent having a position within the distance (in meters) established on this parameter will be stored as new data received in the same point, until the position received gets out from the error distance defined, setting then a new location.

Recon server and positional information:

Using a reverse geolocation algorithm and a database with the relation of IPs and positional information, the Recon server can guess now the position of the agents discovered. For this it can use a file in MaxMind GeoIP GeoLiteCity format, or a couple of tables on the database with that information.

So there is tree new parameters that define the new behavior of the Recon sever, the recon_reverse_geolocation_mode [disabled, file or sql] the recon_reverse_geolocation_file only used to point to the file with the reverse geolocation information using MaxMind GPL GeoLiteCity.dat format if the mode is file. And the last parameter is recon_location_scatter_radius used to place the agents discovered randomly around the point defined by the reverse geolocation algorithm and within the range (in meters) defined by the recon_location_scatter_radius parameter.

Also you can use the reverse geolocation provided by Google API and Openstreet Maps. You can activate the Google reverse geolocating setting the parameter google_maps_description to 1. You can activate Openstreet Maps reverse geolocating setting the parameter openstreetmaps_description to 1.

Be careful using this feature because it decreases the Pandora FMS server performance, also keep in mind you need direct connection to Internet to use Google API and Openstreet Maps and of course it depens on service provider availability.

Configuration Example:

# Flag to activate GIS (positional infomration 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 mode [disabled, sql, file]
#	* disabled: The recon task doesn't try to geolocate the ip discovered.
#	* sql: The recon task tryes to query the SQL database to geolocate the ip discovered
#	* file: The recon task tryes to find the geolocation information of the ip discovered in 
# 			the file indicated in the recon_reverse_geolocation_file parameter 
recon_reverse_geolocation_mode file

# Recon reverse geolocation file (databases with the reverse geolocation information using
# MaxMind GPL GeoLiteCity.dat format).

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 cycle is guessed by geolocating the IP.
recon_location_scatter_radius 1000

# This enable 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 enable realtime reverse geocoding using Openstreet Maps 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) openstreet maps server.

openstreetmaps_description 1

1.1.3 Console Configuration

In the Console, to use the GIS features, first it must be activated on the main setup:



Enable GIS.png



With this some new sections of the user interface are available:

1.1.3.1 GIS Connections

On the admin setup, the first step is to define the connections that can be used to connect to map servers to provide maps for the GIS features.

The connection has several basic parameters:



Connection configuration basic.png



  • A name for the configuration, so it can be recognized when selecting a connection on the map definition screen.
  • The group that owns the connection, this will be used to filter the connections available on the map builder depending on the ACLs.
  • The number of zoom levels defined on the map.
  • The default zoom level recommended for the map (this can be redefined on the map) and it's the zoom level used when the map is open.

Once the basic parameters are set, the administrator must select a type of connection, and depending on the type there will be different options, so those are the types of connections and their options.

1.1.3.1.1 Open Street Maps

The default installation of Pandora FMS has predefined a connection with Open Streets Maps so the users can directly see and test the GIS features, but usually the Pandora FMS server is in a place without direct access to the Internet or the user would prefer to use it's own map server to have more flexibility, to be faster, or to define it's own kind of tiles (check Pandora:Current_development:Pandora_GIS_Backend for a possible way to achieve this).

To use a Open Street Maps kind of map, the only paremeter needed is the url of the tile server as shown in the image:



Connection configruation openstreetmaps.png



This can be something like:

http://tiles.example.com/${z}/${x}/${y}.png
1.1.3.1.2 Google Maps

Pandora FMS also suport the connection to Google Maps, for this a valid key for the pandora console server must be obtained from Google (see Google Maps API policy ) and placed on the corresponding field of the connection definition.



Connection configruation goole.png



With this key it's possible to define several connections using different kinds of base maps (Hybrid, Physical or Satelite).

1.1.3.1.3 Static Image

Another type of connection supported is to use a Static Image as a map. To use this kind of map the image must be on a EPSG:4326 projection.

In this case the parameters needed for the definition of the map are url of the image, the height and the width of the image, and the positional limits (longitude and latitude) of the sides of the image (right, left, top and bottom).



Connection configruation static image.png



Map Center and Default Position:

The last thing to define for a map connection is the center of the map and the default position for agents without positional data. To define them it's possible to preview the map and click on map to set this parameters, depending on which parameter is selected with the Change in the Map selector.

In this preview map it's possible to move around the map using the green arrows on the top left, change the zoom level with the + and - icons or use the magnifier to set the full zoom.

Of course it's possible to set the position entering the values on the corresponding input boxes.



Connection configruation set center default.png



Once all the connection parameters are set, it's possible to save the connection to use it on the maps builder clicking on the save button.

1.1.3.2 GIS Map builder

Once the connections are defined, they can be used to define maps in the GIS Map Builder



Gis map builder menu.png



The menu takes the user to a screen with the defined maps, where it's possible to edit a map (by clicking on the name), view the map (clicking on the view icon) set the default map with the radio button, or delete maps (with the delete icon).

And also there is a button to create new maps.

The administrator must establish a default map that will be the one used on the agent view to display the position of the agent.

1.1.3.2.1 Crete GIS Map

Once in the Map creation page, the first thing to do is to give it a Map Name and Add a Map connection from the ones available (it's possible to add more than one, that will be available later on as base layers... this means only one can be active at the same time). When the connection is selected (or when the default connection for the map is changed) the Pandora FMS console asks if you want to use the default data from the connection for the map, if the answer is Accept, the console will fill (or update) all the positional data (center longitude, center latitude, center altitude, default longitude, default latitude and default altitude) from the ones defined on the connection, and the user will only have to set is the default zoom level'. If the answer is Cancel no changes will be done in those fields and just the connection will be added



Gis map builder main.png



1.1.3.2.2 Layer definition

Once the basic map parameters are set, it's time to define the layers of the map that will be used to select which elements to show in the map (except if it's the default map that you don't need to define any layer because it will be used to show the agent position on the agent view).

Each map has one or more layers to show the agents. Each layer can show the agents of a group and/or a list of agents. This way it's easy to set up the agents that will be shown on each Layer.

The layers can be set as visible or hidden, and select the group with the selector or add agents with the box. Once the layer is defined (it will not be completely saved until the whole map is saved) it will be moved to the left column of defined layers, where it is possible to order (move up and move down) them, delete, or edited again.



GIS map builder layers save.png



Once the definition of the layers of the map is finished, all can be saved with the save button (update button in the case of an edition of a map).

1.2 Operation

Once there is at least a map defined it's possible to start the operation with the GIS features.

1.2.1 GIS Maps

The GIS Maps menu displays all the maps defined. Each link takes to one of the maps that will be open using the parameters defined on the GIS Map Builder



Gis maps menu.png



1.2.1.1 Move around the Map

The controls for the map include four green arrows on the top left corner that allows to move on th map on each one of the four cardinal point directions. A + and a - icons to increase and decrease the level of zoom, and a zoom bar to select directly the desired level of zoom.

By dragging the map it's also possible to move arround.

The agents shown in the map are clickable to show more information about the agent (and once the bubble with the extra info is displayed the name of the agent is a link to the agent view, and there is a red box with a cross to close the bubble).

Also there is a special layer defined by the system called Hierarchy of agents, if this layer is visible it will show red dashed lines connecting an agent to it's parent (if both are visible).

1.2.1.2 Hide / Show / Select Layers

The white + on green background on the right, will open the layers controls, if clicked. It displays a green box where it is possible to select the base layer (the connection to the map server, if more than one were defined for the map), and which layers are visible.

1.2.1.3 Filters

On the top of the map there is also five buttons to filter the agents shown by it's state:

  • The green button will show the agents on Ok state.
  • The grey button will show the agents on Unknown state.
  • The yellow button will show the agents on Warning state.
  • The red button will show the agents on Critical state.
  • The All button will show All the agents defined by the layers without taking on account their state.

1.2.1.4 Map Refresh

Next to the filter buttons there is a combo box tagged Refresh to select the update rate for the map. The Map uses [AJAX] calls to refresh the agents in the map using the selected period.

1.2.1.5 Map Edit and Full Screen

The last three buttons on the top of the map are a link to public Visual Console, GIS Map Builder link to edit the Map, and the full screeen button to see the map on full screen.



Gis maps default all controls.png



1.2.2 Agent View

The agent view of Pandora FMS console also have new GIS features.

First of all, in the main view now shows the longitude, latitude and altitude of the agent.

1.2.2.1 GIS Historical View

There is a new button on the top bar (if GIS is activated) to show the GIS view of the agent.

This view shows the current position of the agent on the default map. with a table showing the history of the previous positions of the agent, and a path of this positions on the map.

Each position in the map is represented by a dot (except the current one that it's represented by the agent icon or the group icon if the agent doesn't have an icon defined). It is possible to click on any of this dots to get the information related to that position, and also it is possible to click on the agent icon to show the current information of the agent. The next image shows the path reported by the Pandora FMS agent for Android devices.



Pandroid GIS.png



Also you can show the table with all information reported by the agent, including a reverse geolocation system that shows you the address of the agent with the street, the city and the country where Pandora FMS agent is.



Pandroid GIS2.png



1.2.3 Agent GIS Setup

Among the administration tabs of the agent, there is a new tag to manually set the agent position, and also the agent manage tab has some parameters that affect the GIS features.

1.2.3.1 Ignore GIS data

On the agent manage tab there is a new switch called Ignore GIS data. If this switch is activated, the server will ignore all the positional information received from the agent and keep using the last valid values for this agent. This is useful in case an agent is reporting a wrong position or it's desired to place it on a fixed place.



Agent management icon ignore gis data.png



1.2.3.2 Manual position of the agent

'Gis Data' view shows the default map where it is possible to click to set the new position of the agent, or also it is possible to set the position using the input boxes under the map.


Template warning.png

Setting the agent position will also activate the ignore GIS data switch to avoid the next data package with positional information from the agent to reset again the position. If this is not the desired behavior, don't forget to deactivate the Ignore GIS data swich before clicking the update button

 


1.3 Useful links

This is a collection of interesting links to implement your own tile server, and expand the features of current code.

1.3.1 OpenLayers

1.3.2 Mapnik

1.3.3 OpenStreetMap

1.3.4 OS Geo

1.3.5 Geo Server

1.3.6 PostgreSQL

1.3.7 Blogs (Spanish only)

Go back to Pandora FMS documentation index