this post was submitted on 30 Jul 2023
17 points (87.0% liked)

Selfhosted

40246 readers
799 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I currently use Grafana to view how all sorts of stuff changes over time. It gets the job done, but is far from ideal:

  • edititng the data queries is intended to only be done in the web ui (so I end up just copypasting stuff to/from pycharm to at least have a nice text editor)
  • can't store config in a git repo (yes, I can dump & restore the config as a huge json, but AFAIK the json structure is considered an internal api, so it can change at any time making versioning useless)
  • all plot parameters other than the data query have to be configured via gui

I did try grafanalib some time ago and it didn't feel right. It was quite behind in plot types (Grafana screamed at me "don't use this plot type, use the new one instead"), and is using unofficial api (the json config again).

Any suggestions? It doesn't even have to be a ready-to-use tool, a library/framework for making dashboards will also do.

top 12 comments
sorted by: hot top controversial new old
[–] nitrolife@rekabu.ru 4 points 1 year ago (1 children)
[–] equidamoid@lemmy.world 3 points 1 year ago* (last edited 1 year ago) (1 children)

To be precise, the page explains how to configure some things and how to upload the config. I also tried that.

The problem is in the dashboard jsons. They are not well documented (docs on specific plots are missing), and are a pain to edit (as any json). The grafanalib tool I mentioned tries to help with that by implementing a sort of DSL for dashboards, but it is not ideal. (edit: lost a word)

[–] nitrolife@rekabu.ru 1 points 1 year ago (1 children)

You can create graph on the UI and then export to json. To be honest, it's hard for me to imagine a situation where graphs need to be edited so often. After all, there are excellent template engines in Grafana itself. For quick look anyone can use Explore panel. Maybe I don't have so much data...

[–] equidamoid@lemmy.world 2 points 1 year ago

create graph on the UI

that's something I want to avoid

hard for me to imagine a situation where graphs need to be edited so often

the whole system is under development (trying new views, changing how the data is represented, etc), so I don't need to imagine it, I have it right in front of me ;)

[–] popcorp@discuss.tchncs.de 3 points 1 year ago (1 children)

I use grafanalib. I have a script that generates the dashboards depending on given parameters, then I store generated JSON as a k8s configmap that's mounted into the directory that's checked by grafana on startup. Might not be everyone's cup of tea but it is good enough for me.

[–] equidamoid@lemmy.world 1 points 1 year ago (1 children)

Did you ever notice that grafanalib is noticeable behind grafana itself? That's something that turned me off it, but I wonder if it was a one-time situation because of some major change in grafana...

[–] popcorp@discuss.tchncs.de 1 points 1 year ago

I think you've just used a deprecated widget. I didn't notice any incompatibility, maybe there's some for beta widgets but otherwise all features I needed were there.

[–] scrchngwsl@feddit.uk 2 points 1 year ago (1 children)

Shiny is pretty good. You can do interactive sliders to filter date ranges in that, and you control what happens when you slide it in the code. It's not as slick as grafana though.

One downside is it started off as an R package then got ported to python, so most resources are for R. Fine for me because I know R, but most people don't.

Here's the python link: https://shiny.rstudio.com/py/

[–] equidamoid@lemmy.world 1 points 1 year ago

This might be actually it (or at least one of the "competitor" projects they mention in the docs), thanks! Just need to figure out how to do a nice grid layout of the graphs.

I know R a liiiitle bit, so that may help too =)

[–] arjache@kbin.social 2 points 1 year ago

It still has the limitations of JSON churn, but I find jsonnet to be a nice functional-style DSL in which to write grafana dashboards.

[–] yesbutnobutyesbutno@sh.itjust.works 1 points 1 year ago (1 children)

Depending on what you’re comfortable with (and whether you want to integrate it with something else), maybe take a look at Altair? Especially nice is the declarative syntax of Vega-Altair.

[–] equidamoid@lemmy.world 2 points 1 year ago* (last edited 1 year ago)

Something like that, where I just write a function that spits out a numpy array or something like that and it gets plotted, would be great, but there is one thing Grafana can do and vega-altair, plotly and even matplotlib (*): a UI that allows to select a time interval to view.

So I can freely pan/zoom in/out in time, and only the required part of the data will be loaded (with something like select ... where time between X and Y under the hood). So if I look at a single day, it will only load that day, and only if I dare to zoom out too much it will spend some time loading everything from the last year.

(*) yes, you can do interactive things with matplotlib, but you don't really want to, unless you must...