」 feat: added nginx exporter

This commit is contained in:
2025-07-22 16:38:11 +02:00
parent 1a1555f0c1
commit 4de9a323e4
8 changed files with 30 additions and 3 deletions

View File

@ -39,3 +39,10 @@ server {
server_name example.com; server_name example.com;
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
} }
server {
listen 8080;
location /nginx_status {
stub_status;
}
}

View File

@ -1,2 +1,3 @@
include: include:
- ./prometheus/compose.yml - ./prometheus/compose.yml
- ./exporters/compose.yml

View File

@ -0,0 +1,2 @@
include:
- ./nginx/compose.yml

View File

@ -0,0 +1,12 @@
services:
nginx-exporter:
container_name: transcendence-nginx-exporter
image: nginx/nginx-prometheus-exporter:latest
command:
- '-nginx.scrape-uri=http://transcendence-front:8080/nginx_status'
depends_on:
front:
condition: service_started
networks:
- front
- prom-exporter

View File

@ -26,4 +26,5 @@ services:
- '--web.enable-lifecycle' - '--web.enable-lifecycle'
networks: networks:
- prom - prom
- prom-exporter
restart: unless-stopped restart: unless-stopped

View File

@ -1,5 +1,5 @@
global: global:
scrape_interval: 30s scrape_interval: 5s
# alerting: # alerting:
# alertmanagers: # alertmanagers:
@ -15,3 +15,7 @@ scrape_configs:
password: PROM_ADMIN_PASSWD password: PROM_ADMIN_PASSWD
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: ['localhost:9090']
- job_name: 'nginx'
static_configs:
- targets: ['nginx-exporter:9113']

View File

@ -15,13 +15,13 @@ if (!env || env === 'development') {
function prepareDB() { function prepareDB() {
database.exec(` database.exec(`
CREATE TABLE userData ( CREATE TABLE IF NOT EXISTS userData (
username TEXT PRIMARY KEY, username TEXT PRIMARY KEY,
displayName TEXT displayName TEXT
) STRICT ) STRICT
`); `);
database.exec(` database.exec(`
CREATE TABLE friends ( CREATE TABLE IF NOT EXISTS friends (
username TEXT, username TEXT,
friendName TEXT, friendName TEXT,
UNIQUE(username, friendName), UNIQUE(username, friendName),