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 returned for few of the metrics #75

Closed
limpep opened this issue Feb 13, 2021 · 5 comments
Closed

No data returned for few of the metrics #75

limpep opened this issue Feb 13, 2021 · 5 comments

Comments

@limpep
Copy link

limpep commented Feb 13, 2021

Hi @eko

I am not getting any data for the following metrics nor is it returns in Prometheus,

pihole_top_queries
pihole_top_ads
pihole_top_queries
pihole_top_ads
pihole_forward_destinations

Other seems to work fine.

I am using docker-compose to run the container. The image I have built using the latest code from the repo.

 version: "3"
 services:

    pi-hole-exporter:
      image: pihole-export
      environment:
       - PUID=1000
       - PGID=1000
       - PIHOLE_HOSTNAME=192.168.1.77
       - PIHOLE_API_TOKEN="MY_AWESOME_TOKEN"
       - INTERVAL=30s
       - PORT=9617
      logging:
        driver: "json-file"
        options:
         max-size: 10m
         max-file: "3"
         labels: "pihole-exporter"
      ports:
        - "9617:9617"
      restart: unless-stopped

I am using a raspberry 4 to run the exporter.

  `.::///+:/-.        --///+//-:``    pi@raspberrypi
 `+oooooooooooo:   `+oooooooooooo:    --------------
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 10 (buster) armv7l
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 4 Model B Rev 1.4
   `:oooooooo+``    `.oooooooo+-      Kernel: 5.10.11-v7l+
     `:++ooo/.        :+ooo+/.`       Uptime: 19 hours, 50 mins
        ...`  `.----.` ``..           Packages: 1888 (dpkg)
     .::::-``:::::::::.`-:::-`        Shell: bash 5.0.3
    -:::-`   .:::::::-`  `-:::-       Terminal: /dev/pts/1
   `::.  `.--.`  `` `.---.``.::`      CPU: BCM2711 (4) @ 1.500GHz
       .::::::::`  -::::::::` `       Memory: 1368MiB / 7874MiB
 .::` .:::::::::- `::::::::::``::.
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`

here is my docker version

Client: Docker Engine - Community
 Version:           20.10.3
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        48d30b5
 Built:             Fri Jan 29 14:33:57 2021
 OS/Arch:           linux/arm
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.3
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       46229ca
  Built:            Fri Jan 29 14:31:57 2021
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
@vonglasow
Copy link

You need to feel the password of your pi-hole interface on the command for example

[Unit]
Description=pihole_exporter

[Service]
ExecStart=/opt/pihole_exporter/pihole_exporter-linux-arm -pihole_password "piholeadminpassword"
WorkingDirectory=/opt/pihole_exporter
Restart=always
User=pihole_exporter

[Install]
WantedBy=multi-user.target

Don't forget to install the plugin grafana for pie chart.

@limpep
Copy link
Author

limpep commented Mar 12, 2021

@vonglasow i am using docker, not using a standalone service so i dont have a unit file. Also within my docker-compose.yml i am sending in the password with no luck.

@limpep
Copy link
Author

limpep commented Mar 12, 2021

I have resolved the issue, don't use quotes

should be without double quotes

PIHOLE_API_TOKEN=MY_AWESOME_TOKEN

@limpep limpep closed this as completed Mar 12, 2021
@JoeDat
Copy link

JoeDat commented Mar 19, 2021

For others stumbling on this and not using docker....

The exporter will still start, but will not run with the access needed to pull this additional data unless you properly pass the token. I'm sure this is clearly documented somewhere obvious and I just overlooked.

Start-up logging without a properly read-in token

Feb 21 14:01:10 pi.hole systemd[1]: Started PiHole-Prometheus-Exporter.
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 ------------------------------------
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 - PI-Hole exporter configuration -
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 ------------------------------------
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 PIHoleProtocol : myawesomeprotocol
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 PIHoleHostname : myawesomehostname
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 PIHolePort : myawesomeport
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 Port : myawesomeexporterport
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 Interval : 10s
Feb 21 14:01:12 pi.hole pihole_exporter[782]: 2021/02/21 14:01:12 ------------------------------------

Start-up with a token (notice the Pi-Hole Authentication Method line)

Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 ------------------------------------
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 - PI-Hole exporter configuration -
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 ------------------------------------
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 PIHoleProtocol : myawesomeprotocol
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 PIHoleHostname : myawesomehostname
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 PIHolePort : myawesomeport
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 Pi-Hole Authentication Method : PIHoleApiToken
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 Port : myawesomeexporterport
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 Interval : 10s
Mar 19 10:21:25 pi.hole pihole_exporter[3369]: 2021/03/19 10:21:25 ------------------------------------

I was using systemd to start my service, and never realized it was ignoring my API token. For reasons I can't figure out, systemd will only read my token if it's the first parameter in ExecStart. It works this way, so I don't really care why lol

ExecStart=/home/pihole/pihole_exporter -pihole_api_token mytoken -pihole_hostname mypiholehostname

@johnynfulleffect
Copy link

johnynfulleffect commented Dec 17, 2021

I have resolved the issue, don't use quotes

should be without double quotes

PIHOLE_API_TOKEN=MY_AWESOME_TOKEN

Thank you for this.

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.

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

4 participants