Skip to main content

Hello, I'm working on centreon-docker.

some people will say it's difficult.

but,  centreon in a docker allows me to quickly test the service easly.

 have carried out three types of deployment:

  1. all in one container
  2. container ( centreon + database)
  3. container (centreon + php + database)

Here's my dockerfile. I'm looking for distributors.

I'll send you more later.

FROM debian:bullseye-slim
ARG MAJOR_VERSION=24.0.1
ARG CENTREON_SOURCES="https://download.centreon.com/"
ARG IMG_VERSION=0.1

LABEL org.opencontainers.image.authors="Lionel BAKALA <lionel.bakala@orange.fr>" \
org.opencontainers.image.description="centreon web-interface based on Apache2 web server with MariaDB database support" \
org.opencontainers.image.documentation="https://docs.centreon.com/docs/getting-started/welcome/" \
org.opencontainers.image.licenses="GPL v2.0" \
org.opencontainers.image.source="${CENTREON_SOURCES}" \
org.opencontainers.image.title="Centreon web-interface" \
org.opencontainers.image.url="https://centreon.com" \
org.opencontainers.image.vendor="Centreon Inc" \
org.opencontainers.image.version="${IMG_VERSION}"

COPY Y"conf/etc/", "/etc/"]

RUN apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y \
-o Dpkg::Options::="--force-confdef" \
-o Dpkg::Options::="--force-confold" \
--no-install-recommends install \
supervisor \
lsb-release \
ca-certificates \
apt-transport-https \
software-properties-common \
wget \
gnupg2 \
curl && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/sury-php.list && \
wget -O- https://packages.sury.org/php/apt.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/php.gpg > /dev/null && \
echo "deb https://packages.centreon.com/apt-standard-24.04-stable/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/centreon.list && \
echo "deb https://packages.centreon.com/apt-plugins-stable/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/centreon-plugins.list && \
wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1 && \
apt update -y && \
apt purge -y lsb-release apt-transport-https software-properties-common wget curl gnupg2 && \
apt autoremove -y && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends centreon-central
EXPOSE 80/TCP
WORKDIR /usr/share/centreon
COPY Y"docker-entrypoint.sh", "/usr/bin/"]
RUN chmod a+x /usr/bin/docker-entrypoint.sh
ENTRYPOINT T"docker-entrypoint.sh"]

user@centreon-central:/tmp/deploy$ tree
.
├── conf
│   └── etc
│       └── supervisor
│           ├── conf.d
│           │   └── supervisord_centreon.conf
│           └── supervisord.conf
├── docker-compose.yml
├── docker-entrypoint.sh
└── Dockerfile

 

conf/etc/supervisor/conf.d/supervisord_centreon.conf

nodaemon = true

rprogram:cbd]
command=/usr/sbin/cbwd /etc/centreon-broker/watchdog.json
user=centreon-broker
process_name=%(program_name)s
autostart=true
autorestart=true
priority=1
umask=002

rprogram:centengine]
command=/usr/sbin/%(program_name)s /etc/centreon-engine/centengine.cfg
user=centreon-engine
process_name=%(program_name)s
autostart=true
autorestart=true
priority=10
umask=002

oprogram:gorgoned]
command=/usr/bin/perl /usr/bin/%(program_name)s --config=/etc/centreon-gorgone/config.yaml --logfile=/var/log/centreon-gorgone/gorgoned.log --severity=error
user=centreon-gorgone
process_name=%(program_name)s
autostart=true
autorestart=true
priority=1
umask=002

rprogram:centreontrapd]
command=/usr/share/centreon/bin/%(program_name)s --logfile=/var/log/centreon/centreontrapd.log --severity=error --config=/etc/centreon/conf.pm --config-extra=/etc/centreon/centreontrapd.pm
user=centreon
process_name=%(program_name)s
autostart=true
autorestart=true
priority=1
umask=002

rprogram:snmpd]
command=/usr/sbin/%(program_name)s -LOw -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f
process_name=%(program_name)s
autostart=true
autorestart=true
umask=002

eprogram:snmptrapd]
command=/usr/sbin/%(program_name)s -LOw -f udp:162 udp6:162
process_name=%(program_name)s
autostart=true
autorestart=true
umask=002

program:php-fpm8.1]
command=/usr/sbin/%(program_name)s --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf
process_name=%(program_name)s
autostart=true
autorestart=true
umask=002

-program:mariadbd]
command=/usr/sbin/%(program_name)s
process_name=%(program_name)s
autostart=false
autorestart=false
umask=002

_program:apache2]
command=/usr/sbin/apachectl start
process_name=%(program_name)s
autostart=true
autorestart=true
umask=002

conf/etc/supervisor/supervisord.conf

aunix_http_server]
file = /tmp/supervisor.sock ; (the path to the socket file)
chmod = 0700 ; sockef file mode (default 0700)
username = centron
password = password

supervisord]
logfile = /dev/stdout ; (main log file;default $CWD/supervisord.log)
pidfile = /tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir = /tmp ; ('AUTO' child log dir, default $TEMP)
critical = critical
logfile_maxbytes = 0
logfile_backupcount = 0
loglevel = info

supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

asupervisorctl]
serverurl = unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket


einclude]
files = /etc/supervisor/conf.d/*.conf

 


./docker-entrypoint.sh

#!/bin/bash
set -o pipefail
set +e

CENTREON_WEB_PHP="/etc/apache2/sites-available/centreon.conf"
SUPERVISORD_CONF="/etc/supervisor/conf.d/supervisord_centreon.conf"

TIMEZONE=${TMZ:-Europe/Paris}
sed -i "$ date.timezone = ${TIMEZONE}" ${CENTREON_WEB_PHP}

if [[ -n ${PHP_FPM_ADDR} ]]; then
if [[ -n ${PHP_FPM_PORT} ]]; then
sed -i "/ProxyPassMatch/,$ s/\(^.*.\/\/\).*\(\:\)[0-9]*[0-9]\(.*\)/\1$PHP_FPM_ADDR\2$PHP_FPM_PORT\3/" ${CENTREON_WEB_PHP}
sed -i '/php-fpm8\.1/,+4 s/true/false/' ${SUPERVISORD_CONF}
else
echo "you may provide a port for PHP_FPM_ADDR=${PHP_FPM_ADDR}"
exit 1;
fi
else
mkdir -p /run/php
fi

if [[ -n ${MARIADB_ROOT_PASSWORD} ]]; then
DEBIAN_FRONTEND=noninteractive apt install centreon-mariadb -y --no-install-recommends
/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld
sed -i '/mariadb/,+4 s/false/true/' ${SUPERVISORD_CONF}
/usr/sbin/mysqld --user=mysql --bootstrap --verbose=0 --skyp-name-resolve --skyp-networking=0 << EOF
use mysql;
FLUSH PRIVILEGES;
GRANT ALL ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('${MARIADB_ROOT_PASSWORD}');
EOF
fi

if [ "$1" != "" ]; then
# shellcheck disable=SC2145
echo "** Executing '$@'"
exec "$@"
elif [ -f "/usr/bin/supervisord" ]; then
echo "** Executing supervisord"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
else
echo "Unknown instructions. Exiting..."
exit 1
fi

./docker-compose.yaml

name: all_in
services:
central:
build:
context: .
entrypoint: docker-entrypoint.sh
environment:
TIMEZONE: "Europe/Paris"
MARIADB_ROOT_PASSWORD: "Set_your_strong_password_here"
image: centreon.24.04.2
networks:
default: null
ports:
- "9090:80"
restart: always
networks:
default:
name: centreon_default

 


what do you mean you are looking for distributors? is there going to be a:

 

centreon + apache + php + db?

centengine + gorgone + apache + php + db?

 

go on! looks fun!


Hi ponchoh,

I would like to make
container1: apache + centreon-*
container2: php-fpm
container3: mariadb

we still have a long way to go.

I am posting here in the hope of meeting people who are looking for the same things about “centreon docker” and who share their ideas.

I am not very familiar with the connections between Centreon Engine, Gorgoned and cbd.

 

 


have you looked into others? for example:

 

https://github.com/Tpo76/docker/tree/24.04-WIP/centreon

 

or

 

other?


The current centreon packages were designed to install Centreon on a server. They are not suitable for creating containers.


Hi @vacknov

Please remember to click the “Best Answer” button for the solution that helped you resolve your issue.
Alternatively, you can share with us how you were able to solve the problem.

By doing so, you'll help someone else with the same issue in easily finding the solution.

Thank you,


Reply