Home

Awesome

mesos-kibana

Kibana framework for Mesos.

This uses the Mesos-Framework project. The framework is generic and only becomes a Kibana framework with the correct configuration.

Features

(Features come from the upstream Mesos-Framework and Mesos-Starter projects)

Quick start

To start the kibana framework, simply start the mesosframework binary or docker container with a properties file containing your settings.

On minimesos

First install minimesos, then run:

minimesos up --num-agents 3
export MINIMESOS_MARATHON=http://192.168.99.100:8080
docker run -d elasticsearch:latest
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-minimesos-docker.json ; curl -XPOST -H 'Content-Type:application/json' -d @marathon.json $MINIMESOS_MARATHON/v2/apps

This will start a cluster of Kibana instances running on your local machine connecting to a static elasticsearch instance. Please check out the Elasticsearch framework if you are interested in running Elasticsearch.

On a real Mesos cluster (docker mode)

If you want to run on your own cluster, you will probably want to customize the installation using a properties file, rather than in the marathon file itself. This marathon file will ask Mesos to download the properties file from a url. First export the locations of your master and first slave, then run these commands:

export MASTER=${master ip address}
export SLAVE0=${elasticsearch ip address - see json file}
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-docker.json
cat marathon.json | sed -e 's/$MASTER/'"$MASTER"'/' | sed -e 's/$SLAVE0/'"$SLAVE0"'/' | curl -XPOST -H 'Content-Type:application/json' -d @- http://$MASTER:8080/v2/apps

See the marathon file and the properties file for further ways to customize the installation.

On a real Mesos cluster (jar mode)

Sometimes people don't want to run docker. This example will install a Kibana cluster using the java binaries. This marathon file will ask Mesos to download the properties file from a url. First export the locations of your master and first slave, then run these commands:

export MASTER=${master ip address}
export SLAVE0=${elasticsearch ip address - see json file}
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-jar.json
cat marathon.json | sed -e 's/$MASTER/'"$MASTER"'/' | sed -e 's/$SLAVE0/'"$SLAVE0"'/' | curl -XPOST -H 'Content-Type:application/json' -d @- http://$MASTER:8080/v2/apps

See the marathon file and the properties file for further ways to customize the installation.

Passing options

Because this project uses Mesos-Framework there is no Kibana-specific code to compile or download. To run, simply pass a configuration file or options. Example marathon files can be found in the manual-tests directory.

All options can be specified as either:

In that order of preference.

To pass a configuration file, the following property must be set:

Full list of Kibana related settings

All settings are written in properties or argument format. Remember that these can also be specified in environment or yml format.

CommandDescription
spring.application.nameRequired application name for Spring
mesos.framework.nameFramework name used in Mesos and ZooKeeper
mesos.masterURL of the master (usually provided by ZooKeeper)
mesos.zookeeper.serverIP:PORT of the zookeeper server
mesos.resources.cpusCPUs allocated to the task
mesos.resources.memRAM allocated to the task
mesos.resources.countNumber of task instances
mesos.resources.ports.${VAR}.hostA requested port, where VAR is the name of the port.
mesos.resources.ports.${VAR}.containerWhen in bridge mode, the container port to map the host port to.
mesos.docker.imageDocker image to use
mesos.docker.networkType of docker network
mesos.commandThe command to run
mesos.uri[0..]Files to download into the Mesos sandbox
logging.level.com.containersolutions.mesosLogging level
mesos.principalThe principal for Mesos Auth.
mesos.secretThe secret for Mesos Auth.
mesos.healthCheck.commandThe command to run as the Mesos healthcheck

Note that there are more parameters. See Mesos-Starter.

Passing Kibana settings

First upload the settings file into the task sandbox with the mesos.uri property:

mesos.uri[0]=https://gist.githubusercontent.com/philwinder/592a1ab2db40431c1b08/raw/kibana.yml

The file can be a local file (local to the host that the task is to run on) or a url.

Then copy that file into the kibana config directory, overwriting the default. Kibana does not expose a config location parameter so overwriting is the only way to pass the settings into Kibana. For example, in jar mode:

mesos.command= cp $MESOS_SANDBOX/kibana.yml $MESOS_SANDBOX/kibana-*/config/kibana.yml ; cd kibana-* ; bin/kibana --port=$UI_5061 --elasticsearch ${elasticsearch.http}

Or when in docker mode:

mesos.command=mv $MESOS_SANDBOX/kibana.yml /opt/kibana/config/kibana.yml ; kibana --port=$UI_5061 --elasticsearch ${elasticsearch.http}

Port allocation

Ports are allocated by Mesos and provided to the application as an environmental variable. For example:

mesos.resources.ports.UI_5061.host=ANY
mesos.resources.ports.UI_5061.container=5601

Assigns an unprivileged port to the environmental variable UI_5061. This environmental variable can now be use in the mesos.command, if required.

The value can be one of the following types:

CommandDescription
ANYThe next available unprivileged port (>1024)
UNPRIVILEGEDThe next available unprivileged port (>1024)
PRIVILEGEDThe next available privileged port (<=1024)
1234A specific port (e.g. 1234)

Health checks

MesosFramework uses Spring Actuator to provide health and metrics endpoints. To access the health endpoint visit: http://${SCHEDULER_IP_ADDRESS}:${server.port}/health. Acuator defaults the server.port to 8080, although it is recommended to reserve ports in the marathon command and set this port explicitly. E.g. jar mode json file

See the Spring documentation for more information.

Horizontal scaling

This adds an endpoint at the following location to control the number of instances in the cluster. The endpoint matches the properties file definition of the same name:

GET /mesos/resources/count Returns the current number of requested instances. For example to get the current number of instances:

$ curl -s http://${SCHEDULER_IP_ADDRESS}:${server.port}/mesos/resources/count
3

POST /mesos/resources/count with a body of type Integer will set the number of requested instances. For example, to set the number of instances to 1:

$ curl -XPOST -H 'Content-Type: text/plain' http://${SCHEDULER_IP_ADDRESS}:${server.port}/mesos/resources/count -d 1

Sponsors

This project is sponsored by Cisco Cloud Services.

License

Apache License 2.0