henriquesati

henriquesati

Grafana dashboards provide ''NO DATA'' inside container network

I’m running Grafana and Prometheus with PromEx and ,although everything is connecting, the dashboards are not providing any data.

First, my dashboards are being correctly uploadeds to Grafana
[info] PromEx.LifecycleAnnotator successfully created start annotation in Grafana.
[info] PromEx.DashboardUploader successfully uploaded /app/_build/dev/lib/prom_ex/priv/application.json.eex to Grafana.
[info] Running TestespayWeb.Endpoint with Bandit 1.6.1 at 0.0.0.0:4000 (http)
[info] Access TestespayWeb.Endpoint at http://localhost:4000
[debug] hioo
[watch] build finished, watching for changes...
[info] PromEx.DashboardUploader successfully uploaded /app/_build/dev/lib/prom_ex/priv/beam.json.eex to Grafana.
[info] PromEx.DashboardUploader successfully uploaded /app/_build/dev/lib/prom_ex/priv/phoenix.json.eex to Grafana.
[info] PromEx.DashboardUploader successfully uploaded /app/_build/dev/lib/prom_ex/priv/ecto.json.eex to Grafana.

and Prometheus is correcly scraping my

both containers are inside the same network “elixir_network”


  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - "3000:3000"
    volumes:
      - grafana_data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=xxx
    networks:
      - elixir_network
    restart: unless-stopped
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    networks:
      - elixir_network
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - "9090:9090"
    restart: unless-stopped

and my network is corretly working, bcs this prometheys.yaml provides the scraping
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.

scrape_configs:
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  - job_name: 'phoenix_app'
    scrape_interval: 5s  # Override the global interval for this job
    static_configs:
      - targets: ['elixir_app:4000']

I have the following promex file
defmodule Testespay.PromEx do

use PromEx, otp_app: :testespay

alias PromEx.Plugins

@impl true
def plugins do
[
# PromEx built in plugins
Plugins.Application,
Plugins.Beam,
{Plugins.Phoenix, router: TestespayWeb.Router, endpoint: TestespayWeb.Endpoint},
# Plugins.Ecto,
# Plugins.Oban,
# Plugins.PhoenixLiveView,
# Plugins.Absinthe,
# Plugins.Broadway,

  # Add your own PromEx metrics plugins
  # Testespay.Users.PromExPlugin
]

end

@impl true
def dashboard_assigns do
[
datasource_id: “prom1”,
default_selected_interval: “30s”
]
end

  @impl true
  def dashboards do
    [
      # PromEx built in Grafana dashboards
      {:prom_ex, "application.json"},
      {:prom_ex, "beam.json"},
      {:prom_ex, "phoenix.json"},
      {:prom_ex, "ecto.json"},
      # {:prom_ex, "oban.json"},
      # {:prom_ex, "phoenix_live_view.json"},
      # {:prom_ex, "absinthe.json"},
      # {:prom_ex, "broadway.json"},

      # Add your dashboard definitions here with the format: {:otp_app, "path_in_priv"}
      # {:testespay, "/grafana_dashboards/user_metrics.json"}
    ]
  end
end

I’m also being able to connect my Granana to prometheus using the following URL

connection
http://prometheus:9090

that provides the ouput:

Successfully queried the Prometheus API.

Next, you can start to visualize data by [building a dashboard](http://localhost:3000/dashboard/new-with-ds/aeijentwkye4ga), or by querying data in the [Explore view](http://localhost:3000/explore?left=%7B%22datasource%22:%22prometheus%22,%22context%22:%22explore%22%7D).

I also can query random prometheus metrics using the Grafana dashboards

Any tips of what I must troubleshoot? I have none experience with Observality, and was hoping to have a default implementation while I learn

Marked As Solved

henriquesati

henriquesati

Found out that the problem was: I was providing the wrong data_source_id inside prom_ex.ex file


  def dashboard_assigns do
    [
      datasource_id: "prometheus",
      default_selected_interval: "30s"
    ]
  end

Where Next?

Popular in Questions Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
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
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New

We're in Beta

About us Mission Statement