New Relic Synthetics DNS resolver selection: limits of built-in DNS timing and certificate checks
0 reputation · 18 Nov 2022, 19:09 UTC
0 reputation · 18 Nov 2022, 19:09 UTC
I want to use New Relic Synthetics Ping and API tests to monitor a service whose DNS behavior differs between public resolvers and our internal split-DNS setup. The goal is to measure DNS lookup time and validate SSL certificates as seen from a specific resolver, so that certificate-expiry and DNS-latency alerts reflect the same resolution path our users take.
From the documented behavior, Synthetics reports a DNS time metric for each check and validates the target's SSL certificate (expiry, hostname match, chain trust) at runtime. However, the DNS resolution appears to use the resolver configured in the Synthetics runner environment, and I cannot find any documented option to point a Ping or API test at a custom DNS server such as 8.8.8.8 or an internal resolver.
This leaves two gaps: first, whether the reported DNS time is meaningful for diagnosing propagation or split-DNS issues; second, whether certificate validation could be silently skipped when a monitor fails to connect, causing expiry alerts to be missed.
dns.resolve()), does the built-in DNS time metric still reflect only the runner's resolver?31775 reputation · 18 Nov 2022, 21:48 UTC
1. Can I pick a custom DNS resolver for Ping or API checks?
/etc/resolv.conf).2. If I perform my own DNS lookup in a scripted monitor, does the built‑in DNS time still show the container’s resolver?
dns.time metric that Synthetics exposes is collected before the monitor’s script runs and is based solely on the container’s lookup.dns.resolve() or a third‑party library is outside the scope of that metric; you would need to capture and report your own timing if you care about the custom resolver’s performance.3. Does a connection failure skip the SSL certificate check, and how can I guarantee expiry alerts?
certExpiryDays) that New Relic can use for alerting.const dns = require('dns').promises;
const start = Date.now();
const addresses = await dns.resolve4('your-service.com', { server: '8.8.8.8' });
const dnsTime = Date.now() - start;
const tls = require('tls');
const socket = tls.connect({ host: addresses[0], port: 443, rejectUnauthorized: true });
socket.on('secureConnect', () => {
const cert = socket.getPeerCertificate(true);
const expiry = new Date(cert.valid_to).getTime();
const now = Date.now();
const daysLeft = Math.floor((expiry - now) / (24 * 60 * 60 * 1000));
// Report custom metrics
newrelic.recordCustomEvent('CertCheck', { daysLeft, dnsTime });
socket.end();
});
socket.on('error', err => {
// Handle connection errors; still report a metric so alerts can fire
newrelic.recordCustomEvent('CertCheck', { daysLeft: -1, dnsTime, error: err.message });
});
daysLeft custom attribute. This will fire even if the built‑in SSL check was skipped./etc/resolv.conf from a test run.daysLeft metric still appears.To fine‑tune the custom DNS lookup you’ll need the IP address of the internal split‑DNS server you want to target. Please provide that value or confirm the resolver you intend to use.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.