<commit_before># Dockerized Centreon 2.5.2

This is NOT well-tested. It works on two different installations but the result you see evolved
while getting it to this stage.

Please report any problems!

## Preparing the host

The configuration files and state data are stored on directories outside the container.
We will mount external directories for all state that should not vanish when the container is regenerated:

 * /docker-store/centreon/nagios-etc
 * /docker-store/centreon/nagios-var
 * /docker-store/centreon/centreon-etc
 * /docker-store/centreon/centreon-var

You may place these folders somewhere else, just make sure you update the corresponding paths below.

## Building the image

First step you do with this repo (if you cloned it) is to

	docker build -t centreon .

it. Note that dot at the end referencing the current directory. Once that is done you have an image that you can run and that is tagged `centeron` for easier reference below.

## Running the container

Now that's the easy part, as long as you remember to connect the right volumes:

	docker run -i -t -p 8100:80 --name centreon \
	  -v /docker-store/centreon/nagios-etc:/usr/local/nagios/etc \
	  -v /docker-store/centreon/nagios-var:/usr/local/nagios/var \
	  -v /docker-store/centreon/centreon-var:/var/lib/centreon \
	  -v /docker-store/centreon/centreon-etc:/etc/centreon \
	  -v /etc/localtime:/etc/localtime:ro \
	  --privileged=true \
	  centreon /bin/bash

The 8100 is the host TCP port under which the Apache Webserver inside the container will be available on the outside. Change as desired.

The need to run the container as a privileged container stems from the need to increase the `kernel.msgmnb` parameter.

The Centreon daemon `centcore` will not start and end up in a supervisord-FATAL state. That is expected, as the following setup will need to create the configuration files first. Nevertheless, the web interface works already.

## Setting up Centreon

Once the container is running, you can reach Centreon under

	http://host-server.example.com:8100/centreon/

Centreon will start the setup process. It is very opinionated and even requires you to hand over
your MySQL root user password. Here are some hints for what values are needed:
<commit_msg>Add clarification regarding run command<commit_after># Dockerized Centreon 2.5.2

This is NOT well-tested. It works on two different installations but the result you see evolved
while getting it to this stage.

Please report any problems!

## Preparing the host

The configuration files and state data are stored on directories outside the container.
We will mount external directories for all state that should not vanish when the container is regenerated:

 * /docker-store/centreon/nagios-etc
 * /docker-store/centreon/nagios-var
 * /docker-store/centreon/centreon-etc
 * /docker-store/centreon/centreon-var

You may place these folders somewhere else, just make sure you update the corresponding paths below.

## Building the image

First step you do with this repo (if you cloned it) is to

	docker build -t centreon .

it. Note that dot at the end referencing the current directory. Once that is done you have an image that you can run and that is tagged `centeron` for easier reference below.

## Running the container

Now that's the easy part, as long as you remember to connect the right volumes:

	docker run -i -t -p 8100:80 --name centreon \
	  -v /docker-store/centreon/nagios-etc:/usr/local/nagios/etc \
	  -v /docker-store/centreon/nagios-var:/usr/local/nagios/var \
	  -v /docker-store/centreon/centreon-var:/var/lib/centreon \
	  -v /docker-store/centreon/centreon-etc:/etc/centreon \
	  -v /etc/localtime:/etc/localtime:ro \
	  --privileged=true \
	  centreon /bin/bash

The 8100 is the host TCP port under which the Apache Webserver inside the container will be available on the outside. Change as desired.

The `/bin/bash` drops you in a shell in exactly the situation where the container
normally would execute `/start.sh`. If you omit `/bin/bash`, exactly that will be done
(as specified as the CMD statement in `Dockerfile`). While running the container with `bash`, try `/start.sh &` to start the "normal" stuff and still be able to look inside
the container for logfiles etc.

The need to run the container as a privileged container stems from the need to increase the `kernel.msgmnb` parameter.

The Centreon daemon `centcore` will not start and end up in a supervisord-FATAL state. That is expected, as the following setup will need to create the configuration files first. Nevertheless, the web interface works already.

## Setting up Centreon

Once the container is running, you can reach Centreon under

	http://host-server.example.com:8100/centreon/

Centreon will start the setup process. It is very opinionated and even requires you to hand over
your MySQL root user password. Here are some hints for what values are needed:

{'fraction_non_alphanumeric': 0.06752084604433597, 'fraction_numerical': 0.006914785438275371, 'mean_word_length': 3.8500986193293887, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3761616', 'n_tokens_mistral': 1484, 'n_tokens_neox': 1339, 'n_words': 658}