Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No data in Grafana / Follow up your advise #32

Closed
JeromeX opened this issue Mar 16, 2020 · 35 comments
Closed

No data in Grafana / Follow up your advise #32

JeromeX opened this issue Mar 16, 2020 · 35 comments

Comments

@JeromeX
Copy link

JeromeX commented Mar 16, 2020

I just installed on my Pi4 pihole as usal, installed prometheus as well go and going through your readme. Everything is running, but there is no way to see data in grafana. Can you help me? What do i need configure on grafana site? What's wrong, what must i check?

Bildschirmfoto 2020-03-16 um 18 02 01
Bildschirmfoto 2020-03-16 um 18 04 11

@clintcolding
Copy link

Have you added a scrape job to the prometheus.yml? Something like:

- job_name: pihole
  honor_timestamps: true
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - pihole-exporter.mydomain.com

If so, on the targets page of Prometheus, is the endpoint marked as up?

@JeromeX
Copy link
Author

JeromeX commented Mar 16, 2020

Have you added a scrape job to the prometheus.yml? Something like:

- job_name: pihole
  honor_timestamps: true
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets:
    - pihole-exporter.mydomain.com

i filled up, like on instruction page, but no success. If you have experience in this can i invite you for a remote help or something else? it might be very useful to know it must be configured step by step. Any help is preciated.

@shaned24
Copy link
Contributor

shaned24 commented Apr 6, 2020

@JeromeX Do you have your prometheus server running on the same machine as the pi-hole-exporter?

if this is the case then you need to set your domain to localhost and don't forget the port 9617

- job_name: pihole
  honor_timestamps: true
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets: ["localhost:9617"]

@rth9
Copy link

rth9 commented Apr 13, 2020

Probably the same issue:
#28

@JeromeX
Copy link
Author

JeromeX commented Apr 13, 2020

Finally it's working - Yes :-)
One more question to all freaks out there... How do i run automaticlly "pihole-exporter HTTP server" with command: ./pihole_exporter -pihole_hostname 192.168.178.2 -pihole_password blablabla in the background, to work with ssh on terminal? Please send me a quickfix. Many thanks folks!

grafik
grafik

@rth9
Copy link

rth9 commented Apr 14, 2020

I mostly followed this:
https://www.observability.blog/monitoring-pi-hole-with-prometheus/
If you did everything else, then you need to make the service and start it.
sudo nano /lib/systemd/system/pihole_exporter.service
Put in this, with the appropriate paths and user:

[Unit]
Description=pihole_exporter

[Service]
ExecStart=/opt/pihole_exporter/pihole_exporter-linux-amd64
WorkingDirectory=/opt/pihole_exporter
Restart=always
User=pihole_exporter

[Install]
WantedBy=multi-user.target

And then these commands to enable it to automatically start on boot and to start it now, without having to wait for a reboot:

sudo systemctl daemon-reload
sudo systemctl start pihole_exporter
sudo systemctl enable pihole_exporter

@JeromeX
Copy link
Author

JeromeX commented Apr 14, 2020

Mission completed, many thanks 💯 , just forgot to create the service : Works perfectly on my Raspberry Pi 4.
Last question: Can anyone tell my if is possible to add the "Query Log" into dashboard?
Right now my dashboard looks like this, it's a mix with Prometheus and Influx. Thanks JX!

grafik

grafik

@rth9
Copy link

rth9 commented Apr 14, 2020

To do a query? Or do just see the 'up to 100 queries'? Depending on your network, you will never really see anything with the number of DNS requests that are made at any given time. Plus the dashboard isn't 'live' data, like constant, scrolling DNS requests.

You could edit the dashboard, and a a link to http://pi-hole-ip-or-address/admin/queries.php to get to the page.

Maybe make a feature request because it's not one of the data points (metrics registered) that the pihole_exporter handles.

@JonAnder83
Copy link

JonAnder83 commented May 4, 2020

I see a couple of issues while deploying mine.
First, I had to modify the systemd unit and add
ExecStart=/opt/pihole_exporter/pihole_exporter-linux-amd64 -pihole_hostname 192.168.20.254 -pihole_password xxxxxxxxxxx

Then, the dashboard import json from grafana web is different than the one here, in GitHub. While this one lets me select Prometheus as the data source, I still get no data on my dashboard.
Any help?
Sorry for piggybacking on this post but I didn't see it fit to open yet another thread with the same issue.
Thanks!

@TehloWasTaken
Copy link

TehloWasTaken commented May 5, 2020

I'm having a similar issue to you @JonAnder83 however, after adding the rule you had, I got the following:

image

Any idea on how to fix this?
Thanks :)

@rth9
Copy link

rth9 commented May 5, 2020

@JonAnder83 did you edit each graph to be Prometheus?

@OfficialTehlo what hardware are you running? On a Pi itself? In a VM? Make sure the pihole_exporter is for your hardware. Did you follow the steps in the observability.blog link above with creating the user, etc.? The ExecStart line needs to be customised for your environment with the right executable, the right host, and the right password.

@TehloWasTaken
Copy link

Hi @rth9 yes I have, because when I run the command by itself, then I get the following:

image

So on its own it's working fine, but in a systemd it isn't.

@rth9
Copy link

rth9 commented May 5, 2020

You are using the exact same command to start it manually as you put in the ExecStart line? Issue #26 shows the same error?

@JonAnder83
Copy link

@JonAnder83 did you edit each graph to be Prometheus?

Nope. Funny thing: If you have multiple data sources (i.e. influxdb and prometheus) and set prometheus as the default data source, the import just works out of the box.
If other data source, i.e.: grafana is your main data source while importing, you will have to re-select data source editing all the elements of the dashboard and then, format them appropriately.

Thanks though!

@TehloWasTaken
Copy link

@rth9 Yep, same command but still have the same issue. Any idea?

@91ajames
Copy link

91ajames commented Sep 4, 2020

Tried this once before and even today getting back to it, I'm still lost on how to make it show up in the graph.
Tried a few things which still didn't work and then all of a sudden, it works but not the way it should work.
Just banjo green graphs and statistics that doesn't mean anything.

Using Docker-Compose in case anyone is wondering.
p 9617 in web view, 404 page not found

I have it working on Prometheus,

Tried using ./pihole_exporter -pihole_hostname 192.168.178.2 -pihole_password blablabla
but no idea where' im placing that cmd in.
Unless its the same as this here... @TehloWasTaken #32 (comment)

Can't bash into Ekofr-Pi-Hole

pihole-export

@rth9
Copy link

rth9 commented Sep 4, 2020

If this works (make sure to change path to your executable and if it's not AMD64), I put single quote around my password:
/opt/pihole_exporter/pihole_exporter-linux-amd64 -pihole_hostname IP_ADDRESS -pihole_password 'PASSWORD'

Then you can do the following should work to get it as a service.

File path/name:
/lib/systemd/system/pihole_exporter.service

I prefer nano, so:
sudo nano /lib/systemd/system/pihole_exporter.service

And put in these contents (mine is AMD64, your file may be different architecture or location), it requires that you created the "pihole_exporter" user account manually.:

[Unit]
Description=pihole_exporter

[Service]
ExecStart=/opt/pihole_exporter/pihole_exporter-linux-amd64 -pihole_hostname IP_ADDRESS -pihole_password 'PASSWORD'
WorkingDirectory=/opt/pihole_exporter
Restart=always
User=pihole_exporter

[Install]
WantedBy=multi-user.target

Command to enable it as a service and auto-start on boot:
sudo systemctl enable pihole_exporter

You can then start it with this if you don't want to reboot:
sudo systemctl start pihole_exporter

Looking at the status of the service or using journalctl should show essentially the same output as running the command manually. Don't run the command manually when the service is started.

@91ajames
Copy link

91ajames commented Sep 4, 2020

Actually, somehow when i looked into it on where the graph was coming from. it was from Grafana itself and not from the Prometheus.
pihole-export

  • docker compose/ armfh

@rth9
Copy link

rth9 commented Sep 4, 2020

So you are using the ARM binary? Where my example above has amd64, you have replaced the commands to point to the arm binary? Your screenshot has a tick beside Prometheus, not Grafana, are you sure it's looking at the wrong place? I ran into a problem where my default was InfluxDB, I added Prometheus after, but had to update my dashboard to point to Prometheus instead of InfluxDB. Are you saying your default datasource was Grafana instead of InfluxDB or Prometheus?

@91ajames
Copy link

91ajames commented Sep 4, 2020

I had just recently added InfluxDB to try it out which im not getting much out of it.
the 1st pic was under default. Not sure how it got bumped there so i had put it back to Prometheus which resulted no graph.
I'de assumed default was grafana itself resulted the green graph pic.

this is where im at. Tottaly ignoring InfluxDB
pihole-export

@rth9
Copy link

rth9 commented Sep 4, 2020

So you have data. I ended up going to edit the dashboard, not each graph, then JSON Model, copy and paste out, find and replace where it said "datasource": "default", and replaced it with "datasource": "Prometheus", and then copied and pasted it back in. That cleared up my graphs showing no or wrong data.

@91ajames
Copy link

91ajames commented Sep 4, 2020

ok. Changed one and looks like it replaced all of them for me except "datasource": null , which I had also replaced.
Nothing so far. unless its 9311 the culprit.
https://pastebin.com/BpjUVzeD

@rth9
Copy link

rth9 commented Sep 4, 2020

Mine is still null and mine is also 9311.

Your dashboard now is filled with graphs with no data? Not odd stuff like with InfluxDB or Grafana previously?

Edit:
I can select a node, above the green square and below the title, you don't see this?

@91ajames
Copy link

91ajames commented Sep 4, 2020

Its just blank.
https://streamable.com/cfdd89

Which node?

edit..perhaps i should just give up on it. nice feature to look at.

@lkshck
Copy link

lkshck commented Sep 5, 2020

@JeromeX Do you have your prometheus server running on the same machine as the pi-hole-exporter?

if this is the case then you need to set your domain to localhost and don't forget the port 9617

- job_name: pihole
  honor_timestamps: true
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets: ["localhost:9617"]

Where can i find the prometheus.yml to update the target?

@JeromeX
Copy link
Author

JeromeX commented Sep 5, 2020 via email

@TehloWasTaken
Copy link

TehloWasTaken commented Sep 5, 2020

Where can i find the prometheus.yml to update the target?

Can find this in /etc/prometheus/prometheus.yml on your typical install.

@lkshck
Copy link

lkshck commented Sep 5, 2020

Where can i find the prometheus.yml to update the target?

Can find this in /etc/prometheus/prometheus.yml on your typical install.

I'm running the exporter as an docker image. So i'm not able to find the yml under this path. Is it somewhere else located in this case?

@91ajames
Copy link

91ajames commented Sep 5, 2020

@lkshck
I had to locate the yml file online since on my end in my docker, it couldn't create it for some reason.
After moving it and restarting it some how created another file I believe but didn't look into it before I had deleted it, oops.
but basically, u need to draw a path from host to path in docker of the oppose file in the container to make adjustments.

@rth9
After moving stuff to host to make sure everything is good, decided to goto the other pihole_exporter-1, part of the field has been inputing graph, the rest blank, took part of the code metrics and paste it into Pi-Hole Exporter and Boom, its there, sucks having to put everything by manual instead of auto set. Metrics are left blank.

piholeaaaaa

Honestly, this could be alot better tho for the default without putting in so much tweaking into it. and the error of % ads blocked "O.toFixed is not a function" when selecting Premethuis
(selected a dupe for Domain being blocked)
piholeaaaaa

@lkshck
Copy link

lkshck commented Sep 7, 2020

Using now the typical installation of Prometheus and target looks ok from my point of view, but still HTTP Error Not Found. Any other ideas? Curl to 127.0.0.1:9617/metrics works fine on Pi.
Bildschirmfoto 2020-09-07 um 20 27 44
Bildschirmfoto 2020-09-07 um 20 28 01

Recognized that URL in grafana http://localhost:9090 is working and dashboard looks like the following. How is this possible? :D
grafik

@TehloWasTaken
Copy link

@lkshck you don't want to add the /metrics to your datasource setup. Just the http://localhost:9090 is enough for it to draw the data out of Prometheus.

@lkshck
Copy link

lkshck commented Sep 7, 2020

@TehloWasTaken did that and i was able to save the datasource and dashboard is showing some data but not all of them. I thought i need to define http://localhost:9617 as i defined this in the prometheus job. Dashboard now looks like the following:
grafik

@TehloWasTaken
Copy link

@lkshck Looks like it's getting there! I'd make sure the missing metrics are in Prometheus, if they are not they will simply not be exported from your PiHole.

Also, holy crap you block a lot of domains. You do know that more != better for PiHole right? 😛

@lkshck
Copy link

lkshck commented Sep 7, 2020

@TehloWasTaken Yes I'm aware of that 😆 didn't found the best list setup for now.

As i'm not that familiar with Prometheus. Any way to check if the is in Prometheus? Like Top queries by domain..

@91ajames
Copy link

91ajames commented Sep 7, 2020

That's funny.
pipipipip

besides the last 2 post between my pic and your pic, we both up to 1787115 @lkshck

@JeromeX JeromeX closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants