janeczku / powerdns_exporter

:chart_with_upwards_trend: Prometheus metrics exporter for PowerDNS
Apache License 2.0
37 stars 36 forks source link

SIGSEGV: segmentation violation #14

Open kozicpetar opened 1 year ago

kozicpetar commented 1 year ago

OS version: AlmaLinux release 8.7 (Stone Smilodon)

pdns_exporter version: 0.2.3

powerdns_exporter, version  (branch: , revision: )
  build user:
  build date:
  go version:       go1.10.4

Try to run powerdns exporter:

powerdns-exporter --listen-address="0.0.0.0:9120" --api-url="http://localhost:953/api/v1" --api-key="my_api_key"

Got error:

level=error ts=2023-04-07T10:59:27.588Z caller=powerdns_exporter.go:423 msg="Could not fetch PowerDNS server info" err="Not Found"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x888ec2]

goroutine 1 [running]:
main.main()
    /home/pleal/powerdns_exporter/powerdns_exporter.go:426 +0x932

Curl to PowerDNS api: curl -s -H 'X-API-Key: my_api_key' http://127.0.0.1:953/api/v1/servers

"autoprimaries_url":"/api/v1/servers/localhost/autoprimaries{/autoprimary}",
"config_url":"/api/v1/servers/localhost/config{/config_setting}",
"daemon_type":"authoritative",
"id":"localhost",
"type":"Server",
"url":"/api/v1/servers/localhost",
"version":"4.7.2",
"zones_url":"/api/v1/servers/localhost/zones{/zone}"
kozicpetar commented 1 year ago

I found what was the problem, --api-url need to have slash at the end --api-url="http://localhost:953/api/v1/"