mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-05-28 04:34:57 -04:00
Remove demo Dockerfile
This commit is contained in:
parent
dae46c61d5
commit
74d3c1bfbb
15 changed files with 8 additions and 238 deletions
|
|
@ -1,28 +0,0 @@
|
|||
WSGIPythonHome /opt/graphite
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName localhost
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
ErrorLog /dev/stderr
|
||||
CustomLog /dev/stdout combined
|
||||
|
||||
<Location "/">
|
||||
Require all granted
|
||||
</Location>
|
||||
|
||||
WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120 user=graphite group=graphite
|
||||
WSGIProcessGroup graphite
|
||||
WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
|
||||
WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi
|
||||
|
||||
Alias /static/ /opt/graphite/webapp/content/
|
||||
<Location "/static/">
|
||||
Require all granted
|
||||
SetHandler None
|
||||
</Location>
|
||||
</VirtualHost>
|
||||
|
||||
<Directory "/usr/share/icingaweb2/public">
|
||||
SetEnv REMOTE_USER icingaadmin
|
||||
</Directory>
|
||||
|
|
@ -1 +0,0 @@
|
|||
deb https://packages.icinga.com/debian icinga-stretch main
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
library "db_ido_mysql"
|
||||
|
||||
object IdoMysqlConnection "ido-mysql" {
|
||||
host = "localhost"
|
||||
user = "nagios"
|
||||
database = "icinga2"
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[icingaweb2]
|
||||
strip_username_regexp = ""
|
||||
backend = "external"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
[global]
|
||||
show_stacktraces = "1"
|
||||
config_backend = "ini"
|
||||
|
||||
[logging]
|
||||
log = "php"
|
||||
level = "INFO"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[graphite]
|
||||
url = "http://127.0.0.1"
|
||||
insecure = "0"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[icinga]
|
||||
type = "ido"
|
||||
resource = "icinga_ido"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[icinga2]
|
||||
transport = "local"
|
||||
path = "/var/run/icinga2/cmd/icinga2.cmd"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[security]
|
||||
protected_customvars = "*pw*,*pass*,community"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
[icinga_ido]
|
||||
type = "db"
|
||||
db = "mysql"
|
||||
host = "localhost"
|
||||
port = ""
|
||||
dbname = "icinga2"
|
||||
username = "www-data"
|
||||
password = ""
|
||||
charset = "utf8"
|
||||
persistent = "0"
|
||||
use_ssl = "0"
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[Administrators]
|
||||
users = "icingaadmin"
|
||||
permissions = "*"
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
[Date]
|
||||
date.timezone = UTC
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
[supervisord]
|
||||
nodaemon = true
|
||||
logfile = /dev/stdout
|
||||
loglevel = info
|
||||
|
||||
[unix_http_server]
|
||||
file = /run/supervisord.s
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///run/supervisord.s
|
||||
|
||||
[program:icinga2]
|
||||
command = /bin/bash -exo pipefail -c 'set -a; . /etc/default/icinga2; set +a; exec icinga2 daemon -e "$ICINGA2_ERROR_LOG"'
|
||||
depends_on = carbon-cache, mariadb
|
||||
stdout_logfile = /dev/stdout
|
||||
redirect_stderr = true
|
||||
autostart = true
|
||||
autorestart = true
|
||||
startsecs = 10
|
||||
startretries = 3
|
||||
exitcodes = 0
|
||||
stopsignal = TERM
|
||||
stopwaitsecs = 5
|
||||
|
||||
[program:apache2]
|
||||
command = /bin/bash -exo pipefail -c 'set -a; . /etc/apache2/envvars; set +a; exec apache2 -k start -DFOREGROUND'
|
||||
depends_on = mariadb
|
||||
stdout_logfile = /dev/stdout
|
||||
redirect_stderr = true
|
||||
autostart = true
|
||||
autorestart = true
|
||||
startsecs = 10
|
||||
startretries = 3
|
||||
exitcodes = 0
|
||||
stopsignal = TERM
|
||||
stopwaitsecs = 5
|
||||
|
||||
[program:mariadb]
|
||||
command = /usr/sbin/mysqld -u mysql
|
||||
stdout_logfile = /dev/stdout
|
||||
redirect_stderr = true
|
||||
autostart = true
|
||||
autorestart = true
|
||||
startsecs = 10
|
||||
startretries = 3
|
||||
exitcodes = 0
|
||||
stopsignal = TERM
|
||||
stopwaitsecs = 5
|
||||
|
||||
[program:carbon-cache]
|
||||
command = nosu graphite graphite /opt/graphite/bin/carbon-cache.py --config=/opt/graphite/conf/carbon.conf --nodaemon start
|
||||
stdout_logfile = /dev/stdout
|
||||
redirect_stderr = true
|
||||
autostart = true
|
||||
autorestart = true
|
||||
startsecs = 10
|
||||
startretries = 3
|
||||
exitcodes = 0
|
||||
stopsignal = TERM
|
||||
stopwaitsecs = 5
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
FROM debian:9 as icingaweb2-module-graphite
|
||||
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
|
||||
|
||||
ADD . /icingaweb2-module-graphite
|
||||
|
||||
RUN rm -rf /icingaweb2-module-graphite/.* || true
|
||||
|
||||
|
||||
FROM debian:9
|
||||
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]
|
||||
|
||||
RUN apt-get update ;\
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y \
|
||||
apt-transport-https gnupg2 dirmngr ca-certificates ;\
|
||||
apt-get clean ;\
|
||||
rm -vrf /var/lib/apt/lists/* ;\
|
||||
apt-key adv --fetch-keys 'https://packages.icinga.com/icinga.key' ;\
|
||||
DEBIAN_FRONTEND=noninteractive apt-get purge -y gnupg2 dirmngr ;\
|
||||
DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y
|
||||
|
||||
ADD .docker/apt-ext.list /etc/apt/sources.list.d/ext.list
|
||||
|
||||
RUN apt-get update ;\
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --no-install-suggests -y \
|
||||
icinga2-{bin,ido-mysql} dbconfig-no-thanks mariadb-server \
|
||||
apache2 icingaweb2{,-module-monitoring} icingacli php7.0-{intl,imagick,mysql,curl} locales \
|
||||
gcc libapache2-mod-wsgi libcairo2 libffi-dev python{,-dev} virtualenv ;\
|
||||
apt-get clean ;\
|
||||
rm -vrf /var/lib/apt/lists/* /etc/icinga2/conf.d/* /etc/icingaweb2/* ;\
|
||||
a2dissite 000-default ;\
|
||||
perl -pi -e 's~//~~ if /const NodeName/' /etc/icinga2/constants.conf ;\
|
||||
perl -pi -e 'if (!%locales) { %locales = (); for my $d ("", "/modules/monitoring") { for my $f (glob "/usr/share/icingaweb2${d}/application/locale/*_*") { if ($f =~ m~/(\w+)$~) { $locales{$1} = undef } } } } s/^# ?// if (/ UTF-8$/ && /^# (\w+)/ && exists $locales{$1})' /etc/locale.gen ;\
|
||||
perl -e 'print "object GraphiteWriter \"graphite\" {\n enable_send_thresholds = true\n enable_send_metadata = true\n}\n"' > /etc/icinga2/features-available/graphite.conf
|
||||
|
||||
RUN adduser --system --group --home /opt/graphite/home graphite ;\
|
||||
chown graphite:graphite /opt/graphite ;\
|
||||
su -ls /bin/bash -c 'set -exo pipefail; /usr/bin/virtualenv /opt/graphite; . /opt/graphite/bin/activate; export PYTHONPATH=/opt/graphite/lib/:/opt/graphite/webapp/; /opt/graphite/bin/pip install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/87ae6def1bece7e079d49a61ac8d09c6ebfe4e96; /opt/graphite/bin/pip install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/f36da0f77aaf83a61f9880dec7abbf5c14a7d2bb; /opt/graphite/bin/pip install --no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/53d96432b6ba1c30797405dff97ba01af009cb25; for f in /opt/graphite/conf/*.example; do ln -vs "$f" "/opt/graphite/conf/$(basename "$f" .example)"; done; /opt/graphite/bin/django-admin migrate --settings=graphite.settings' graphite
|
||||
|
||||
COPY --from=grandmaster/nosu:latest /usr/local/bin/nosu /usr/local/bin/nosu
|
||||
|
||||
COPY --from=icingaweb2-module-graphite /icingaweb2-module-graphite /usr/share/icingaweb2/modules/graphite
|
||||
|
||||
RUN set -a; . /etc/default/icinga2; set +a ;\
|
||||
/usr/lib/icinga2/prepare-dirs /etc/default/icinga2
|
||||
|
||||
RUN install -m 755 -o mysql -g root -d /var/run/mysqld
|
||||
|
||||
RUN mysqld -u mysql & \
|
||||
MYSQLD_PID="$!" ;\
|
||||
while ! mysql <<<''; do sleep 1; done ;\
|
||||
mysql <<<"CREATE DATABASE icinga2; USE icinga2; $(< /usr/share/icinga2-ido-mysql/schema/mysql.sql) GRANT ALL ON icinga2.* TO nagios@localhost IDENTIFIED VIA unix_socket; GRANT SELECT ON icinga2.* TO 'www-data'@localhost IDENTIFIED VIA unix_socket;" ;\
|
||||
kill "$MYSQLD_PID" ;\
|
||||
while test -e "/proc/$MYSQLD_PID"; do sleep 1; done
|
||||
|
||||
COPY .docker/icinga2-ido.conf /etc/icinga2/features-available/ido-mysql.conf
|
||||
|
||||
RUN set -a; . /etc/default/icinga2; set +a ;\
|
||||
for f in command graphite ido-mysql; do icinga2 feature enable $f; done
|
||||
|
||||
COPY .docker/php-icingaweb2.ini /etc/php/7.0/apache2/conf.d/99-icingaweb2.ini
|
||||
ADD --chown=www-data:icingaweb2 .docker/icingaweb2 /etc/icingaweb2
|
||||
|
||||
RUN install -o www-data -g icingaweb2 -m 02770 -d /etc/icingaweb2/enabledModules ;\
|
||||
ln -vs /usr/share/icingaweb2/modules/monitoring /etc/icingaweb2/enabledModules/monitoring ;\
|
||||
ln -vs /usr/share/icingaweb2/modules/graphite /etc/icingaweb2/enabledModules/graphite ;\
|
||||
locale-gen -j 4
|
||||
|
||||
COPY .docker/apache2-site.conf /etc/apache2/sites-available/icingaweb2.conf
|
||||
RUN a2enmod proxy; a2enmod proxy_http; a2ensite icingaweb2
|
||||
|
||||
COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord
|
||||
COPY .docker/supervisord.conf /etc/
|
||||
|
||||
CMD icingacli graphite icinga2 config >/etc/icinga2/conf.d/graphite.conf ;\
|
||||
exec supervisord -c /etc/supervisord.conf
|
||||
|
|
@ -1,37 +1,15 @@
|
|||
# <a id="Demonstration"></a>Demonstration
|
||||
|
||||
This repository ships a [Dockerfile](../Dockerfile.demo) for demonstrating
|
||||
and/or developing this module (but not for using it in production).
|
||||
|
||||
Build:
|
||||
This module provides a CLI command for demonstrating
|
||||
graph templates (useful for developing them):
|
||||
|
||||
```bash
|
||||
docker build -t icingaweb2-module-graphite-demo -f Dockerfile.demo .
|
||||
icingacli graphite icinga2 config
|
||||
```
|
||||
|
||||
Run:
|
||||
It generates Icinga 2 config based on the present graph templates.
|
||||
With this config Icinga will (also) "monitor" dummy services yielding random
|
||||
perfdata as expected by the graph templates.
|
||||
|
||||
```bash
|
||||
docker run -itp 8080:80 icingaweb2-module-graphite-demo
|
||||
```
|
||||
|
||||
The container serves an Icinga Web 2 with this module and all dependencies
|
||||
at http://localhost:8080/icingaweb2 and Graphite Web at http://localhost:8080.
|
||||
|
||||
Icinga monitors dummy services yielding random perfdata
|
||||
as expected by the shipped graph templates.
|
||||
|
||||
Use the container for development without re-building:
|
||||
|
||||
```bash
|
||||
docker run -itp 8080:80 -v "$(pwd):/usr/share/icingaweb2/modules/graphite" icingaweb2-module-graphite-demo
|
||||
```
|
||||
|
||||
Code changes are visible immediately, but graph template changes
|
||||
require a container restart.
|
||||
|
||||
Preserve graphs:
|
||||
|
||||
```bash
|
||||
docker run -itp 8080:80 -v "$(pwd)/.whisper:/opt/graphite/storage/whisper" icingaweb2-module-graphite-demo
|
||||
```
|
||||
I. e.: If that Icinga is also writing to the Graphite that is
|
||||
read by this module, you'll get dummy graphs for all templates.
|
||||
|
|
|
|||
Loading…
Reference in a new issue