= Watchdog = == What is the gateway watchdog == The SENSEI Gateway Watchdog is a monitoring and control service for the SENSEI Gateway. It allows for remote starting, stoping and updating the gateway code and can report the version string and uptime of the currently running gateway binary. == Requirements == * Linux * g++, make * [http://www.alhem.net/Sockets/ Sockets C++ library] (Also included in lib/Sockets-2.3.7; make clean; make; make install) * libxml2 * openssl, openssl-dev == Project Organization == The watchdog shares its code with the gateway implementation and can be found in the [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway /gateway] folder in the SVN. * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/bin /bin] executables * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/src /src] Gateway and Watchdog Code * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/xml /xml] Location of resource descriptions * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/lib /lib] Sockets++ library * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/config /config] Configuration files (unused) * [https://ncit-cluster.grid.pub.ro/trac/Sensei-WP5/browser/gateway/log /log] Log files (unused) == How to build it == The top-level Makefile will build everything with the following, which places the executables in ./bin. Note that the executables must be run from the root of the project as shown below. {{{ make ./bin/watchdog }}} To clean everything do {{{ make clean }}} To build the Sockets++ library {{{ cd ./lib/Sockets-2.3.7 make clean make sudo make install }}} == How to use it == The watchdog must be run from the root of the project {{{ ./bin/watchdog }}} Available command line options are: -p HTTPD port (default: 9000) [[BR]] -s HTTPD hostname for inserting in resource desciption (default: localhost) [[BR]] -d domain name inserted in resource description (default: example.com) [[BR]] -w WSAN island name inserted in resource description (default: Example) [[BR]] -f folder where the gateway binary can be found (default: ./) [[BR]] -c gateway binary filename (default: sensei-gateway) [[BR]] -cert ssl certificate filename, also enables https operation [[BR]] -pass ssl certificate passphrase, necessary if the certificate file is encrypted [[BR]] The SENSEI Gateway Watchdog server runs by default on port 9000. It exposes the following urls: * /start - a POST request starts the gateway if not already started * /stop - a POST request stops the gateway * /update - a POST request with a form that has a 'file' field named 'code' updates the gateway binary, a 'text' field named 'version' can also be sent as the version string for the newly uploaded binary, otherwise version string will be taken from the uploaded file * /uptime - a GET request returns the uptime of the gateway in seconds or -1 if the gateway is not started * /version - a GET request returns the gateway version string, if one is available. For the /start, /stop and /uptime urls GET requests are also accepted. They return an HTML page that allows easy access to the operations from a browser.