1

Somewhere on internet I saw next example for healthcheck inside docker-compose.yml for monitoring PowerDNS:

    healthcheck:
      test: [ "CMD", "host", "-W", "1", "-t", "AAAA", "www.google.com", "172.22.22.23" ]
      interval: 35s
      timeout: 4s

But this does not work, because of next error:

OCI runtime exec failed: exec failed: unable to start container process: exec: "host": executable file not found in $PATH: unknown

What is the better command to use at healthcheck for PowerDNS?

Software Engineer
  • 15,457
  • 7
  • 74
  • 102
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158

2 Answers2

1

I suppose instead of creating a zone you could use pdns_control and its ping command:

ping, rping

Check if the server is still alive. Will return 'PONG' when it is. ping works when running inside a guardian, whereas rping works when running without a guardian.

So your healthcheck definition would look something like this:

healthcheck:
  test: ["CMD", "pdns_control", "rping"]
Ihor Kaharlichenko
  • 5,944
  • 1
  • 26
  • 32
0

My suggestion not is not devops best practice (i guess), but i can suggest next.

I assume that a healthy PDNS container is a container which has access to database with zones.
PDNS container apparently will not exit if connection to DB is lost.

So my suggestion is to use pdnsutil (cli tool which installed with pdns) to call some commands to check if connection is alive.
For example, we can try to create and delete zone (which is kinda bad for DNS server)

    healthcheck:
      test: >
        pdnsutil create-zone random.zone && pdnsutil delete-zone random.zone
        || exit 1
      interval: 60s

Or empty zone can be created only for healthchecking purposes - to get info about it (it should be created because Not Found zone will be considered as error)

pdnsutil create-zone healthchecking-zone-12345abc.com
    healthcheck:
      test: >
        pdnsutil list-zone healthchecking-zone-12345abc.com || exit 1
      interval: 60s
Archirk
  • 427
  • 7
  • 25