Пример #1
0
        /*
         * private bool AnalyzeHost()
         * {
         *  var currentICM = SALsA.GetInstance(Id).ICM;
         *  var title = currentICM.CurrentICM.Title;
         *  var isHostIssue = Regex.Match(title, @"HostGAPlugin.*Cluster.*Node.*(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}", RegexOptions.IgnoreCase).Success;
         *  if (isHostIssue)
         *  {
         *      var splitTitle = title.ToLowerInvariant().Replace(" :", ":").Replace(": ", ":").Replace(",", " ").Replace(".", " ").Replace("nodeid", "node").Split(' ');
         *      splitTitle = Array.FindAll(splitTitle, s => s.Contains(":"));
         *      var dict = splitTitle.ToDictionary(
         *          k => k.Split(':')[0],
         *          e => e.Split(':')[1]
         *      );
         *      var cluster = dict["cluster"];
         *      var nodeid = dict["node"];
         *      var creationTime = currentICM.CurrentICM.CreateDate;
         *      var startTime = creationTime.AddHours(-12);
         *      var endTime = new DateTime(Math.Min(creationTime.AddHours(+12).Ticks, DateTime.UtcNow.Ticks));
         *      SALsA.GetInstance(Id).TaskManager.AddTask(
         *      Utility.SaveAndSendBlobTask(Constants.AnalyzerHostGAPluginFilename,
         *          GenevaActions.GetNodeDiagnosticsFiles(Id, cluster, nodeid, startTime.ToString("s"), endTime.ToString("s")), Id)
         *      );
         *  }
         *  return isHostIssue;
         * }
         */
        private void ExecuteAllActionsForIaaS(ARMDeployment dep)
        {
            Task <string> modelTask = null;

            SALsA.GetInstance(Id).ICM.QueueICMDiscussion(dep.ToString());
            SALsA.GetInstance(Id).TaskManager.AddTask(
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerConsoleSerialOutputFilename, GenevaActions.GetVMConsoleSerialLogs(Id, dep), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerVMScreenshotOutputFilename, GenevaActions.GetVMConsoleScreenshot(Id, dep), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerVMModelAndViewOutputFilename, modelTask = GenevaActions.GetVMModelAndInstanceView(Id, dep), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerInspectIaaSDiskOutputFilename, GenevaActions.InspectIaaSDiskForARMVM(Id, dep), Id)
                );

            var rawInfo = LogContainerId(modelTask, Id);

            if (rawInfo != null)
            {
                GlobalInfo.Update(
                    new Guid(rawInfo.ContainerId),
                    new Guid(rawInfo.NodeId),
                    rawInfo.Cluster
                    );
                var startTime = SALsA.GetInstance(Id).ICM.ICMImpactStartTime().AddHours(-12);
                var endTime   = new DateTime(Math.Min(startTime.AddHours(+24).Ticks, DateTime.UtcNow.Ticks));
                SALsA.GetInstance(Id).TaskManager.AddTask(
                    BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerNodeDiagnosticsFilename, GenevaActions.GetNodeDiagnosticsFilesByContainerId(Id, GlobalInfo), Id)
                    );
            }
        }
Пример #2
0
        private void ExecuteAllActionsForVMSS(ARMDeployment dep)
        {
            int instanceId = TryConvertInstanceNameToInstanceId(this.VMName);

            // TODO instead of using 0, take 5 random and use them
            instanceId = instanceId == -1 ? 0 : instanceId;

            Task <string> modelTask = null;

            SALsA.GetInstance(Id).ICM.QueueICMDiscussion(dep.ToString());
            SALsA.GetInstance(Id).TaskManager.AddTask(
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerConsoleSerialOutputFilename, GenevaActions.GetVMConsoleSerialLogs(Id, dep, instanceId), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerVMScreenshotOutputFilename, GenevaActions.GetVMConsoleScreenshot(Id, dep, instanceId), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerVMModelAndViewOutputFilename, modelTask = GenevaActions.GetVMModelAndInstanceView(Id, dep, instanceId), Id),
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerInspectIaaSDiskOutputFilename, GenevaActions.InspectIaaSDiskForARMVM(Id, dep, instanceId), Id)
                );
            var rawInfo = LogContainerId(modelTask, Id);

            if (rawInfo != null)
            {
                GlobalInfo.Update(
                    new Guid(rawInfo.ContainerId),
                    new Guid(rawInfo.NodeId),
                    rawInfo.Cluster
                    );
                SALsA.GetInstance(Id).TaskManager.AddTask(
                    BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerNodeDiagnosticsFilename, GenevaActions.GetNodeDiagnosticsFilesByContainerId(Id, GlobalInfo), Id)
                    );
            }
        }
Пример #3
0
        public Analyzer(int Id, object manualRun)
        {
            this.IsCustomRun = true;
            this.Id          = Id;
            StartTime        = SALsA.GetInstance(Id).ICM.CurrentICM.CreateDate;
            Log.Information("Received ManualRun order type {0} with param {1} : ",
                            manualRun.GetType(), Utility.ObjectToJson(manualRun));
            if (manualRun.GetType() == typeof(ManualRun_ICM))
            {
                ManualRun_ICM manualArm = (ManualRun_ICM)manualRun;

                SubscriptionId    = manualArm.SubscriptionID;
                ResourceGroupName = manualArm.ResourceGroupName;
                VMName            = manualArm.VMName;

                AnalyzerInternal();
            }
            else if (manualRun.GetType() == typeof(ManualRun_IID))
            {
                ManualRun_IID manualIID = (ManualRun_IID)manualRun;

                SubscriptionId    = manualIID.SubscriptionID;
                ResourceGroupName = manualIID.ResourceGroupName;
                VMName            = manualIID.VMName;

                ARMDeployment dep        = null;
                int           instanceId = -1;
                if (String.IsNullOrEmpty(manualIID.Region))
                {
                    Log.Information("Calling automatic ARM VMdetection. No Region parameter provided.");
                    ARMSubscription arm = AnalyzeARMSubscription(SubscriptionId, this.ResourceGroupName);
                    dep        = AnalyzeARMDeployment(arm);
                    instanceId = TryConvertInstanceNameToInstanceId(this.VMName);
                }
                else
                {
                    dep                = new ARMDeployment();
                    dep.Name           = manualIID.VMName;
                    dep.Subscriptions  = manualIID.SubscriptionID.ToString();
                    dep.ResourceGroups = manualIID.ResourceGroupName;
                    dep.Location       = manualIID.Region;
                    instanceId         = manualIID.Instance;
                }
                if (instanceId < 0)
                {
                    Log.Information("No Instance ID detected. Assuming this is a normal single IaaS VM");
                    SALsA.GetInstance(Id).TaskManager.AddTask(
                        BlobStorageUtility.SaveAndSendBlobTask(
                            Constants.AnalyzerInspectIaaSDiskOutputFilename,
                            GenevaActions.InspectIaaSDiskForARMVM(Id, dep), Id));
                }
                else
                {
                    Log.Information("No Instance ID detected. Assuming this is a normal single IaaS VM");
                    SALsA.GetInstance(Id).TaskManager.AddTask(
                        BlobStorageUtility.SaveAndSendBlobTask(
                            Constants.AnalyzerInspectIaaSDiskOutputFilename,
                            GenevaActions.InspectIaaSDiskForARMVM(Id, dep, instanceId), Id));
                }
            }
            else if (manualRun.GetType() == typeof(ManualRun_RDFE_Fabric))
            {
                var rdfe   = (ManualRun_RDFE_Fabric)manualRun;
                var vmInfo = new ShortRDFERoleInstance
                {
                    ContainerID = new Guid(rdfe.ContainerID),
                    Fabric      = rdfe.FabricCluster,
                    NodeId      = new Guid(rdfe.NodeId)
                };
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerNodeDiagnosticsFilename, GenevaActions.GetNodeDiagnosticsFilesByContainerId(Id, vmInfo), Id).Wait();
            }
            else if (manualRun.GetType() == typeof(ManualRun_RDFE_Tenant))
            {
                var rdfe   = (ManualRun_RDFE_Tenant)manualRun;
                var vmInfo = new ShortRDFERoleInstance
                {
                    Fabric       = rdfe.FabricCluster,
                    DeploymentId = rdfe.DeploymentID,
                    InstanceName = rdfe.RoleInstanceName
                };
                BlobStorageUtility.SaveAndSendBlobTask(Constants.AnalyzerNodeDiagnosticsFilename, GenevaActions.GetNodeDiagnosticsFilesByDeploymentIdorVMName(Id, vmInfo), Id).Wait();
            }
        }