Getting started with Surveil

0. Prerequisite

Surveil’s development environment is based on Docker and docker-compose.

First you need to install Docker. Refer to the project installation documentation.

You can install docker-compose with the following command:

sudo pip install -U docker-compose

1. Starting the containers

You will then be able to use the environment with the following commands:

  • sudo docker-compose up: Launch Surveil and its dependencies in containers.
  • sudo docker-compose down: Kill the active docker containers, if any.
  • sudo docker-compose rm: Remove all containers, if any.
  • sudo docker-compose build: Build the docker images.

Configuration for the different services running in the Docker containers are stored in tools/docker.

After running sudo docker-compose up, you should be able to acces all services at the ports configured in the docker-compose.yml file.

After about 40 seconds, a script will be executed to create fake hosts in the Surveil configuration. You should see it in the docker-compose logs.

The Surveil container mounts your local project folder and pecan reloads every time the project files change thus providing a proper development environment.

Note: Fedora users might want to uncomment the privileged: true line in docker.compose.yml if they face permissions issues.

2. Interacting with the API

You can use the python-surveilclient CLI to interact with the API.

Install it with the following command:

sudo pip install -U python-surveilclient

You’ll need to provide the Surveil API URL. You can do this with the --surveil-api-url parameter, but its easier to just set it as environment variable:

export SURVEIL_API_URL=http://localhost:5311/v2
export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth

Viewing host status

You can use the CLI to view the status of the currently monitored hosts and services with surveil status-host-list and surveil status-service-list

Example output:

| host_name                     | address       | state | last_check | plugin_output                     |
| srv-ldap-01                   |     | UP    | 1431712968 | OK - rta 0.036ms, l... |
| sw-iwebcore-01                |     | UP    | 1431712971 | OK - rta 0.041ms, l... |
| |   | UP    | 1431713146 | OK - rta 0.453ms,... |
|    |   | UP    | 1431713144 | OK - rta 0.318ms,... |
|    |   | UP    | 1431713144 | OK - rta 0.378ms,... |
|    |   | UP    | 1431713146 | OK - rta 0.373ms,... |
|    |   | UP    | 1431713146 | OK - rta 0.337ms,... |

You can also use the CLI to view the configured hosts in the API with surveil config-host-list and surveil config-service-list

Adding a new host

The Surveil CLI provides function to add hosts:

surveil config-host-create --host_name openstackwebsite --address

This will configure a new host in Surveil. However, it won’t be monitored until Surveil’s config is reloaded. You can do this with the CLI:

surveil config-reload

It will take from 5 to 10 seconds for Surveil to start monitoring the host. After this delay, you will be able to consult the host status with the CLI:

surveil status-host-list

Using Bansho the web interface

The Surveil client uses the Surveil API to query information concerning hosts and services. Bansho (Surveil’s web interface) also uses this API. To use Bansho simply open a browser at http://localhost:8888 and press login.