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

Pihole exporter cannot handle pihole running behind reverse proxy over without /admin #114

Open
sanfx opened this issue Jan 23, 2022 · 1 comment

Comments

@sanfx
Copy link

sanfx commented Jan 23, 2022

I have pihole running on my https://pihole.domain.com
but if we pass args to pihole exporter it translate URL to the one cotnaining /admin i.e. https://pihole.domain.com/admin/api.php
see example:

# docker exec -it 2db7 ./pihole-exporter -port 9618 -pihole_hostname pihole.domain.com -pihole_api_token e30e161a388be00d32fs41f2b753d3691785ecc1dbf9bc8ef291bs30f4f18b75 -pihole_protocol https -pihole_port 443

results in :


2022/01/23 06:28:05 ------------------------------------
2022/01/23 06:28:05 -  PI-Hole exporter configuration  -
2022/01/23 06:28:05 ------------------------------------
2022/01/23 06:28:05 PIHoleProtocol : https
2022/01/23 06:28:05 PIHoleHostname : pihole.domain.com
2022/01/23 06:28:05 PIHolePort : 443
2022/01/23 06:28:05 Pi-Hole Authentication Method : PIHoleApiToken
2022/01/23 06:28:05 Port : 9618
2022/01/23 06:28:05 Interval : 10s
2022/01/23 06:28:05 ------------------------------------
2022/01/23 06:28:05 New Prometheus metric registered: domains_blocked
2022/01/23 06:28:05 New Prometheus metric registered: dns_queries_today
2022/01/23 06:28:05 New Prometheus metric registered: ads_blocked_today
2022/01/23 06:28:05 New Prometheus metric registered: ads_percentag_today
2022/01/23 06:28:05 New Prometheus metric registered: unique_domains
2022/01/23 06:28:05 New Prometheus metric registered: queries_forwarded
2022/01/23 06:28:05 New Prometheus metric registered: queries_cached
2022/01/23 06:28:05 New Prometheus metric registered: clients_ever_seen
2022/01/23 06:28:05 New Prometheus metric registered: unique_clients
2022/01/23 06:28:05 New Prometheus metric registered: dns_queries_all_types
2022/01/23 06:28:05 New Prometheus metric registered: reply
2022/01/23 06:28:05 New Prometheus metric registered: top_queries
2022/01/23 06:28:05 New Prometheus metric registered: top_ads
2022/01/23 06:28:05 New Prometheus metric registered: top_sources
2022/01/23 06:28:05 New Prometheus metric registered: forward_destinations
2022/01/23 06:28:05 New Prometheus metric registered: querytypes
2022/01/23 06:28:05 New Prometheus metric registered: status
2022/01/23 06:28:05 Starting HTTP server
2022/01/23 06:28:15 An error has occured during retrieving PI-Hole statistics Get "https://pihole.domain.com:443/admin/api.php?summaryRaw&overTimeData&topItems&recentItems&getQueryTypes&getForwardDestinations&getQuerySources&jsonForceObject&auth=e30e161a388be00d32f341f2b753d3691785ecc1dbf9bc8ef291b130f4f18b75": x509: certificate signed by unknown authority
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x8158aa]

goroutine 25 [running]:
github.com/eko/pihole-exporter/internal/pihole.(*Client).getStatistics(0xc0001203f0, 0xc000038790)
	/go/src/github.com/eko/pihole-exporter/internal/pihole/client.go:163 +0x2ea
github.com/eko/pihole-exporter/internal/pihole.(*Client).Scrape(0xc0001203f0)
	/go/src/github.com/eko/pihole-exporter/internal/pihole/client.go:61 +0x88
created by main.initPiHoleClient
	/go/src/github.com/eko/pihole-exporter/main.go:37 +0xc5

Notice the URL has /admin . if I remove the /admin the pihole API URL gives result.

@Auxtal
Copy link

Auxtal commented Oct 3, 2023

Any updates on this?

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

2 participants