cpburnz / minecraft-prometheus-exporter

Prometheus exporter for Minecraft.
MIT License
44 stars 8 forks source link

Issue with Grafana dashboard - Application field empty #16

Open subzero opened 9 months ago

subzero commented 9 months ago

This is not really an issue with your exporter, and just let me know if you can't and/or don't want to help.

I imported the dashboard (ID 16508) and it loads up fine, however the application field is empty, and I'm not sure if it's version differences and/or grafana handling variables different. I've tried changing variables to try and load everything but I can't get it to match up.

Have you or anyone tried to load these recently?

As you can see on the image, it pulls out the dimensions (ATM9), but the application list is empty and my brain is simply fried from trying to figure it out. image

Application variable: image

Instance variable: image

Thanks, and merry christmas!

cpburnz commented 9 months ago

Hi @subzero,

I have my prometheus.yml setup as follows. I have a computer named mc1 at IP 192.168.0.123. I'm running two different Minecraft mod-pack servers. I use the instance label to indicate the computer Minecraft is running on because that's that common practice with Prometheus. I use the application label to indicate each Minecraft mod-pack server.

scrape_configs:

  - job_name: minecraft
    static_configs:
      - targets: ['192.168.0.123:19565']
        labels:
          application: 'Better_Minecraft_v29'
          instance: mc1
      - targets: ['192.168.0.123:19566']
        labels:
          application: '1.0.4.2TekxitPiServer'
          instance: mc1

Then in the Grafana dashboard I have the instance set to "mc1" and switch between "Better_Minecraft_v29" and "1.0.4.2TekxitPiServer".

Hope that helps. Merry Christmas!

MalTeeez commented 9 months ago

@subzero What version of the exporter are you running? Can you post a result from a direct query to your endpoint via browser or curl? (Not grafana)

cpburnz commented 9 months ago

@subzero I notice once difference under your "application" variable. Try setting the "Query > Label *" option to "application".

292923034-b2d2891f-d495-42f8-aed0-eabaa2683047_2

subzero commented 9 months ago

Hello and thank you for your amazing help! I'm very impressed by the support from you guys. Adding application and instance to my prometheus target solved the selectors and as well as the variable pages.

Now I can actually grab data from "something" I can start figuring out why these are still blank and return nothing on my queries, image

histogram_quantile(0.95, sum(rate(mc_server_tick_seconds_bucket{application="$application", instance="$instance"}[$__rate_interval])) by (le))

The fields are showing so I just need to figure out why it isn't grabbing them. image

Exporter is version: 1.20.1-forge-1.0.0 Matrix output: minecraftmetrics.txt

Thanks to both @cpburnz @MalTeeez for your quick support! Unless my above issue isn't something that pops up as a quick resolution from one of you I will close the issue as your help so far has gotten me very far! Thanks so much

cpburnz commented 9 months ago

@subzero Your minecraftmetrics.txt looks normal to me. mc_server_tick_seconds_bucket is in there with valid values.

What version of Prometheus and Grafana are you running? Your settings interface looks a little different from mine. I'm running Prometheus v2.36.2 and Grafana v9.0.2.

Can you try running the query

histogram_quantile(0.95, sum(rate(mc_server_tick_seconds_bucket{application="$application", instance="$instance"}[$__rate_interval])) by (le))

directly from Prometheus? You'll need to replace $application, $instance, and $__rate_interval (I used 5m for 5 minutes). That will be located at http://example.com:9090/graph where example.com is either the domain name or IP address where Prometheus is running. When I run it directly, I get the result: 0.009501759585108354. This is just to prove Prometheus if picking up the data from Minecraft.

subzero commented 9 months ago

Hello again, and thank you!

Prometheus: 2.48.1 Grafana: v10.2.3 The query you gave me also returns me a result. image

Just to confirmed Variables: Application: image Instance: image

Not thinking clearly that the dashboard wasn't built for a major version up I decided to downgrade Grafana to 9.0.2 and it solved the issue! image

Rayvhiz commented 4 months ago

Hi, I had the same problem and downgrading to Grafana 9.x also solved the problem. Thanks @subzero for the tip❤️