Subscribing to changes to Synthetic alerting minions

Time and again the synthetic IP’s get updated which breaks our monitoring where we whitelist the synthetic check minion ip’s. How do I subscribe for receiving an email when these changes are scheduled.

Hi @kasturir - Doesn’t provide the answer you want, but I implemented an API synthetic which I then set an alert up on failure. Amend for your purposes :wink:

// Script-wide timeout for wait and waitAndFind functions (in ms)
var startTime = new Date().getTime(),
  thisStep = 0,
	assert = require('assert'),
	Q = require('q'),
  req = require('urllib-sync').request;
  const ScriptTimeout = 0;
	const IPFileUrl = "https://s3.amazonaws.com/nr-synthetics-assets/nat-ip-dnsname/production/ip.json";
  const DublinNode = "Dublin, IE";
  const DublinIPs = [ "54.76.137.83", "34.241.198.127", "18.200.73.249", "99.81.135.174", "34.253.119.85", "34.242.252.249" ];

var log = function (msg) {
    var deferred = Q.defer();
    if (typeof msg === "string") {
        var totalTimeElapsed = (new Date().getTime() - startTime);
        var elapsedSecs = totalTimeElapsed / 1000;
        console.log('Step ' + thisStep + ': ' + elapsedSecs.toFixed(2) + 's: ' + msg);
        thisStep++;
        if (ScriptTimeout > 0 && totalTimeElapsed > ScriptTimeout) {
            throw Error('Script timed out. ' + totalTimeElapsed + 'ms is longer than script timeout threshold of ' + ScriptTimeout + 'ms.');
        }
        deferred.resolve();
    }
    else {
        deferred.reject("Incorrect type passed to log function, expected string");
    }
    return deferred.promise;
};

log("Initialising ...");


function shouldDisplayError(message)
{
  return !(typeof message != "undefined" && message !== null && message.length > 0);
}

var retrieveFileContent = function()
{
	var deferred = Q.defer();
  var res = req(IPFileUrl);
  deferred.resolve(res.data.toString());
  return deferred.promise;
}

var validateIPs = function(data)
{
	var deferred = Q.defer();
  var temp = data.replace("\'", "\"");
  var json = JSON.parse(temp);
  var dublin = json[DublinNode];
  var missingIPCount = 0;

  if(dublin.length != DublinIPs.length)
    deferred.reject("Mismatch in ip lengths");

	for(var i = 0, len = DublinIPs.length; i < len; i++)
	{
		var ip = DublinIPs[i];
		log("Checking for ip of: " + ip);
		if(dublin.indexOf(ip) == -1)
		{
      log("Failed to find ip of: " + ip)
			missingIPCount ++;
		}
	};
  
  if (missingIPCount != 0)
  {
    deferred.reject(missingIPCount + " ip addresses are missing from expected list");
  }
  else
  {
    log("Completed successfully");
    deferred.resolve();
  }

  return deferred.promise;
}

retrieveFileContent()
.then(function(data){
  validateIPs(data);
});
1 Like

Hi @stefan_garnham thank you for providing this :slightly_smiling_face:

@kasturir have you had a chance to try this solution? If so, how did it work out for you?