Skip to content

Commit

Permalink
feat: add nginx-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
massahito committed Aug 1, 2024
1 parent 6762637 commit c38c8de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ services:
command: "--config.file=/etc/alertmanager/alertmanager.yaml"
restart: always

nginx-exporter:
image: "nginx/nginx-prometheus-exporter"
ports:
- "9113:9113"
entrypoint: nginx-prometheus-exporter -nginx.scrape-uri=http://web/nginx_status
restart: always


volumes:
db_data: {}
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/requirements/Nginx/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ server {
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;

location /nginx_status {
stab_status on;
access_log off;
}

location /static {
alias /usr/share/nginx/html/static;
}
Expand Down
6 changes: 5 additions & 1 deletion .devcontainer/requirements/Prometheus/prometheus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ rule_files:
- '/etc/prometheus/server-down.rules'

scrape_configs:
- job_name: 'prometheus'
- job_name: 'django'
metrics_path: '/metrics/metrics'
scheme: 'http'
static_configs:
- targets: ['app:8000']
basic_auth:
username: 'admin'
password: 'password123'
- job_name: 'nginx'
scheme: 'http'
static_configs:
- targets: ['nginx-exporter:9113']

alerting:
alertmanagers:
Expand Down

0 comments on commit c38c8de

Please sign in to comment.