class PowerdnsStatusService (View source)

Reads server info and metrics from the PowerDNS API and probes secondary servers for the status page.

Constants

private PROBE_PORT

Bounds on the blocking autoprimary probes, which run serially on page load.

private PROBE_TIMEOUT_SECONDS

private PROBE_BUDGET_SECONDS

Methods

__construct(ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null)

No description

bool
isApiEnabled()

No description

array
getServerStatus()

Server info and the PowerDNS API statistics, without the Prometheus endpoint.

array
getDetailedServerStatus()

Server status plus a description per metric, taken from the Prometheus endpoint's HELP lines, for the status page tooltips.

array
checkSlaveServerStatus(array $slaveServers)

No description

string|null
probeHost(string $host)

An autoprimary has to serve AXFR, which is TCP-only, so a TCP connect is a fair liveness proxy here even though it would not be for a resolver.

string|false
fetchMetricsWithAuth(string $url)

Fetch metrics from URL with optional Basic Authentication Validates URL to prevent SSRF and path traversal attacks

Details

__construct(ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null)

No description

Parameters

ConfigurationInterface $config
SessionInterface $session
LoggerInterface|null $logger

bool isApiEnabled()

No description

Return Value

bool

array getServerStatus()

Server info and the PowerDNS API statistics, without the Prometheus endpoint.

Return Value

array

array getDetailedServerStatus()

Server status plus a description per metric, taken from the Prometheus endpoint's HELP lines, for the status page tooltips.

Return Value

array

array checkSlaveServerStatus(array $slaveServers)

No description

Parameters

array $slaveServers

Return Value

array

protected string|null probeHost(string $host)

An autoprimary has to serve AXFR, which is TCP-only, so a TCP connect is a fair liveness proxy here even though it would not be for a resolver.

Parameters

string $host

Return Value

string|null

The connection error, or null when the host answered.

protected string|false fetchMetricsWithAuth(string $url)

Fetch metrics from URL with optional Basic Authentication Validates URL to prevent SSRF and path traversal attacks

Parameters

string $url

The metrics URL to fetch

Return Value

string|false

The metrics content or false on failure