public IActionResult TestMonitoringTask([FromBody] Models.MonitorConfig config)
 {
     if (config == null)
     {
         return(new BadRequestResult());
     }
     return(new OkObjectResult(Helpers.Monitor.TestConfig(config)));
 }
Ejemplo n.º 2
0
 public Monitor(Models.MonitorConfig config, string uid)
 {
     Config                      = config;
     Uid                         = uid ?? "";
     _url                        = config.Url;
     _method                     = config.Method;
     _interval                   = config.Interval;
     _expectedStatusCode         = config.ExpectedStatusCode;
     _expectResponseBodyContains = config.ExpectedResponseBodyContains;
     ResultsLimit                = config.ResultsSizeLimit;
     if (ResultsLimit > 0)
     {
         Results = new List <Models.MonitorResult>();
     }
 }
Ejemplo n.º 3
0
        public static bool TestConfig(Models.MonitorConfig config)
        {
            var tempMonitor = new Monitor(config, string.Empty);

            return(tempMonitor.GetResponse(out HttpResponseMessage response, out string errMsg));
        }