예제 #1
0
 private static Task <JObject> ExecuteCheck(JObject check, Command.Command command)
 {
     return(Task.Factory.StartNew(() =>
     {
         var stopwatch = new Stopwatch();
         stopwatch.Start();
         try
         {
             var result = command.Execute();
             check["output"] = result.Output;
             check["status"] = result.Status;
         } catch (Exception e)
         {
             Log.Warn(e, "Error running check {0}", check.ToString());
             check["output"] = "";
             check["status"] = 2;
         }
         stopwatch.Stop();
         check["duration"] = ((float)stopwatch.ElapsedMilliseconds) / 1000;
         return check;
     }));
 }
예제 #2
0
        private static Task<JObject> ExecuteCheck(JObject check, Command.Command command)
        {

            return Task.Factory.StartNew(() =>
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                try
                {
                    var result = command.Execute();
                    check["output"] = result.Output;
                    check["status"] = result.Status;
                } catch (Exception e)
                {
                    Log.Warn(e, "Error running check {0}", check.ToString());
                    check["output"] = "";
                    check["status"] = 2;
                }
                stopwatch.Stop();
                check["duration"] = ((float)stopwatch.ElapsedMilliseconds) / 1000;
                return check;
            });
        }