Hi Guys,
So, this question is more of an asking for a recommendation request for ideas so it may be better suited in the discussions forum I'm not certain.
Basically, I've been working on a Dashboard which contains a component that monitors a variety of sites to check they are working.
I've gone down the route of using HttpWebRequests
var request = (HttpWebRequest) WebRequest.Create(url);
request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
var timer = new Stopwatch();
var siteState = WebSiteStateEnum.Okay;
try
{
timer.Start();
var response = (HttpWebResponse) request.GetResponse();
response.Close();
timer.Stop();
TimeSpan timeTaken = timer.Elapsed;
...
}
catch (Exception)
{
timer.Stop();
}
UpdateWebsiteResult(id, siteState);
Thread.Sleep( siteState == WebSiteStateEnum.Down ? 30000 : 60000);
So this code runs and it seems to be okay. Not amazing but okay.
My question is, would you have taken this approach or would you have driven this process from the individual sites by creating a signalR HeartBeat type module that you add to each site?
Is there anything I should add-in / do differently to monitor the status of various websites from a central point?
(These sites are hosted on different servers/locations to the dashboard site due to various client requirements on the individual sites.