PJUllrich

PJUllrich

Author of Building Table Views with Phoenix LiveView

Connecting prom_ex to grafana.com

I tried to set up a Grafana/Prometheus dashboard with prom_ex and a free account at grafana.com and let me tell you upfront that I’m a total idiot when it comes to these things. So, it might not surprise you that I cannot find out which values to put in the grafana-config of prom_ex even if my life depended on it. I put the following config:

# config.exs
config :my_app, MyApp.PromEx, disabled: true

# prod.exs
config :my_app, MyApp.PromEx,
  disabled: false,
  manual_metrics_start_delay: :no_delay,
  drop_metrics_groups: [],
  grafana: [
    host: System.get_env("GRAFANA_HOST"),
    username: System.get_env("GRAFANA_USER"),
    password: System.get_env("GRAFANA_PASSWORD")
  ],
  metrics_server: :disabled

Now, if I click through the myriad of config sites on https://some-name-some-numbers.grafana.net I find values like this:

URL: https://prometheus-prod-01-eu-west-0.grafana.net/api/prom
User: 1234567 # Some number
Password: my-secret-password # I set a password here

I found these by clicking on the prometheus-SomeNameSomeNumbers-prom data source in the Settings-tab.

I put these env variables, but when I start my server, I get the following logs:

Recieved a 404 from Grafana because: %Finch.Response{body: "404 page not found\n", ...}

So clearly, one of the credentials above is wrong. Could somebody with more brain matter help me out please?

PS: Also, what is the datasource_id I have to set in PromEx? Must it be prometheus-SomeNameSomeNumbers-prom?

Ping @akoutmos

Most Liked

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

Hey Peter!

These are all good questions, and to be honest, it is something that I would love to get some guides around…but alas, limited time :frowning: .

Luckily I use Grafana Cloud, so I know roughly where you are going wrong here :slight_smile:. The Prometheus credentials that you are referring to are used when you are using Prometheus’s remote_write functionality. By default Prometheus will scrape metrics from your /metrics endpoint, but with Grafana cloud, that is not an option. Instead they want you to go down the route of pushing metrics via Grafana Agent (I have an issue for this in PromEx to make it easier for people Add support to bundle GrafanaAgent to push metrics · Issue #44 · akoutmos/prom_ex · GitHub, but I haven’t had a chance to wrap it up). How are you running your app? Is it easy for you to run Grafana Agent along side it?

In addition, you should be making an access token in Grafana (go to your instance’s /org/apikeys route to do so) and using the :auth_token value in PromEx so that PromEx can publish dashboards for you. The :host value should just be the url of your Grafana Cloud instance.

Hopefully that help :slight_smile:

mukhtarkv

mukhtarkv

@akoutmos thank you for your hard work on PromEx library which I am currently using. I wonder is there a charge on Grafana Cloud Dashboard HTTP API calls? I tried to search on the pricing but it is quite vague. I intend to run Elixir application in production with more than 1000 container instances and I am concerned that all 1000 Elixir containers might be incurring dashboard upload api charge.

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

I don’t think Grafana charges you for API calls…but don’t quote me on that lol. If you have that many instances running simultaneously you may want to consider only having a single instance deploying the dashboards. If you can, have your runtime.exs file set upload_dashboards_on_start: false on all instances except for one or something like that.

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement