From ce8bd5e352d97505946c1450154d65340d4d3e2b Mon Sep 17 00:00:00 2001 From: DoTheEvo Date: Thu, 16 Mar 2023 02:09:31 +0100 Subject: [PATCH] update --- prometheus_grafana/readme.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/prometheus_grafana/readme.md b/prometheus_grafana/readme.md index 351bda0..9047ea1 100644 --- a/prometheus_grafana/readme.md +++ b/prometheus_grafana/readme.md @@ -296,7 +296,9 @@ Some concept, highlights and examples of PromQL. PromQL returns results as vectors" * [The official](https://prometheus.io/docs/prometheus/latest/querying/basics/) basics page, quite to the point and short +* [Introduction to PromQL](https://blog.knoldus.com/introduction-to-promql/) * [relatively short video to the point](https://youtu.be/yLPTHinHB6Y) +* [Prometheus Cheat Sheet - How to Join Multiple Metrics](https://iximiuz.com/en/posts/prometheus-vector-matching/) * [decent stackoverflow answer](https://stackoverflow.com/questions/68223824/prometheus-instant-vector-vs-range-vector) @@ -839,7 +841,7 @@ What can be seen in this example: **Requirements** - grafana, loki, minecraft. -![logo](https://i.imgur.com/M1k0Dn4.png) +![logo](https://i.imgur.com/VphJTKG.png) ### The Setup @@ -894,8 +896,8 @@ networks: **Promtail's config** is similar to the generic config in the previous section.
-The only addition is a short **pipeline** stage with **regex** that runs against -every log line before sending it to Loki. When matched **a label** `player` +The only addition is a short **pipeline** stage with a **regex** that runs against +every log line before sending it to Loki. When a line matches, **a label** `player` is added to that log line. The value of that label comes from the **named capture group** thats part of that regex, the [syntax](https://www.regular-expressions.info/named.html) @@ -926,11 +928,11 @@ scrape_configs: [Here's regex101](https://regex101.com/r/5vkOU2/1) of it, -with some data to show how it works and bit of explanation. -[Here](https://stackoverflow.com/questions/74937454/how-to-add-custom-labels-in-promtail-config) -is stackoverflow answer that is the source for that config. +with some data to show how it works and bit of explanation.
+[Here's](https://stackoverflow.com/a/74962269/1383369) +the stackoverflow answer that is the source for that config. -![logo](https://i.imgur.com/LuUBZFn.png) +![regex](https://i.imgur.com/bT5XSHn.png) ### First steps in Grafana @@ -942,6 +944,8 @@ This Explore view will be recreated as a dashboard. ### Dashboard minecraft_logs +![dashboard-minecraft](https://i.imgur.com/M1k0Dn4.png) + * New dashboard, new panel * Data source - Loki * Switch from `builder` to `code`
@@ -972,10 +976,15 @@ for grafana loki queries ## Alerts in Grafana for Loki +![alert-labels](https://i.imgur.com/LuUBZFn.png) + When a player joins minecraft server a log appears *"Bastard joined the game"*
Alert will be set to look for string *"joined the game"* and send notification when it occurs. +At this point might be good time to brush up on promQL/logQL and the data types +they return when a query happens. That instant vector and range vector thingie. + ### Create alert rule - **1 Set an alert rule name**