Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
ec21982a62 |
7 changed files with 20 additions and 107 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
data/*
|
|
23
README.md
23
README.md
|
@ -1,23 +1,2 @@
|
||||||
# cyber-gov backend?
|
# mon-test
|
||||||
|
|
||||||
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
52
compose.yml
|
@ -1,52 +0,0 @@
|
||||||
|
|
||||||
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
|
|
|
@ -1,8 +0,0 @@
|
||||||
modules:
|
|
||||||
http_2xx:
|
|
||||||
prober: http
|
|
||||||
timeout: 60s
|
|
||||||
http:
|
|
||||||
method: GET
|
|
||||||
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
|
|
||||||
preferred_ip_protocol: "ip4"
|
|
|
@ -1,24 +0,0 @@
|
||||||
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
|
|
1
index.html
Normal file
1
index.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Hello, testing pages
|
18
targets.json
Normal file
18
targets.json
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"targets": [
|
||||||
|
"nolog.cz"
|
||||||
|
],
|
||||||
|
"labels": {
|
||||||
|
"check_url": "http://nolog.cz/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"targets": [
|
||||||
|
"cyberladies.cz"
|
||||||
|
],
|
||||||
|
"labels": {
|
||||||
|
"check_url": "https://www.cyberladies.cz/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
Loading…
Add table
Reference in a new issue