diff --git a/observabilite_service/Services/Tuto.txt b/observabilite_service/Machine_service/Tuto.txt similarity index 100% rename from observabilite_service/Services/Tuto.txt rename to observabilite_service/Machine_service/Tuto.txt diff --git a/observabilite_service/Machine_virtuelle/docker-compose.yml b/observabilite_service/Machine_virtuelle/docker-compose.yml new file mode 100644 index 0000000..28c31aa --- /dev/null +++ b/observabilite_service/Machine_virtuelle/docker-compose.yml @@ -0,0 +1,60 @@ +services: + prometheus: + image: prom/prometheus:latest + container_name: prometheus + volumes: + - ./prometheus.yml:/etc/prometheus/prometheus.yml + command: + - '--config.file=/etc/prometheus/prometheus.yml' + ports: + - "9090:9090" + networks: + - observability + + grafana: + image: grafana/grafana:latest + container_name: grafana + ports: + - "3000:3000" + volumes: + - grafana-data:/var/lib/grafana + environment: + - GF_SECURITY_ADMIN_USER=admin + - GF_SECURITY_ADMIN_PASSWORD=admin + networks: + - observability + depends_on: + - loki + + loki: + image: grafana/loki:2.8.2 + container_name: loki + ports: + - "3100:3100" + command: -config.file=/etc/loki/local-config.yaml + volumes: + - ./loki-config.yaml:/etc/loki/local-config.yaml + - /opt/loki/wal:/wal + - /opt/loki/chunks:/loki/chunks + - /opt/loki/index:/loki/index + networks: + - observability + + promtail: + image: grafana/promtail:2.8.2 + container_name: promtail + volumes: + - ./promtail-config.yaml:/etc/promtail/config.yaml + - /var/lib/docker/containers:/var/lib/docker/containers:ro + - /var/log:/var/log:ro + command: + - -config.file=/etc/promtail/config.yaml + networks: + - observability + +volumes: + grafana-data: + +networks: + observability: + driver: bridge diff --git a/observabilite_service/Machine_virtuelle/loki-config.yaml b/observabilite_service/Machine_virtuelle/loki-config.yaml new file mode 100644 index 0000000..63d45cb --- /dev/null +++ b/observabilite_service/Machine_virtuelle/loki-config.yaml @@ -0,0 +1,59 @@ +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 \ No newline at end of file diff --git a/observabilite_service/Machine_virtuelle/prometheus.yml b/observabilite_service/Machine_virtuelle/prometheus.yml new file mode 100644 index 0000000..442cce0 --- /dev/null +++ b/observabilite_service/Machine_virtuelle/prometheus.yml @@ -0,0 +1,15 @@ +global: + scrape_interval: 15s + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'node_exporter_vmservices' + static_configs: + - targets: ['192.168.56.17:9100'] + + - job_name: 'apache_vmservices' + static_configs: + - targets: ['192.168.56.17:9117'] diff --git a/observabilite_service/Machine_virtuelle/promtail-config.yaml b/observabilite_service/Machine_virtuelle/promtail-config.yaml new file mode 100644 index 0000000..1ad0bff --- /dev/null +++ b/observabilite_service/Machine_virtuelle/promtail-config.yaml @@ -0,0 +1,30 @@ +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 + pipeline_stages: + - docker: {} + + - job_name: system_logs + static_configs: + - targets: ['localhost'] + labels: + job: syslog + __path__: /var/log/syslog + - targets: ['localhost'] + labels: + job: auth + __path__: /var/log/auth.log diff --git a/observabilite_service/note.txt b/observabilite_service/note.txt deleted file mode 100644 index d6540e8..0000000 --- a/observabilite_service/note.txt +++ /dev/null @@ -1,25 +0,0 @@ -Acces a VM du Git qui est sur Azure, commande: - -zinsouor@master-tc-2026-w11:~/VM_Sauvegarde/VM_Sauvegarde_Gitea$ ls -Gitea_cle.pem logs scripts tuto_install_git.txt Vagrantfile - -ssh -i Gitea_cle.pem azureuser@20.19.88.39 - ---> le fichier qui sauvegarde le git - -root@Gitea:~# ls (existe en root) -backup-gitea.sh (un crontab est fait derriere ca: 0 23 * * 4,5,6 /root/backup-gitea.sh) - ---> l'endroit où c'est sauvegarder - -azureuser@Gitea:~$ cd /backup/ -azureuser@Gitea:/backup$ ls -gitea -azureuser@Gitea:/backup$ cd gitea/ -azureuser@Gitea:/backup/gitea$ ls -azureuser@Gitea:/backup/gitea$ - ---> backup vers une vm-sauvegarde local - -scp -i ../Gitea_cle.pem azureuser@20.19.88.39:/backup/gitea/gitea-backup-2025-10-02.tar.gz . -scp -i ../cle/Gitea_cle.pem azureuser@20.19.88.39:/backup/gitea/gitea-backup-2025-10-09.tar.gz ../backup/