MonitorCapabilities
From MapbenderWiki
User:Christoph Baudson (Module maintainer)
Contents |
english
Description
This module checks whether the WMS of a user or group are reachable and up to date. It allows updating the Mapbender database and optionally informs the operator of all changes. Statistics for each service are supplied.
Requirements and configuration
Mapbender 2.7+
The PHP command line tool php5-cli needs to be installed
sudo apt-get install php5-cli
Make sure the path to php5-cli in Mapbender.conf is correct, for example
define("PHP_PATH", "/usr/bin/");
You also have to set a time limit. This is the total number of seconds the statistic tool waits for all WMS replies (could be changed to number of seconds per service)
define("TIME_LIMIT", "300");
You can also specify whether Mapbender shall update the database automatically, if the capabilities document has changed. Of course, you can do this manually as well
define("AUTO_UPDATE", "0");
Usage
The script lives in the tools folder:
cd <mapbender>/tools/
Start the monitoring script by passing a user id or a group id. All owned WMS will be monitored:
php5 mod_monitorCapabilities_main.php user:<user_id>
or
php5 mod_monitorCapabilities_main.php group:<group_id>
For each WMS an individual monitoring process will be started. The main process itself may be run via cronjob, command line or browser.
The results of the monitoring will be inserted into the table mb_monitor (see Database_Changes_2.4). The time limit (in seconds) for this process is set in mapbender.conf (TIME_LIMIT). The constant AUTO_UPDATE in mapbender.conf must be set to 1, if the monitoring module shall update all out-of-date WMS automatically. Otherwise, the administrator may update these WMS manually (see mod_monitorCapabilities_read.php).
- mod_monitorCapabilities_read.php: The current monitoring status will be displayed in a browser window, non-up-to-date local WMS getCapabilities documents may be updated.
- mod_monitorCapabilities_read_single.php: All monitoring results for a single WMS will be displayed in a new window (triggered by a mouse click in mod_monitorCapabilities_read.php).
Query all WMS services owned by the logged user for availability and check whether the cached Capabilities documents are up to date. If it needs updating, the Capabilities document is requested from the server and the changes are updated in the database.
status in the db
- 1 = reachable and in sync with db
- 0 = reachable and out of sync with db
- -1 = unreachable
- -2 = monitoring in progress
- -3 = reachable but not an image (TO DO --Christoph Baudson 16:12, 9 August 2007 (CEST))
Please note: The update/connect process may fail for few WMS. Further analysis is required.
deutsch
Dieses Modul aktualisiert die Mapbender Datenbank mit allen Änderungen der eingebundenen WMS Dienste. Momentan werden alle WMS des root-Benutzers überwacht. Darüberhinaus wird eine Serverstatistik erstellt, aus der hervorgeht, welche Verfügbarkeit der Dienst hat.
- mod_monitorCapabilities_main.php: Erstellt eine Liste der zu überwachenden WMS und startet für jeden WMS einen eigenen Prozess. Kann über einen cronjob, über die Kommandozeile oder im Browser gestartet werden. Der Pfad zu PHP muß in mapbender.conf angegeben werden (PHP_PATH).
Kommandozeile: php mod_monitorCapabilties_main.php user:<username> [gui:<guiname>]
- mod_monitorCapabilities_write.php: Prüft einen einzelnen WMS. Wird von mod_monitorCapabilities_main.php aufgerufen. Die Ergebnisse werden in der Tabelle mb_monitor (siehe Database_Changes_2.4) eingetragen. In mapbender.conf wird in TIME_LIMIT die maximale zur Verfügung stehende Zeit zur Ausführung des Monitorprozesses eines einzelnen WMS gesetzt. Desweiteren gibt es in mapbender.conf eine Konstante AUTO_UPDATE, falls deren Wert 1 ist, werden alle veralteten WMS automatisch aktualisiert. Ist der Wert 0, können diese WMS später beim Betrachten der Ergebnisse im Browserfenster manuell aktualisiert werden (in mod_monitorCapabilities_read.php).
- mod_monitorCapabilities_read.php: Stellt die Ergebnisse des letzten Monitorzyklus im Browserfenster dar. Nicht aktuelle getCapabilities-Doumente können manuell auf den neuesten Stand gebracht werden.
- mod_monitorCapabilities_read_single.php: Zeigt alle Monitoring-Ergebnisse eines einzelnen WMS (wird durch einen Mausklick in mod_monitorCapabilities_read.php aufgerufen).
Alle lokal in der Datenbank gespeicherten WMS Capabilities Dokumente werden auf Aktualität überprüft. Falls ein Dokument nicht mehr aktuell ist, wird das neue Dokument angefordert und in der Datenbank gespeichert.
Bitte beachten: Der Update/Verbindungs-Vorgang kann für einzelne WMS scheitern, eine tiefergreifende Analyse ist erforderlich.
Files
For this module the following files are required / Für dieses Modul werden die folgenden Dateien benötigt:
known issues
see all trac tickets for tools
- Beta!
- See also: Talk:MonitorCapabilities
- technical knick-knack: monitoring
