28/10
This commit is contained in:
parent
31f2628538
commit
cd8b52548b
35
h origin 82cf40e:develop
Normal file
35
h origin 82cf40e:develop
Normal file
@ -0,0 +1,35 @@
|
||||
[33m82cf40e[m[33m ([m[1;36mHEAD[m[33m -> [m[1;32mdevelop[m[33m)[m 28/10/25
|
||||
[33m3fb910b[m 24/10/25
|
||||
[33m94a1c8a[m 24/10/25
|
||||
[33mdc4f1fc[m Merge branch 'develop' of http://20.19.88.39/Ornel_Zply/PFE_Infrastrastruture_Observabilite into develop
|
||||
[33m31f2628[m[33m ([m[1;31morigin/develop[m[33m)[m mise a jour
|
||||
[33mbc1a17a[m Merge branch 'develop' of http://20.19.88.39/Ornel_Zply/PFE_Infrastrastruture_Observabilite into develop
|
||||
[33m6604b6d[m maj1
|
||||
[33m890a2fa[m maj
|
||||
[33m4a2a0b0[m tuto_miseàjour
|
||||
[33m3b6e6b9[m 24/10/25
|
||||
[33m209a53c[m 23/10/25
|
||||
[33m5f461b7[m 23/10/25
|
||||
[33mea5a00a[m 23/10/25
|
||||
[33m566d390[m 23/10/25
|
||||
[33mec6060c[m 23/10/25
|
||||
[33mb01e5c5[m 23/10/25
|
||||
[33md5ed210[m 23/10/25
|
||||
[33m4eb41d0[m 23/10/25
|
||||
[33mafbe59c[m 23/10/25
|
||||
[33medcc697[m[33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m, [m[1;32mmain[m[33m)[m 16/10
|
||||
[33m9fd9083[m 10/10
|
||||
[33md73bf44[m 10/10
|
||||
[33m95914d8[m 03/2025
|
||||
[33m60e9398[m 03/10/25
|
||||
[33m1affade[m 03/10/25
|
||||
[33mfdf04b7[m 03/10/2025
|
||||
[33m31f4c1b[m 03/10/2025
|
||||
[33mc30146e[m commit 29/09
|
||||
[33mef8a93d[m commit 25/09
|
||||
[33m1e41d55[m commit 25/09
|
||||
[33mbaf9071[m commit 25/09
|
||||
[33mce0b45c[m update
|
||||
[33ma60b38d[m update
|
||||
[33m091664a[m Update README.md
|
||||
[33ma0e2214[m Initial commit
|
||||
104
observabilite_service/Machine_service/scripts/monitoring.sh
Executable file
104
observabilite_service/Machine_service/scripts/monitoring.sh
Executable file
@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Variables
|
||||
APACHE_EXPORTER_VERSION="1.0.10"
|
||||
PROMTAIL_VERSION="2.9.0"
|
||||
PROMTAIL_CONFIG="/etc/promtail-config.yaml"
|
||||
LOKI_URL="http://192.168.56.20:3100/loki/api/v1/push"
|
||||
|
||||
echo "=== Installation des dépendances ==="
|
||||
sudo apt update
|
||||
sudo apt install -y wget unzip apache2
|
||||
|
||||
echo "=== Installation et configuration de apache_exporter ==="
|
||||
cd /opt
|
||||
wget https://github.com/Lusitaniae/apache_exporter/releases/download/v${APACHE_EXPORTER_VERSION}/apache_exporter-${APACHE_EXPORTER_VERSION}.linux-amd64.tar.gz
|
||||
tar -xvf apache_exporter-${APACHE_EXPORTER_VERSION}.linux-amd64.tar.gz
|
||||
sudo mv apache_exporter-${APACHE_EXPORTER_VERSION}.linux-amd64/apache_exporter /usr/local/bin/
|
||||
|
||||
# Création du service systemd pour apache_exporter
|
||||
sudo tee /etc/systemd/system/apache_exporter.service > /dev/null <<EOL
|
||||
[Unit]
|
||||
Description=Prometheus Apache Exporter
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/apache_exporter --scrape_uri="http://localhost/server-status?auto"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOL
|
||||
|
||||
echo "=== Activation du module status d'Apache ==="
|
||||
sudo a2enmod status
|
||||
sudo systemctl restart apache2
|
||||
|
||||
echo "=== Démarrage du service apache_exporter ==="
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable apache_exporter
|
||||
sudo systemctl start apache_exporter
|
||||
sudo systemctl status apache_exporter --no-pager
|
||||
|
||||
echo "=== Installation et configuration de Promtail ==="
|
||||
cd /opt
|
||||
wget https://github.com/grafana/loki/releases/download/v${PROMTAIL_VERSION}/promtail-linux-amd64.zip
|
||||
unzip promtail-linux-amd64.zip
|
||||
sudo mv promtail-linux-amd64 /usr/local/bin/promtail
|
||||
sudo chmod +x /usr/local/bin/promtail
|
||||
|
||||
# Création du fichier de configuration Promtail
|
||||
sudo tee ${PROMTAIL_CONFIG} > /dev/null <<EOL
|
||||
server:
|
||||
http_listen_port: 9080
|
||||
grpc_listen_port: 0
|
||||
|
||||
positions:
|
||||
filename: /var/log/promtail-positions.yaml
|
||||
|
||||
clients:
|
||||
- url: ${LOKI_URL}
|
||||
|
||||
scrape_configs:
|
||||
- job_name: apache_access
|
||||
static_configs:
|
||||
- targets: ['localhost']
|
||||
labels:
|
||||
job: apache_access
|
||||
host: apache_vm
|
||||
__path__: /var/log/apache2/access.log
|
||||
|
||||
- job_name: apache_error
|
||||
static_configs:
|
||||
- targets: ['localhost']
|
||||
labels:
|
||||
job: apache_error
|
||||
host: apache_vm
|
||||
__path__: /var/log/apache2/error.log
|
||||
EOL
|
||||
|
||||
# Création du service systemd pour Promtail
|
||||
sudo tee /etc/systemd/system/promtail.service > /dev/null <<EOL
|
||||
[Unit]
|
||||
Description=Promtail service for Apache logs
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/promtail -config.file ${PROMTAIL_CONFIG}
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOL
|
||||
|
||||
echo "=== Démarrage du service Promtail ==="
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable promtail
|
||||
sudo systemctl start promtail
|
||||
sudo systemctl status promtail --no-pager
|
||||
|
||||
echo "=== Installation terminée ==="
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
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
|
||||
@ -1,59 +0,0 @@
|
||||
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
|
||||
@ -1,15 +0,0 @@
|
||||
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']
|
||||
@ -1,30 +0,0 @@
|
||||
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
|
||||
Loading…
x
Reference in New Issue
Block a user