예제 #1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         RpcInvokeMonitoringProbe.Reply reply = null;
         LocalizedException             ex    = null;
         try
         {
             Dictionary <string, string> dictionary = this.CreatePropertyBag();
             string text = string.Empty;
             if (dictionary != null && dictionary.Count != 0)
             {
                 text = CrimsonHelper.ConvertDictionaryToXml(dictionary);
             }
             this.ItemTargetExtension = (string.IsNullOrWhiteSpace(this.ItemTargetExtension) ? string.Empty : this.ItemTargetExtension);
             text  = (string.IsNullOrWhiteSpace(text) ? string.Empty : text);
             reply = RpcInvokeMonitoringProbe.Invoke(this.Server.Fqdn, this.Identity, text, this.ItemTargetExtension, 300000);
         }
         catch (ActiveMonitoringServerException ex2)
         {
             ex = ex2;
         }
         catch (ActiveMonitoringServerTransientException ex3)
         {
             ex = ex3;
         }
         if (ex != null)
         {
             this.WriteWarning(ex.LocalizedString);
         }
         else if (!string.IsNullOrEmpty(reply.ErrorMessage))
         {
             base.WriteWarning(reply.ErrorMessage);
         }
         else
         {
             MonitoringProbeResult sendToPipeline = new MonitoringProbeResult(this.Server.Fqdn, reply.ProbeResult);
             base.WriteObject(sendToPipeline);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     try
     {
         Dictionary <string, string> dictionary = this.CreatePropertyBag();
         string text = null;
         if (dictionary.TryGetValue("ItemTargetExtension", out text))
         {
             dictionary.Remove("ItemTargetExtension");
         }
         string text2 = string.Empty;
         if (dictionary.Count != 0)
         {
             text2 = CrimsonHelper.ConvertDictionaryToXml(dictionary);
         }
         text  = (text ?? string.Empty);
         text2 = (text2 ?? string.Empty);
         RpcInvokeMonitoringProbe.Reply reply = RpcInvokeMonitoringProbe.Invoke(this.server.Fqdn, this.ProbeIdentity, text2, text, 300000);
         if (reply != null)
         {
             if (!string.IsNullOrEmpty(reply.ErrorMessage))
             {
                 throw new InvalidOperationException(reply.ErrorMessage);
             }
             MonitoringProbeResult monitoringProbeResult = new MonitoringProbeResult(this.server.Fqdn, reply.ProbeResult);
             this.WriteInfo(Strings.ProbeResult(monitoringProbeResult.ResultType.ToString()));
             if (monitoringProbeResult.ResultType != ResultType.Succeeded)
             {
                 string failedProbeResultDetailsString = string.Format("Error: {0}\r\nException: {1}", monitoringProbeResult.Error, monitoringProbeResult.Exception);
                 this.WriteWarning(Strings.FailedProbeResultDetails(failedProbeResultDetailsString));
             }
             base.WriteObject(monitoringProbeResult);
         }
     }
     finally
     {
         TaskLogger.LogExit();
     }
 }