This commit is contained in:
oliver 2024-10-05 18:20:25 +00:00
commit 65c3839185
6 changed files with 107 additions and 0 deletions

23
Caddyfile Normal file
View File

@ -0,0 +1,23 @@
{
admin :2019
servers :80 {
name static_site
metrics
}
servers :3000 {
name grafana
metrics
}
}
:80 {
root * /path/to/html
file_server
}
:3000 {
reverse_proxy grafana:3000
}

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# Host visability
I would recommend using [this dashboard](https://grafana.com/grafana/dashboards/1860-node-exporter-full/).
Use `docker compose -f node.yml up` on the devices you are monitoring
Use `docker compose up` for the server that's collecting all the logs.

12
compose-node.yml Normal file
View File

@ -0,0 +1,12 @@
services:
# monitor the host
node_exporter:
image: quay.io/prometheus/node-exporter:latest
command:
- '--path.rootfs=/host'
network_mode: host
# uses port 9100
pid: host
restart: unless-stopped
volumes:
- '/:/host:ro'

35
compose-server.yml Normal file
View File

@ -0,0 +1,35 @@
services:
# r-proxy
caddy:
image: caddy:latest
restart: unless-stopped
ports:
- 80:80
- 443:443
- '443:443/udp'
- 3000:3000
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
# metrics collector
prometheus:
image: prom/prometheus:latest
expose:
- 9090
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
depends_on:
- caddy
# log viewer
grafana:
image: grafana/grafana:latest
volumes:
- ./grafana.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
depends_on:
- prometheus

15
grafana.yaml Normal file
View File

@ -0,0 +1,15 @@
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
uid: prometheus
access: proxy
orgId: 1
url: http://prometheus:9090
basicAuth: false
isDefault: true
version: 1
editable: false
jsonData:
httpMethod: GET

15
prometheus.yaml Normal file
View File

@ -0,0 +1,15 @@
global:
scrape_interval: 15s
query_log_file: /etc/prometheus/query.log
scrape_configs:
- job_name: caddy
static_configs:
- targets: ['caddy:2019']
- job_name: node
static_configs:
# put a list of all the nodes you are monitoring
- targets: ['10.0.0.92:9100']
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']