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.
This commit is contained in:
@@ -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: ~
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user