eko / pihole-exporter

A Prometheus exporter for PI-Hole's Raspberry PI ad blocker
MIT License
924 stars 106 forks source link

Missing export values key #97

Open Lsm-CVX opened 3 years ago

Lsm-CVX commented 3 years ago

The software is working fine (export to prometheus valid) however I am missing some export values

pihole_top_queries pihole_querytypes pihole_top_ads pihole_forward_destinations

Steps for Reproduction

  1. Set up the following the guideline
  2. Launch binary with the systemd

Logs :

Sep 25 16:03:15 Pihole-slave systemd[1]: Started Create the prometheus exporter node for the PiHole. Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 ------------------------------------ Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 - PI-Hole exporter configuration - Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 ------------------------------------ Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 PIHoleProtocol : http Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 PIHoleHostname : 10.0.0.25 Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 PIHolePort : 80 Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 Pi-Hole Authentication Method : PIHolePassword Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 Port : 9617 Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 Interval : 10s Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 ------------------------------------ Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: domains_blocked Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: dns_queries_today Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: ads_blocked_today Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: ads_percentag_today Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: unique_domains Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: queries_forwarded Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: queries_cached Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: clients_ever_seen Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: unique_clients Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: dns_queries_all_types Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: reply Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: top_queries Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: top_ads Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: top_sources Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: forward_destinations Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 New Prometheus metric registered: querytypes Sep 25 16:03:15 Pihole-slave pihole_exporter-linux-amd64[236531]: 2021/09/25 16:03:15 Starting HTTP server

Expected behavior:

Seem okay.

Actual behavior:

Here is the extract of the Pihole exporter scrape :

HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.

TYPE go_gc_duration_seconds summary

go_gc_duration_seconds{quantile="0"} 2.234e-05 go_gc_duration_seconds{quantile="0.25"} 3.428e-05 go_gc_duration_seconds{quantile="0.5"} 3.585e-05 go_gc_duration_seconds{quantile="0.75"} 3.6639e-05 go_gc_duration_seconds{quantile="1"} 4.1483e-05 go_gc_duration_seconds_sum 0.000632492 go_gc_duration_seconds_count 18

HELP go_goroutines Number of goroutines that currently exist.

TYPE go_goroutines gauge

go_goroutines 473

HELP go_info Information about the Go environment.

TYPE go_info gauge

go_info{version="go1.15.6"} 1

HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.

TYPE go_memstats_alloc_bytes gauge

go_memstats_alloc_bytes 4.9018e+06

HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.

TYPE go_memstats_alloc_bytes_total counter

go_memstats_alloc_bytes_total 3.4079832e+07

HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.

TYPE go_memstats_buck_hash_sys_bytes gauge

go_memstats_buck_hash_sys_bytes 1.452388e+06

HELP go_memstats_frees_total Total number of frees.

TYPE go_memstats_frees_total counter

go_memstats_frees_total 201192

HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.

TYPE go_memstats_gc_cpu_fraction gauge

go_memstats_gc_cpu_fraction 2.8238066406341265e-06

HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.

TYPE go_memstats_gc_sys_bytes gauge

go_memstats_gc_sys_bytes 5.00388e+06

HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.

TYPE go_memstats_heap_alloc_bytes gauge

go_memstats_heap_alloc_bytes 4.9018e+06

HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.

TYPE go_memstats_heap_idle_bytes gauge

go_memstats_heap_idle_bytes 5.926912e+07

HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.

TYPE go_memstats_heap_inuse_bytes gauge

go_memstats_heap_inuse_bytes 5.513216e+06

HELP go_memstats_heap_objects Number of allocated objects.

TYPE go_memstats_heap_objects gauge

go_memstats_heap_objects 16614

HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.

TYPE go_memstats_heap_released_bytes gauge

go_memstats_heap_released_bytes 5.8720256e+07

HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.

TYPE go_memstats_heap_sys_bytes gauge

go_memstats_heap_sys_bytes 6.4782336e+07

HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.

TYPE go_memstats_last_gc_time_seconds gauge

go_memstats_last_gc_time_seconds 1.6325875952974155e+09

HELP go_memstats_lookups_total Total number of pointer lookups.

TYPE go_memstats_lookups_total counter

go_memstats_lookups_total 0

HELP go_memstats_mallocs_total Total number of mallocs.

TYPE go_memstats_mallocs_total counter

go_memstats_mallocs_total 217806

HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.

TYPE go_memstats_mcache_inuse_bytes gauge

go_memstats_mcache_inuse_bytes 1736

HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.

TYPE go_memstats_mcache_sys_bytes gauge

go_memstats_mcache_sys_bytes 16384

HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.

TYPE go_memstats_mspan_inuse_bytes gauge

go_memstats_mspan_inuse_bytes 85952

HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.

TYPE go_memstats_mspan_sys_bytes gauge

go_memstats_mspan_sys_bytes 98304

HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.

TYPE go_memstats_next_gc_bytes gauge

go_memstats_next_gc_bytes 7.985456e+06

HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.

TYPE go_memstats_other_sys_bytes gauge

go_memstats_other_sys_bytes 589876

HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.

TYPE go_memstats_stack_inuse_bytes gauge

go_memstats_stack_inuse_bytes 2.326528e+06

HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.

TYPE go_memstats_stack_sys_bytes gauge

go_memstats_stack_sys_bytes 2.326528e+06

HELP go_memstats_sys_bytes Number of bytes obtained from system.

TYPE go_memstats_sys_bytes gauge

go_memstats_sys_bytes 7.4269696e+07

HELP go_threads Number of OS threads created.

TYPE go_threads gauge

go_threads 8

HELP pihole_ads_blocked_today This represent the number of ads blocked over the current day

TYPE pihole_ads_blocked_today gauge

pihole_ads_blocked_today{hostname="10.0.0.25"} 35987

HELP pihole_ads_percentage_today This represent the percentage of ads blocked over the current day

TYPE pihole_ads_percentage_today gauge

pihole_ads_percentage_today{hostname="10.0.0.25"} 47.438076

HELP pihole_clients_ever_seen This represent the number of clients ever seen

TYPE pihole_clients_ever_seen gauge

pihole_clients_ever_seen{hostname="10.0.0.25"} 95

HELP pihole_dns_queries_all_types This represent the number of DNS queries made for all types

TYPE pihole_dns_queries_all_types gauge

pihole_dns_queries_all_types{hostname="10.0.0.25"} 75861

HELP pihole_dns_queries_today This represent the number of DNS queries made over the current day

TYPE pihole_dns_queries_today gauge

pihole_dns_queries_today{hostname="10.0.0.25"} 75861

HELP pihole_domains_being_blocked This represent the number of domains being blocked

TYPE pihole_domains_being_blocked gauge

pihole_domains_being_blocked{hostname="10.0.0.25"} 366134

HELP pihole_queries_cached This represent the number of queries cached

TYPE pihole_queries_cached gauge

pihole_queries_cached{hostname="10.0.0.25"} 6932

HELP pihole_queries_forwarded This represent the number of queries forwarded

TYPE pihole_queries_forwarded gauge

pihole_queries_forwarded{hostname="10.0.0.25"} 32932

HELP pihole_reply This represent the number of replies made for all types

TYPE pihole_reply gauge

pihole_reply{hostname="10.0.0.25",type="cname"} 12866 pihole_reply{hostname="10.0.0.25",type="ip"} 51003 pihole_reply{hostname="10.0.0.25",type="no_data"} 3551 pihole_reply{hostname="10.0.0.25",type="nx_domain"} 5063

HELP pihole_status This if PI-Hole is enabled

TYPE pihole_status gauge

pihole_status{hostname="10.0.0.25"} 1

HELP pihole_unique_clients This represent the number of unique clients seen

TYPE pihole_unique_clients gauge

pihole_unique_clients{hostname="10.0.0.25"} 32

HELP pihole_unique_domains This represent the number of unique domains seen

TYPE pihole_unique_domains gauge

pihole_unique_domains{hostname="10.0.0.25"} 11659

HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.

TYPE process_cpu_seconds_total counter

process_cpu_seconds_total 0.63

HELP process_max_fds Maximum number of open file descriptors.

TYPE process_max_fds gauge

process_max_fds 1024

HELP process_open_fds Number of open file descriptors.

TYPE process_open_fds gauge

process_open_fds 241

HELP process_resident_memory_bytes Resident memory size in bytes.

TYPE process_resident_memory_bytes gauge

process_resident_memory_bytes 1.5601664e+07

HELP process_start_time_seconds Start time of the process since unix epoch in seconds.

TYPE process_start_time_seconds gauge

process_start_time_seconds 1.63258533452e+09

HELP process_virtual_memory_bytes Virtual memory size in bytes.

TYPE process_virtual_memory_bytes gauge

process_virtual_memory_bytes 1.185988608e+09

HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.

TYPE process_virtual_memory_max_bytes gauge

process_virtual_memory_max_bytes -1

HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.

TYPE promhttp_metric_handler_requests_in_flight gauge

promhttp_metric_handler_requests_in_flight 1

HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.

TYPE promhttp_metric_handler_requests_total counter

promhttp_metric_handler_requests_total{code="200"} 157 promhttp_metric_handler_requests_total{code="500"} 0 promhttp_metric_handler_requests_total{code="503"} 0

Missing

Platforms:

Linux ubuntu 20.04

Versions:

https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-amd64 @ today

andonovski commented 3 years ago

I have exact same issue. It was working fine in the past, all metrics were present. I don't know when did it stop working.

andonovski commented 3 years ago

I have exact same issue. It was working fine in the past, all metrics were present. I don't know when did it stop working.

To reply to myself, restarting docker container solved the issue. Actually not container restart, since the container is running using docker-compose, doing docker-compose down && docker-compose up -d solved the issue. Sorry to everyone reading this for not first trying basic troubleshooting.

mungki3 commented 2 years ago

I have exact same issue. It was working fine in the past, all metrics were present. I don't know when did it stop working.

To reply to myself, restarting docker container solved the issue. Actually not container restart, since the container is running using docker-compose, doing docker-compose down && docker-compose up -d solved the issue. Sorry to everyone reading this for not first trying basic troubleshooting.

I've the same exact behaviour, and i tried this, but it didn't solve the issue.

johnynfulleffect commented 2 years ago

Same issue, not running in docker. Running on bare metal using Raspberry Pi OS Bullseye. Missing these metrics:

pihole_top_queries
pihole_querytypes
pihole_top_ads
pihole_forward_destinations
johnynfulleffect commented 2 years ago

@mungki3

I used this helm chart and they have a typo in the PIHOLE_API_TOKEN. It is PIHOLE_APITOKEN in their repo. I submitted this PR to fix this.

Changing it to PIHOLE_API_TOKEN: f0e42... fixed my issue. All metrics show up.

mungki3 commented 2 years ago

@mungki3

I used this helm chart and they have a typo in the PIHOLE_API_TOKEN. It is PIHOLE_APITOKEN in their repo. I submitted this PR to fix this.

Changing it to PIHOLE_API_TOKEN: f0e42... fixed my issue. All metrics show up.

Hey, your comment helped me identify my issue. I realized that i didn't provide either a password or an API token and that's why those metrics were not showing up.

@Lsm-CVX give it a try, perhaps you were also facing the same issue as me?

lisenet commented 2 years ago

@johnynfulleffect you said that you were not running in docker but on bare metal using Raspberry Pi OS Bullseye. How did a helm chart that deploys a docker container help solve the problem on bare metal?

johnynfulleffect commented 2 years ago

@johnynfulleffect you said that you were not running in docker but on bare metal using Raspberry Pi OS Bullseye. How did a helm chart that deploys a docker container help solve the problem on bare metal?

Sorry for the confusion! I meant I was running Pi-Hole on bare metal. I am running this pihole-exporter in k3s using a helm chart.

That setup did not solve my issue, rather, using the correct environment variable did. Make sure you use PIHOLE_API_TOKEN or PIHOLE_PASSWORD. That will authenticate to pihole and allow those missing metrics to be returned.

lisenet commented 2 years ago

@johnynfulleffect thanks for letting me know. Helm won't help in my case because I'm running the pihole-exporter as a systemd service on a Raspberry Pi.

johnynfulleffect commented 2 years ago

@johnynfulleffect thanks for letting me know. Helm won't help in my case because I'm running the pihole-exporter as a systemd service on a Raspberry Pi.

Right. But make sure you have the environment vars set right then.

lisenet commented 2 years ago

@johnynfulleffect what environment variables are you talking about in particular? I run the systemd service that calls the pihole_exporter binary as per documentation:

./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_password azerty
johnynfulleffect commented 2 years ago

@johnynfulleffect what environment variables are you talking about in particular? I run the systemd service that calls the pihole_exporter binary as per documentation:

./pihole_exporter -pihole_hostname 192.168.1.10 -pihole_password azerty

Ok, then something with auth is not working. If you’re not logged in you’re not able to get these metrics. Try with the api key?

lisenet commented 2 years ago

Thanks a lot for your suggestions, truly appreciated. I'll give it a go.