Syncing up your monitoring with new hosts

Sync up your monitoring service with a list of hosts from Amazon Route53.

Dan Moore
Nov 15th, 2019

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 ( 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 ="this.list_hosted_zones").map(h => {
 return h.Name.replace(/\.$/, "");
 const uniq_hostnames = [ Set(hostnames)];

 const monitors ="this.get_monitors")[0] => {
 return m.url.replace("https://", "").replace("http://", "").replace("/", "");

 const uniq_monitored_hostnames = [ 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));

Now what

If you know that some monitors are missing but should not be, what are logical next steps? It depends on:

  • how many monitors you have
  • if you launch new sites often that require monitoring
  • how often sites leave your hosting service
  • how amenable the monitoring URLs are to being created automatically (E.g. if you have a number of CMS instances, you might want to monitor not just the root path, but also the login page)
  • whether you have an automated process to add monitors or whether it is manual

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:

  • page an admin about the missing monitor
  • send a Slack message to a #devops channel, which presumably would be eventually be viewed by a human being
  • have the missing monitor added automatically (finally answering “who will monitor the monitors?” to paraphrase Juvenal)

All of these will help keep your DNS and monitoring in sync.

Try it out

Check it out! You can read up on and fork the sample application.