public MonitoringAddViewModel() { DisplayName = "ADD MONITORING INSTANCE"; SelectDestinationPath = new SelectPathCommand(p => DestinationPath = p, isFolderPicker: true, defaultPath: DestinationPath); SelectLogPath = new SelectPathCommand(p => LogPath = p, isFolderPicker: true, defaultPath: LogPath); var monitoringInstances = InstanceFinder.MonitoringInstances(); if (!monitoringInstances.Any()) { InstanceName = "Particular.Monitoring"; PortNumber = "33633"; } else { var i = 0; while (true) { InstanceName = $"Particular.Monitoring.{++i}"; if (!monitoringInstances.Any(p => p.Name.Equals(InstanceName, StringComparison.OrdinalIgnoreCase))) { break; } } } Description = "A Monitoring Instance"; HostName = "localhost"; ErrorQueueName = "error"; UseSystemAccount = true; }
public static List <string> UsedPaths(string instanceName = null) { var monitoringInstances = InstanceFinder.MonitoringInstances(); var serviceControlAuditInstances = InstanceFinder.ServiceControlAuditInstances(); var serviceControlInstances = InstanceFinder.ServiceControlInstances(); var result = new List <string>(); result.AddRange(monitoringInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .SelectMany(p => new[] { p.LogPath, p.InstallPath })); result.AddRange(serviceControlAuditInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .SelectMany(p => new[] { p.LogPath, p.DBPath, p.InstallPath })); result.AddRange(serviceControlInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .SelectMany(p => new[] { p.LogPath, p.DBPath, p.InstallPath })); return(result.Distinct().ToList()); }
public static List <string> UsedPorts(string instanceName = null) { var monitoringInstances = InstanceFinder.MonitoringInstances(); var serviceControlAuditInstances = InstanceFinder.ServiceControlAuditInstances(); var serviceControlInstances = InstanceFinder.ServiceControlInstances(); var result = new List <string>(); result.AddRange(monitoringInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .Select(p => p.Port.ToString())); result.AddRange(serviceControlInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .SelectMany(p => new[] { p.Port.ToString(), p.DatabaseMaintenancePort.ToString() })); result.AddRange(serviceControlAuditInstances .Where(p => string.IsNullOrWhiteSpace(instanceName) || p.Name != instanceName) .SelectMany(p => new[] { p.Port.ToString(), p.DatabaseMaintenancePort.ToString() })); return(result.Distinct().ToList()); }
public static ActionResult ServiceControlInstanceCount(Session session) { var instanceCount = InstanceFinder.ServiceControlInstances().Count + InstanceFinder.MonitoringInstances().Count; session["SCINSTANCECOUNT"] = instanceCount.ToString(); return(ActionResult.Success); }
protected SharedMonitoringEditorViewModelValidator() { MonitoringInstances = InstanceFinder.MonitoringInstances(); RuleFor(x => x.InstanceName) .NotEmpty() .MustNotContainWhitespace() .When(x => x.SubmitAttempted); RuleFor(x => x.HostName) .NotEmpty().When(x => x.SubmitAttempted); RuleFor(x => x.LogPath) .NotEmpty() .ValidPath() .MustNotBeIn(x => UsedPaths(x.InstanceName)) .WithMessage(Validations.MSG_MUST_BE_UNIQUE, "Paths") .When(x => x.SubmitAttempted); }
protected override void ProcessRecord() { WriteObject(InstanceFinder.MonitoringInstances().Select(PsMonitoringService.FromInstance), true); }