update
This commit is contained in:
parent
d33b6d0dc4
commit
23117181ef
132
centre_observabilite/logs/docker-compose.yml
Normal file
132
centre_observabilite/logs/docker-compose.yml
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
services:
|
||||||
|
loki:
|
||||||
|
image: grafana/loki:2.8.2
|
||||||
|
container_name: loki-observability
|
||||||
|
ports:
|
||||||
|
- "3100:3100"
|
||||||
|
command: -config.file=/etc/loki/local-config.yaml
|
||||||
|
configs:
|
||||||
|
- source: loki_config
|
||||||
|
target: /etc/loki/local-config.yaml
|
||||||
|
volumes:
|
||||||
|
- loki-wal:/wal
|
||||||
|
- loki-chunks:/loki/chunks
|
||||||
|
- loki-index:/loki/index
|
||||||
|
networks:
|
||||||
|
- observability_observability
|
||||||
|
|
||||||
|
promtail-config-init:
|
||||||
|
image: busybox:latest
|
||||||
|
container_name: promtail-config-init
|
||||||
|
volumes:
|
||||||
|
- promtail-config-vol:/config
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cat > /config/config.yaml <<'EOF'
|
||||||
|
server:
|
||||||
|
http_listen_port: 9080
|
||||||
|
grpc_listen_port: 0
|
||||||
|
positions:
|
||||||
|
filename: /tmp/positions.yaml
|
||||||
|
clients:
|
||||||
|
- url: http://loki:3100/loki/api/v1/push
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: docker_logs
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: docker
|
||||||
|
__path__: /var/lib/docker/containers/*/*.log
|
||||||
|
- job_name: system_logs
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: syslog
|
||||||
|
__path__: /var/log/*.log
|
||||||
|
EOF
|
||||||
|
echo "Promtail config created"
|
||||||
|
restart: "no"
|
||||||
|
networks:
|
||||||
|
- observability_observability
|
||||||
|
|
||||||
|
promtail:
|
||||||
|
image: grafana/promtail:2.8.2
|
||||||
|
container_name: promtail-observability
|
||||||
|
volumes:
|
||||||
|
- /var/lib/docker/containers:/var/lib/docker/containers:ro
|
||||||
|
- /var/log:/var/log:ro
|
||||||
|
- promtail-config-vol:/etc/promtail:ro
|
||||||
|
command:
|
||||||
|
- -config.file=/etc/promtail/config.yaml
|
||||||
|
networks:
|
||||||
|
- observability_observability
|
||||||
|
depends_on:
|
||||||
|
- promtail-config-init
|
||||||
|
|
||||||
|
configs:
|
||||||
|
loki_config:
|
||||||
|
content: |
|
||||||
|
auth_enabled: false
|
||||||
|
server:
|
||||||
|
http_listen_port: 3100
|
||||||
|
grpc_listen_port: 9096
|
||||||
|
common:
|
||||||
|
path_prefix: /loki
|
||||||
|
storage:
|
||||||
|
filesystem:
|
||||||
|
chunks_directory: /loki/chunks
|
||||||
|
rules_directory: /loki/rules
|
||||||
|
replication_factor: 1
|
||||||
|
ring:
|
||||||
|
instance_addr: 127.0.0.1
|
||||||
|
kvstore:
|
||||||
|
store: inmemory
|
||||||
|
ingester:
|
||||||
|
wal:
|
||||||
|
enabled: true
|
||||||
|
dir: /wal
|
||||||
|
flush_on_shutdown: true
|
||||||
|
chunk_idle_period: 5m
|
||||||
|
chunk_retain_period: 30s
|
||||||
|
max_chunk_age: 1h
|
||||||
|
lifecycler:
|
||||||
|
ring:
|
||||||
|
replication_factor: 1
|
||||||
|
schema_config:
|
||||||
|
configs:
|
||||||
|
- from: 2020-10-24
|
||||||
|
store: boltdb-shipper
|
||||||
|
object_store: filesystem
|
||||||
|
schema: v11
|
||||||
|
index:
|
||||||
|
prefix: index_
|
||||||
|
period: 24h
|
||||||
|
storage_config:
|
||||||
|
boltdb_shipper:
|
||||||
|
active_index_directory: /loki/index
|
||||||
|
cache_location: /loki/index
|
||||||
|
shared_store: filesystem
|
||||||
|
filesystem:
|
||||||
|
directory: /loki/chunks
|
||||||
|
limits_config:
|
||||||
|
enforce_metric_name: false
|
||||||
|
reject_old_samples: true
|
||||||
|
reject_old_samples_max_age: 168h
|
||||||
|
ingestion_rate_mb: 10
|
||||||
|
ingestion_burst_size_mb: 20
|
||||||
|
compactor:
|
||||||
|
working_directory: /loki/compactor
|
||||||
|
shared_store: filesystem
|
||||||
|
compaction_interval: 10m
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
promtail-config-vol:
|
||||||
|
loki-wal:
|
||||||
|
loki-chunks:
|
||||||
|
loki-index:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
observability_observability:
|
||||||
|
external: true
|
||||||
74
centre_observabilite/metrics/docker-compose.yml
Normal file
74
centre_observabilite/metrics/docker-compose.yml
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# docker-compose-metrics.yml
|
||||||
|
# Lancer en premier : docker compose -f docker-compose-metrics.yml up -d
|
||||||
|
|
||||||
|
services:
|
||||||
|
prometheus-config-init:
|
||||||
|
image: busybox:latest
|
||||||
|
container_name: prometheus-config-init
|
||||||
|
volumes:
|
||||||
|
- prometheus-config-vol:/config
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cat > /config/prometheus.yml <<'EOF'
|
||||||
|
global:
|
||||||
|
scrape_interval: 15s
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
||||||
|
- job_name: 'observabilite'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['172.17.0.1:9100']
|
||||||
|
- job_name: 'scaphandre'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['192.168.56.61:8080']
|
||||||
|
fallback_scrape_protocol: "PrometheusText1.0.0"
|
||||||
|
- job_name: 'apache_vmservices'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['apache_exporter_service:9117']
|
||||||
|
- job_name: 'vms'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['192.168.56.18:9100']
|
||||||
|
EOF
|
||||||
|
echo "Prometheus config created"
|
||||||
|
restart: "no"
|
||||||
|
networks:
|
||||||
|
- observability
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus:latest
|
||||||
|
container_name: prometheus-observability
|
||||||
|
volumes:
|
||||||
|
- prometheus-config-vol:/etc/prometheus:ro
|
||||||
|
command:
|
||||||
|
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||||
|
ports:
|
||||||
|
- "9090:9090"
|
||||||
|
networks:
|
||||||
|
- observability
|
||||||
|
depends_on:
|
||||||
|
- prometheus-config-init
|
||||||
|
|
||||||
|
node_exporter:
|
||||||
|
image: prom/node-exporter:latest
|
||||||
|
container_name: node-exporter
|
||||||
|
restart: unless-stopped
|
||||||
|
pid: "host"
|
||||||
|
network_mode: "host"
|
||||||
|
volumes:
|
||||||
|
- /proc:/host/proc:ro
|
||||||
|
- /sys:/host/sys:ro
|
||||||
|
- /:/rootfs:ro
|
||||||
|
command:
|
||||||
|
- '--path.procfs=/host/proc'
|
||||||
|
- '--path.sysfs=/host/sys'
|
||||||
|
- '--collector.filesystem.ignored-mount-points="^/(sys|proc|dev|host|etc)($$|/)"'
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
prometheus-config-vol:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
observability:
|
||||||
|
driver: bridge
|
||||||
23
centre_observabilite/visualisation/docker-compose.yml
Normal file
23
centre_observabilite/visualisation/docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# docker-compose-visualisation.yml
|
||||||
|
# Lancer en troisième : docker compose -f docker-compose-visualisation.yml up -d
|
||||||
|
|
||||||
|
services:
|
||||||
|
grafana:
|
||||||
|
image: grafana/grafana:latest
|
||||||
|
container_name: grafana-observability
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
volumes:
|
||||||
|
- grafana-data:/var/lib/grafana
|
||||||
|
environment:
|
||||||
|
- GF_SECURITY_ADMIN_USER=admin
|
||||||
|
- GF_SECURITY_ADMIN_PASSWORD=admin
|
||||||
|
networks:
|
||||||
|
- observability_observability
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
grafana-data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
observability_observability:
|
||||||
|
external: true
|
||||||
176
conteneur/services/apache_service/docker-compose.yml
Normal file
176
conteneur/services/apache_service/docker-compose.yml
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
services:
|
||||||
|
apache-config-init:
|
||||||
|
image: busybox:latest
|
||||||
|
container_name: apache-config-init
|
||||||
|
volumes:
|
||||||
|
- apache-config:/config
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cat > /config/httpd.conf <<'EOF'
|
||||||
|
ServerRoot "/usr/local/apache2"
|
||||||
|
Listen 80
|
||||||
|
|
||||||
|
LoadModule mpm_event_module modules/mod_mpm_event.so
|
||||||
|
LoadModule authn_file_module modules/mod_authn_file.so
|
||||||
|
LoadModule authn_core_module modules/mod_authn_core.so
|
||||||
|
LoadModule authz_host_module modules/mod_authz_host.so
|
||||||
|
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
|
||||||
|
LoadModule authz_user_module modules/mod_authz_user.so
|
||||||
|
LoadModule authz_core_module modules/mod_authz_core.so
|
||||||
|
LoadModule access_compat_module modules/mod_access_compat.so
|
||||||
|
LoadModule auth_basic_module modules/mod_auth_basic.so
|
||||||
|
LoadModule reqtimeout_module modules/mod_reqtimeout.so
|
||||||
|
LoadModule filter_module modules/mod_filter.so
|
||||||
|
LoadModule mime_module modules/mod_mime.so
|
||||||
|
LoadModule log_config_module modules/mod_log_config.so
|
||||||
|
LoadModule env_module modules/mod_env.so
|
||||||
|
LoadModule headers_module modules/mod_headers.so
|
||||||
|
LoadModule setenvif_module modules/mod_setenvif.so
|
||||||
|
LoadModule version_module modules/mod_version.so
|
||||||
|
LoadModule unixd_module modules/mod_unixd.so
|
||||||
|
LoadModule status_module modules/mod_status.so
|
||||||
|
LoadModule autoindex_module modules/mod_autoindex.so
|
||||||
|
LoadModule dir_module modules/mod_dir.so
|
||||||
|
LoadModule alias_module modules/mod_alias.so
|
||||||
|
|
||||||
|
<IfModule unixd_module>
|
||||||
|
User daemon
|
||||||
|
Group daemon
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
ServerAdmin admin@localhost
|
||||||
|
ServerName localhost
|
||||||
|
|
||||||
|
<Directory />
|
||||||
|
AllowOverride none
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
DocumentRoot "/usr/local/apache2/htdocs"
|
||||||
|
<Directory "/usr/local/apache2/htdocs">
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<IfModule dir_module>
|
||||||
|
DirectoryIndex index.html
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<Files ".ht*">
|
||||||
|
Require all denied
|
||||||
|
</Files>
|
||||||
|
|
||||||
|
ErrorLog /usr/local/apache2/logs/error_log
|
||||||
|
LogLevel warn
|
||||||
|
|
||||||
|
<IfModule log_config_module>
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||||
|
CustomLog /usr/local/apache2/logs/access_log combined
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
<IfModule mime_module>
|
||||||
|
TypesConfig conf/mime.types
|
||||||
|
AddType application/x-compress .Z
|
||||||
|
AddType application/x-gzip .gz .tgz
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
# Configuration du module status pour apache_exporter
|
||||||
|
<Location "/server-status">
|
||||||
|
SetHandler server-status
|
||||||
|
Require all granted
|
||||||
|
</Location>
|
||||||
|
EOF
|
||||||
|
echo "Apache config created"
|
||||||
|
restart: "no"
|
||||||
|
|
||||||
|
apache_service:
|
||||||
|
image: httpd:2.4
|
||||||
|
container_name: conteneur_service
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
volumes:
|
||||||
|
- apache-logs:/usr/local/apache2/logs
|
||||||
|
- apache-config:/usr/local/apache2/conf:ro
|
||||||
|
networks:
|
||||||
|
- observability
|
||||||
|
depends_on:
|
||||||
|
- apache-config-init
|
||||||
|
command: >
|
||||||
|
sh -c "touch /usr/local/apache2/logs/access_log /usr/local/apache2/logs/error_log &&
|
||||||
|
exec httpd-foreground"
|
||||||
|
|
||||||
|
apache_exporter:
|
||||||
|
image: lusotycoon/apache-exporter:v1.0.10
|
||||||
|
container_name: apache_exporter_service
|
||||||
|
command:
|
||||||
|
- '--scrape_uri=http://apache_service/server-status?auto'
|
||||||
|
ports:
|
||||||
|
- "9117:9117"
|
||||||
|
depends_on:
|
||||||
|
- apache_service
|
||||||
|
networks:
|
||||||
|
- observability
|
||||||
|
|
||||||
|
promtail-service-config-init:
|
||||||
|
image: busybox:latest
|
||||||
|
container_name: promtail-service-config-init
|
||||||
|
volumes:
|
||||||
|
- promtail-service-config-vol:/config
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
cat > /config/config.yaml <<'EOF'
|
||||||
|
server:
|
||||||
|
http_listen_port: 9080
|
||||||
|
grpc_listen_port: 0
|
||||||
|
positions:
|
||||||
|
filename: /tmp/positions.yaml
|
||||||
|
clients:
|
||||||
|
- url: http://192.168.56.61:3100/loki/api/v1/push
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: apache_access
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: apache_access
|
||||||
|
host: conteneur_service
|
||||||
|
__path__: /var/log/apache2/access_log
|
||||||
|
- job_name: apache_error
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: apache_error
|
||||||
|
host: conteneur_service
|
||||||
|
__path__: /var/log/apache2/error_log
|
||||||
|
EOF
|
||||||
|
echo "Promtail service config created"
|
||||||
|
restart: "no"
|
||||||
|
|
||||||
|
promtail_service:
|
||||||
|
image: grafana/promtail:2.9.0
|
||||||
|
container_name: promtail_service
|
||||||
|
volumes:
|
||||||
|
- apache-logs:/var/log/apache2:ro
|
||||||
|
- promtail-service-config-vol:/etc/promtail:ro
|
||||||
|
command:
|
||||||
|
- '-config.file=/etc/promtail/config.yaml'
|
||||||
|
depends_on:
|
||||||
|
- promtail-service-config-init
|
||||||
|
- apache_service
|
||||||
|
networks:
|
||||||
|
- observability
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
apache-logs:
|
||||||
|
apache-config:
|
||||||
|
promtail-service-config-vol:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
observability:
|
||||||
|
external: true
|
||||||
|
name: observability_observability
|
||||||
Loading…
x
Reference in New Issue
Block a user