Example #1
0
 private static void ReportStatus(Endpoint endpoint, EndpointStatus newStatus)
 {
     foreach (var reporter in reporterRepo.GetConfiguredReporters())
     {
         reporter.Report(endpoint, newStatus);
     }
 }
Example #2
0
 private static void ReportStatus( Endpoint endpoint, EndpointStatus newStatus )
 {
     foreach ( var reporter in reporterRepo.GetConfiguredReporters() )
     {
         reporter.Report( endpoint, newStatus );
     }
 }
Example #3
0
        private static void Monitor_EndpointChecked(EndpointCheckedEventArgs args)
        {
            var newStatus = new EndpointStatus()
            {
                Timestamp  = args.Timestamp,
                StatusCode = args.StatusCode
            };
            var endpoint = endpointRepo.Get(args.Url);

            if (StatusShouldBeReported(endpoint.LastStatus, newStatus))
            {
                ReportStatus(endpoint, newStatus);
            }

            endpoint.Statuses.Add(newStatus);
            endpointRepo.SaveChanges();
        }
Example #4
0
        private static void Monitor_EndpointChecked( EndpointCheckedEventArgs args )
        {
            var newStatus = new EndpointStatus()
            {
                Timestamp = args.Timestamp,
                StatusCode = args.StatusCode
            };
            var endpoint = endpointRepo.Get( args.Url );

            if ( StatusShouldBeReported( endpoint.LastStatus, newStatus ) )
            {
                ReportStatus( endpoint, newStatus );
            }

            endpoint.Statuses.Add( newStatus );
            endpointRepo.SaveChanges();
        }
Example #5
0
 private static bool StatusShouldBeReported(EndpointStatus lastStatus, EndpointStatus newStatus)
 {
     if (lastStatus != null)
     {
         // If the new status is different from the last status then it should be reported.
         if (lastStatus.Status != newStatus.Status)
         {
             return(true);
         }
     }
     else // If the endpoint has never been checked before but is down then it should be reported.
     {
         if (newStatus.Status == Status.Down)
         {
             return(true);
         }
     }
     return(false);
 }
Example #6
0
 private static bool StatusShouldBeReported( EndpointStatus lastStatus, EndpointStatus newStatus )
 {
     if ( lastStatus != null )
     {
         // If the new status is different from the last status then it should be reported.
         if ( lastStatus.Status != newStatus.Status )
         {
             return true;
         }
     }
     else // If the endpoint has never been checked before but is down then it should be reported.
     {
         if ( newStatus.Status == Status.Down )
         {
             return true;
         }
     }
     return false;
 }