Sync up your monitoring service with a list of hosts from Amazon Route53.
Transposit can help you sync up different data sources and keep an eye on changes. For example, if you launch new web applications or sites on a regular basis, you want to make sure that all of your web URLs are monitored. If someone adds a new website, at the very least you want to make sure the root url (example.com
) is checked periodically. You'll then be warned if a site is down, rather than having your users discover it.
If you manage your domains using Amazon Route53, AWS's highly available DNS service, you can get a list of all the domains (Amazon Route53 calls them 'hosted zones') via its API.
Depending on what monitoring system you use, you can often get a list of monitors via an API as well. Transposit has written a data connector for UptimeRobot, but if your monitoring software has a REST API, you can also roll your own data connector.
Combining the APIs to see what is being monitored is a short JavaScript operation in Transposit:
(params) => {
const hostnames = api.run("this.list_hosted_zones").map(h => {
return h.Name.replace(/\.$/, "");
});
const uniq_hostnames = [...new Set(hostnames)];
const monitors = api.run("this.get_monitors")[0].monitor.map(m => {
return m.url.replace("https://", "").replace("http://", "").replace("/", "");
});
const uniq_monitored_hostnames = [...new Set(monitors)];
const hostnames_missing_monitoring = uniq_hostnames.filter(x => !uniq_monitored_hostnames.includes(x));
return hostnames_missing_monitoring;
}
The inverse of this operation, that is hostnames that are monitored but not in Amazon Route53, is useful as well. You don't want to be monitoring websites that are not hosted with you any more:
const monitors_not_hosted = uniq_monitored_hostnames.filter(x => !uniq_hostnames.includes(x));
If you know that some monitors are missing but should not be, what are logical next steps? It depends on:
Based on these factors, you may want more or less human intervention in creating new monitors. On a scale of 'a human must know!' to 'the less intervention the better' here are some options:
All of these will help keep your DNS and monitoring in sync.
Check it out! You can read up on and fork the sample application.