Compare commits

...

6 commits
pages ... main

Author SHA1 Message Date
ccaf358904 Add some info to readme 2024-12-10 13:07:23 +01:00
5353f5de1d Add readme 2024-12-10 13:03:36 +01:00
2f5cdf49b0 Cleanup 2024-12-10 13:03:28 +01:00
757c460be5 Init 2024-12-10 13:00:10 +01:00
7033a7f74f Delete targets.json 2024-12-10 12:59:00 +01:00
09144c5d64 Delete README.md 2024-12-10 12:58:54 +01:00
6 changed files with 107 additions and 19 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
data/*

View file

@ -1,2 +1,23 @@
# mon-test
# cyber-gov backend?
Simple Prometheus setup for monitoring websites, with blackbox-exporter and Grafana.
Testing data source for target discovery is located in branch `pages` and is served on `https://mdivecky.nolog.page/mon-test/targets.json`
# Setup
```bash
mkdir -p ./data/prometheus
mkdir -p ./data/grafana
chown -R 1000:1000 ./data/*
# Or switch to docker volumes for prometheus and Grafana, if you don't want to deal with permissions
docker compose up -d
# -> Goto http://localhost:3000
# Login to Grafana with admin:admin
# Add Prometheus datasource, with URL "http://prometheus:9090"
# Import or create some dashboards
# Profit $$$
```

52
compose.yml Normal file
View file

@ -0,0 +1,52 @@
services:
blackbox:
image: prom/blackbox-exporter:latest
command:
- --config.file=/etc/blackbox/blackbox.yml
volumes:
- ./config/blackbox:/etc/blackbox
ports:
- 127.0.0.1:9115:9115 # Debug only
prometheus:
image: prom/prometheus:latest
user: 1000:1000
ports:
- 127.0.0.1:9094:9090 # Debug only
volumes:
- ./config/prometheus:/etc/prometheus
- ./data/prometheus:/prometheus
command: --web.enable-lifecycle --web.enable-remote-write-receiver --config.file=/etc/prometheus/prometheus.yml
restart: unless-stopped
grafana:
image: grafana/grafana-oss:latest
restart: unless-stopped
user: 1000:1000
environment:
GF_DATABASE_TYPE: postgres
GF_DATABASE_HOST: grafana_db:5432
GF_DATABASE_NAME: grafana
GF_DATABASE_USER: grafana
GF_DATABASE_PASSWORD: grafana
GF_DATABASE_SSL_MODE: disable
#GF_SERVER_ROOT_URL: "https://grafana.druit.org/"
depends_on:
- grafana_db
ports:
- 3000:3000
volumes:
- ./data/grafana:/var/lib/grafana
# - ./config/grafana/provisioning:/etc/grafana/provisioning
# - ./config/grafana/dashboards:/var/lib/grafana/dashboards
grafana_db:
image: postgres:15
restart: unless-stopped
environment:
POSTGRES_DB: grafana
POSTGRES_USER: grafana
POSTGRES_PASSWORD: grafana
volumes:
- ./data/grafana-db:/var/lib/postgresql/data

View file

@ -0,0 +1,8 @@
modules:
http_2xx:
prober: http
timeout: 60s
http:
method: GET
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
preferred_ip_protocol: "ip4"

View file

@ -0,0 +1,24 @@
global:
scrape_interval: 20s
scrape_timeout: 10s
evaluation_interval: 20s
scrape_configs:
- job_name: 'blackbox/primary'
metrics_path: /probe
scrape_interval: 60s
scrape_timeout: 45s
params:
module: [http_2xx]
http_sd_configs:
- url: https://mdivecky.nolog.page/mon-test/targets.json
refresh_interval: 600s
relabel_configs:
- source_labels: [check_url]
target_label: __address__
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox:9115

View file

@ -1,18 +0,0 @@
[
{
"targets": [
"nolog.cz"
],
"labels": {
"check_url": "http://nolog.cz/"
}
},
{
"targets": [
"cyberladies.cz"
],
"labels": {
"check_url": "https://www.cyberladies.cz/"
}
}
]