From 101a598f6f615f58bc77443afe1d6d92fa0d6c27 Mon Sep 17 00:00:00 2001
From: DerGrumpf
Date: Sat, 16 Nov 2024 22:26:23 +0100
Subject: [PATCH] Added prometheus with scrape options
---
fallback/config/unifiedmetrics/config.yml | 14 ++++++++++++++
.../unifiedmetrics/driver/prometheus.yml | 16 ++++++++++++++++
fallback/mods.txt | 3 +--
monitoring/compose.yml | 0
monitoring/grafana/compose.yml | 0
monitoring/prometheus/.gitignore | 0
monitoring/prometheus/compose.yml | 7 +++++++
monitoring/prometheus/prometheus.yml | 19 +++++++++++++++++++
proxy/compose.yml | 2 +-
9 files changed, 58 insertions(+), 3 deletions(-)
create mode 100644 fallback/config/unifiedmetrics/config.yml
create mode 100644 fallback/config/unifiedmetrics/driver/prometheus.yml
create mode 100644 monitoring/compose.yml
create mode 100644 monitoring/grafana/compose.yml
create mode 100644 monitoring/prometheus/.gitignore
create mode 100644 monitoring/prometheus/compose.yml
create mode 100644 monitoring/prometheus/prometheus.yml
diff --git a/fallback/config/unifiedmetrics/config.yml b/fallback/config/unifiedmetrics/config.yml
new file mode 100644
index 0000000..afdc9e5
--- /dev/null
+++ b/fallback/config/unifiedmetrics/config.yml
@@ -0,0 +1,14 @@
+server:
+ name: "global"
+metrics:
+ enabled: true
+ driver: "prometheus"
+ collectors:
+ systemGc: true
+ systemMemory: true
+ systemProcess: true
+ systemThread: true
+ server: true
+ world: true
+ tick: true
+ events: true
\ No newline at end of file
diff --git a/fallback/config/unifiedmetrics/driver/prometheus.yml b/fallback/config/unifiedmetrics/driver/prometheus.yml
new file mode 100644
index 0000000..89308c0
--- /dev/null
+++ b/fallback/config/unifiedmetrics/driver/prometheus.yml
@@ -0,0 +1,16 @@
+mode: "HTTP"
+http:
+ host: "0.0.0.0"
+ port: 9100
+ authentication:
+ scheme: "NONE"
+ username: "username"
+ password: "password"
+pushGateway:
+ job: "unifiedmetrics"
+ url: "http://pushgateway:9091"
+ authentication:
+ scheme: "NONE"
+ username: "username"
+ password: "password"
+ interval: 10
\ No newline at end of file
diff --git a/fallback/mods.txt b/fallback/mods.txt
index 614d4b5..8a13540 100644
--- a/fallback/mods.txt
+++ b/fallback/mods.txt
@@ -11,8 +11,7 @@ https://cdn.modrinth.com/data/LFJf0Klb/versions/7e8Rxgsk/ce-2.1.1.jar
https://cdn.modrinth.com/data/8dI2tmqs/versions/AQhF7kvw/FabricProxy-Lite-2.9.0.jar
# Monitoring
-https://cdn.modrinth.com/data/dbVXHSlv/versions/YcE9H1C5/fabricexporter-1.0.11.jar
-https://cdn.modrinth.com/data/l6YH9Als/versions/qTSaozEL/spark-1.10.97-fabric.jar
+https://cdn.modrinth.com/data/p1ewR5kV/versions/xwRVtqbA/unifiedmetrics-platform-fabric-0.3.8.jar
# World Edit
https://cdn.modrinth.com/data/1u6JkXh5/versions/vBzkrSYP/worldedit-mod-7.3.6.jar
diff --git a/monitoring/compose.yml b/monitoring/compose.yml
new file mode 100644
index 0000000..e69de29
diff --git a/monitoring/grafana/compose.yml b/monitoring/grafana/compose.yml
new file mode 100644
index 0000000..e69de29
diff --git a/monitoring/prometheus/.gitignore b/monitoring/prometheus/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/monitoring/prometheus/compose.yml b/monitoring/prometheus/compose.yml
new file mode 100644
index 0000000..2c3ede7
--- /dev/null
+++ b/monitoring/prometheus/compose.yml
@@ -0,0 +1,7 @@
+services:
+ prometheus:
+ image: prom/prometheus
+ volumes:
+ - ./prometheus.yml:/etc/prometheus/prometheus.yml
+ ports:
+ - 9090:9090
diff --git a/monitoring/prometheus/prometheus.yml b/monitoring/prometheus/prometheus.yml
new file mode 100644
index 0000000..6c315bd
--- /dev/null
+++ b/monitoring/prometheus/prometheus.yml
@@ -0,0 +1,19 @@
+global:
+ scrape_interval: 10s
+
+scrape_configs:
+ # This instance scraper
+ - job_name: 'prometheus'
+ static_configs:
+ - targets:
+ - prometheus:9090
+
+ # Server Scrapers
+ - job_name: 'mc-server'
+ static_configs:
+ - targets: ['localhost:9100']
+ labels:
+ instance: 'Fallback'
+ - targets: ['100.80.35.55:9100']
+ labels:
+ instance: 'Main'
diff --git a/proxy/compose.yml b/proxy/compose.yml
index 2be4afe..65cdbd0 100644
--- a/proxy/compose.yml
+++ b/proxy/compose.yml
@@ -14,7 +14,7 @@ services:
- ./velocity.toml:/config/velocity.toml:ro
- ./forwarding.secret:/config/forwarding.secret:ro
- ./unifiedmetrics:/plugins/unifiedmetrics
- - ./server:/server
+ - proxy:/server
ports:
- 25565:25565