From 50003c62c4aa07bcb5e59bfd3b3a94d308758a2a Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Fri, 13 Feb 2026 22:39:27 +0100 Subject: [PATCH] Add Metricbeat integration for system, Docker, and Nginx metrics - Enable Nginx `stub_status` endpoint on port 8080 for internal metric collection. - Add Metricbeat configuration for system, Docker, and Nginx metrics, integrating with Elasticsearch and Kibana. --- services/metricbeat/metricbeat.yml | 44 ++++++++++++++++++++++++++++++ services/nginx/nginx.dev.conf | 12 ++++++++ 2 files changed, 56 insertions(+) create mode 100644 services/metricbeat/metricbeat.yml diff --git a/services/metricbeat/metricbeat.yml b/services/metricbeat/metricbeat.yml new file mode 100644 index 00000000..5bac3f86 --- /dev/null +++ b/services/metricbeat/metricbeat.yml @@ -0,0 +1,44 @@ +metricbeat.config.modules: + path: ${path.config}/modules.d/*.yml + reload.enabled: false + +setup.kibana.host: "http://kibana:5601" +setup.dashboards.enabled: true + +output.elasticsearch: + hosts: ["http://elasticsearch:9200"] + +metricbeat.modules: + # System metrics (container-level when running in Docker Desktop) + - module: system + period: 10s + metricsets: + - cpu + - load + - memory + - network + - process + - process_summary + - filesystem + - fsstat + - uptime + processes: ['.*'] + + # Docker metrics (containers CPU/mem/network, etc.) + - module: docker + hosts: ["unix:///var/run/docker.sock"] + period: 10s + enabled: true + # Common metricsets: container,cpu,diskio,event,healthcheck,info,memory,network + # Use defaults to keep noise reasonable + + # Nginx metrics from stub_status (enabled in nginx.dev.conf on port 8080) + - module: nginx + metricsets: ["stubstatus"] + period: 10s + hosts: ["http://nginx:8080/stub_status"] + enabled: true + +processors: + - add_host_metadata: ~ + - add_docker_metadata: ~ diff --git a/services/nginx/nginx.dev.conf b/services/nginx/nginx.dev.conf index eb8c63aa..a182fb19 100644 --- a/services/nginx/nginx.dev.conf +++ b/services/nginx/nginx.dev.conf @@ -71,4 +71,16 @@ http { location ~ /\. { deny all; } location ~ /\.ht { deny all; } } + + # Internal metrics endpoint for Metricbeat (not exposed to host) + # Scraped at http://nginx:8080/stub_status by the metricbeat nginx module + server { + listen 8080; + server_name _; + access_log off; + location /stub_status { + stub_status; + allow all; # safe within the docker network; not published to host + } + } }