public WCFSatelliteDeploymentAgent(IVariableProcessor variableProcessor, string endpoint, string login, string password, TimeSpan?openTimeoutSpan = null, TimeSpan?waitTimeout = null) { this.variableProcessor = variableProcessor; WSHttpBinding binding = new WSHttpBinding(SecurityMode.TransportWithMessageCredential); binding.MaxBufferPoolSize = 1024 * 1024 * 10; binding.MaxReceivedMessageSize = 1024 * 1024 * 10; binding.ReaderQuotas.MaxArrayLength = 1024 * 1024 * 10; binding.OpenTimeout = openTimeoutSpan ?? new TimeSpan(0, 10, 0); binding.CloseTimeout = openTimeoutSpan ?? new TimeSpan(0, 10, 0); binding.SendTimeout = waitTimeout ?? new TimeSpan(3, 0, 0); binding.ReceiveTimeout = waitTimeout ?? new TimeSpan(3, 0, 0); binding.BypassProxyOnLocal = false; binding.UseDefaultWebProxy = true; binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; this.deploymentClient = new DeploymentServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/DeploymentService"))); this.deploymentClient.ClientCredentials.UserName.UserName = login; this.deploymentClient.ClientCredentials.UserName.Password = password; this.monitoringClient = new MonitoringServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/MonitoringService"))); this.monitoringClient.ClientCredentials.UserName.UserName = login; this.monitoringClient.ClientCredentials.UserName.Password = password; this.informationClient = new InformationServiceClient(binding, new EndpointAddress(new Uri(endpoint + "/InformationService"))); this.informationClient.ClientCredentials.UserName.UserName = login; this.informationClient.ClientCredentials.UserName.Password = password; }
protected HealthInfoPersisted GetDagHealthInfo(string serverToQueryFqdn) { HealthInfoPersisted hip = null; Exception ex = MonitoringServiceClient.HandleException(delegate { TimeSpan timeSpan = TimeSpan.FromSeconds((double)this.TimeoutInSeconds); using (MonitoringServiceClient monitoringServiceClient = MonitoringServiceClient.Open(serverToQueryFqdn, timeSpan, timeSpan, timeSpan, MonitoringServiceClient.ReceiveTimeout)) { Task <HealthInfoPersisted> dagHealthInfoAsync = monitoringServiceClient.GetDagHealthInfoAsync(); if (!dagHealthInfoAsync.Wait(timeSpan)) { throw new TimeoutException(Strings.GetDagHealthInfoRequestTimedOut(this.TimeoutInSeconds)); } hip = dagHealthInfoAsync.Result; } }); if (ex != null) { base.WriteError(new GetDagHealthInfoRequestException(serverToQueryFqdn, ex.Message, ex), ErrorCategory.InvalidResult, serverToQueryFqdn); return(null); } hip.ToString(); return(hip); }
private static void CallMonitoringAgent() { MonitoringProxy.MonitoringServiceClient msc = new MonitoringServiceClient(); msc.StartMonitoringEngine(); //RMS.Centralize.BSL.MonitoringEngine.MonitoringService ms = new MonitoringService(); //ms.Start(); }
private static void TestClientProxy() { ClientProxy.ClientServiceClient cp = new ClientServiceClient(); var clientResult = cp.GetClient(GetClientBy.ClientID, 1, null, null, true, true); MonitoringProxy.MonitoringServiceClient mp = new MonitoringServiceClient(); List <RmsReportMonitoringRaw> lRawMessage = new List <RmsReportMonitoringRaw>(); foreach (var mpd in clientResult.ListMonitoringProfileDevices) { var rawMessage = new RmsReportMonitoringRaw(); rawMessage.ClientCode = clientResult.Client.ClientCode; rawMessage.DeviceCode = clientResult.ListDevices.First(d => d.DeviceId == mpd.DeviceId).DeviceCode; if (mpd.MonitoringProfileDeviceId != 16) { rawMessage.Message = "OK"; } else { rawMessage.Message = "DEVICE_NOT_READY"; } rawMessage.MessageDateTime = DateTime.Now; rawMessage.MonitoringProfileDeviceId = mpd.MonitoringProfileDeviceId; lRawMessage.Add(rawMessage); } mp.AddMessages(lRawMessage); }
private static void SendBusinessMessage() { MonitoringProxy.MonitoringServiceClient msc = new MonitoringServiceClient(); var raw = new RmsReportMonitoringRaw(); raw.ClientCode = "SKSSGWS01"; raw.Message = "BATCH_COMPLETE"; raw.MessageGroupCode = "B011"; raw.MessageRemark = "Testing Business Message"; msc.AddBusinessMessage(raw); }
public MonitoringService(string urlWebService) { try { _monitoringService = new MonitoringServiceClient(); Initialize(urlWebService); } catch (Exception ex) { _monitoringService = null; throw new RMSAppException(this, "0500", "MonitoringService failed. " + ex.Message, ex, false); } }
private Task <Tuple <string, T> >[] ExecuteRemoteCallForServers <T>(string operationTraceName, IEnumerable <string> serverFqdnsToContact, Func <MonitoringServiceClient, Task <Tuple <string, T> > > remoteOperation) { int num = serverFqdnsToContact.Count <string>(); if (num == 0) { DatabaseHealthTracker.Tracer.TraceDebug <string>((long)this.GetHashCode(), "{0}(): There are no servers to contact. Returning <NULL>.", operationTraceName); return(null); } Task <Tuple <string, T> >[] array = new Task <Tuple <string, T> > [num]; int num2 = 0; Task <Tuple <string, T> >[] result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { foreach (string serverName in serverFqdnsToContact) { MonitoringServiceClient monitoringServiceClient = MonitoringServiceClient.Open(serverName); disposeGuard.Add <MonitoringServiceClient>(monitoringServiceClient); Task <Tuple <string, T> > task = remoteOperation(monitoringServiceClient); array[num2++] = task; } try { TimeSpan timeSpan = TimeSpan.FromSeconds(30.0); if (!Task.WaitAll((Task[])array, timeSpan)) { DatabaseHealthTracker.Tracer.TraceError <string, TimeSpan>((long)this.GetHashCode(), "{0}(): One or more calls timed out after '{1}'.", operationTraceName, timeSpan); ReplayCrimsonEvents.DHTRemoteOperationTimedOut.LogPeriodic <string, TimeSpan>(operationTraceName, DateTimeHelper.OneHour, operationTraceName, timeSpan); } else { DatabaseHealthTracker.Tracer.TraceDebug <string>((long)this.GetHashCode(), "{0}(): All calls were issued successfully.", operationTraceName); } } catch (AggregateException ex) { foreach (Exception ex2 in ex.Flatten().InnerExceptions) { DatabaseHealthTracker.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "{0}() got Exception: {1}", operationTraceName, ex2); ReplayCrimsonEvents.DHTRemoteOperationFailed.LogPeriodic <string, string, Exception>(ex2.Message, DateTimeHelper.OneHour, operationTraceName, ex2.Message, ex2); } } result = array; } return(result); }
/// <summary> /// Make a call to Monitoring Service with the information of exception /// </summary> /// <param name="exception">Catched exception</param> /// <returns>ticketNumber</returns> public static void CatchExceptionInMonitoringService(Exception exception) { //instance the client MonitoringServiceClient monitoringClient = new MonitoringServiceClient(); try { //Set the parameters for monitoring service ParameterMonitoring parameters = new ParameterMonitoring { Application = "VestalisV3", Category = EnumCategory.Server, MessageException = exception.InnerException == null ? exception.Message : String.Format( "Exception message :{0} " + Environment.NewLine + " InnerException message:{1}", exception.Message, exception.InnerException.Message), StackTrace = exception.InnerException == null ? exception.StackTrace : String.Format( "StackTrace exception: {0} " + Environment.NewLine + " StackTrace inner exception: {1}", exception.StackTrace, exception.InnerException.StackTrace), Type = EnumTicketType.Bug, UserModule = "VestalisV3", UserName = "******" }; //save the exception information and get the ticket number monitoringClient.SaveSupportTicket(parameters); } finally { if (monitoringClient != null) { ((IDisposable)monitoringClient).Dispose(); } } }
private void btnCallAddBizMessage_Click(object sender, RoutedEventArgs e) { MonitoringServiceClient msc = new MonitoringServiceClient(); var rawMessage = new RmsReportMonitoringRaw(); rawMessage.ClientCode = txtClientCode.Text; rawMessage.DeviceCode = txtDeviceCode.Text; rawMessage.MessageGroupCode = txtMessageGroupCode.Text; rawMessage.Message = txtMessage.Text; rawMessage.MessageDateTime = DateTime.Now; if (!string.IsNullOrEmpty(txtMonitoringProfileDeviceID.Text.Trim())) { rawMessage.MonitoringProfileDeviceId = Convert.ToInt32(txtMonitoringProfileDeviceID.Text); } rawMessage.MessageRemark = string.IsNullOrEmpty(txtMessageRemark.Text) ? null : txtMessageRemark.Text; msc.AddBusinessMessage(rawMessage); }
protected override void InternalRun() { if (!ReplicationCheckGlobals.MonitoringServiceCheckHasRun) { ReplicationCheckGlobals.MonitoringServiceCheckHasRun = true; } else { ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "MonitoringServiceCheck skipping because it has already been run once."); base.Skip(); } if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped) { ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title); base.Skip(); } TimeSpan timeout = TimeSpan.FromSeconds(5.0); Exception ex = MonitoringServiceClient.HandleException(delegate { using (MonitoringServiceClient monitoringServiceClient = MonitoringServiceClient.Open(this.ServerName, timeout, timeout, timeout, timeout)) { Task <ServiceVersion> versionAsync = monitoringServiceClient.GetVersionAsync(); if (!versionAsync.Wait(timeout)) { ExTraceGlobals.HealthChecksTracer.TraceError <string, TimeSpan>((long)this.GetHashCode(), "MonitoringServiceCheck: GetVersionAsync() call to server '{0}' timed out after '{1}'", this.ServerName, timeout); this.Fail(Strings.MonitoringServiceRequestTimedout(this.ServerName, timeout)); } else { ExTraceGlobals.HealthChecksTracer.TraceDebug <string, long>((long)this.GetHashCode(), "MonitoringServiceCheck: GetVersionAsync() call to server '{0}' returned: {1}", this.ServerName, versionAsync.Result.Version); } } }); if (ex != null) { ExTraceGlobals.HealthChecksTracer.TraceError <string, Exception>((long)this.GetHashCode(), "MonitoringServiceCheck: GetVersionAsync() call to server '{0}' failed with exception: {1}", base.ServerName, ex); base.Fail(Strings.MonitoringServiceRequestFailed(base.ServerName, ex.Message)); } }
private void btnCallAddWebsiteMessage_Click(object sender, RoutedEventArgs e) { MonitoringServiceClient msc = new MonitoringServiceClient(); var rawMessage = new RmsReportMonitoringRaw(); rawMessage.ClientCode = txtClientCode.Text; rawMessage.MessageGroupCode = txtMessageGroupCode.Text; rawMessage.Message = txtMessage.Text; rawMessage.MessageDateTime = DateTime.Now; if (!string.IsNullOrEmpty(txtWebsiteMonitoringID.Text.Trim())) { rawMessage.WebsiteMonitoringId = Convert.ToInt32(txtWebsiteMonitoringID.Text); } rawMessage.MessageRemark = string.IsNullOrEmpty(txtMessageRemark.Text) ? null : txtMessageRemark.Text; List <RmsReportMonitoringRaw> list = new List <RmsReportMonitoringRaw>(); list.Add(rawMessage); msc.AddWebsiteMessage(list); }
static void Main(string[] args) { MonitoringServiceClient proxy = new MonitoringServiceClient( //"netTcpEndpoint" "httpEndpoint" ); proxy.Open(); while (true) { Thread.Sleep(TimeSpan.FromSeconds(1)); MonitoringValues values = proxy.CurrentValues(); bool isAlive = proxy.isAlive(); Console.WriteLine("Maschinenstatus: {0}\nGutmengen: {1}\nAusschussmengen: {2}", values.Maschinenstatus, values.Gutmengen, values.Ausschussmengen); // Console.ReadLine(); } proxy.Close(); }
public bool CheckServerState(VMForPCSettingsName control, string connString, string connName) { bool ret = false; try { switch (control) { case VMForPCSettingsName.SCVMMServer: { if (!IsNullOrWhiteSpaceString(connString) && !IsNullOrWhiteSpaceString(connName)) { EndpointAddress endPointAddress = GetEndPointAddress(connString, connName); using (VirtualMachineManagementServiceClient check = new VirtualMachineManagementServiceClient(new WSHttpBinding("WSHttpBinding_IVirtualMachineManagementService"), endPointAddress)) { check.Open(); ret = true; check.Close(); } } break; } case VMForPCSettingsName.SCOMServer: { if (!IsNullOrWhiteSpaceString(connString) && !IsNullOrWhiteSpaceString(connName)) { EndpointAddress endPointAddress = GetEndPointAddress(connString, connName); using (MonitoringServiceClient checkMonitoring = new MonitoringServiceClient(new WSHttpBinding("WSHttpBinding_IMonitoringService"), endPointAddress)) { checkMonitoring.Open(); ret = true; checkMonitoring.Close(); } } break; } } } catch (Exception ex) { // Log.WriteError("Could not check server state", ex); // ret = false; // throw; } return ret; }