Exemple #1
0
        public override List <System.Data.DataTable> GetDetailDataTables()
        {
            List <System.Data.DataTable>         list          = new List <System.Data.DataTable>();
            BizTalkSuspendedCountCollectorConfig currentConfig = (BizTalkSuspendedCountCollectorConfig)AgentConfig;

            if (currentConfig.Entries.Count == 1)
            {
                System.Data.DataTable suspendedTable = new System.Data.DataTable(Name);
                suspendedTable.Columns.Add(new System.Data.DataColumn("Host", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Application", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Message type", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Server", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Time", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("URI", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Adapter", typeof(string)));
                suspendedTable.Columns.Add(new System.Data.DataColumn("Info", typeof(string)));
                BizTalkSuspendedCountCollectorConfigEntry entry = (BizTalkSuspendedCountCollectorConfigEntry)currentConfig.Entries[0];
                foreach (SuspendedInstance si in entry.GetTopXSuspendedInstanced(100))
                {
                    suspendedTable.Rows.Add(si.Host, si.Application, si.MessageType, si.PublishingServer, si.SuspendTime.ToString("yyyy-MM-dd HH:mm:ss"), si.Uri, si.Adapter, si.AdditionalInfo);
                }
                list.Add(suspendedTable);
            }
            else
            {
                System.Data.DataTable dt = new System.Data.DataTable(Name);
                dt.Columns.Add(new System.Data.DataColumn("Error", typeof(string)));
                dt.Rows.Add("Configuration error.");
                list.Add(dt);
            }
            return(list);
        }
        public override void RefreshDisplayData()
        {
            if (Collector != null)
            {
                BizTalkSuspendedCountCollectorConfig currentConfig = (BizTalkSuspendedCountCollectorConfig)Collector.AgentConfig;
                lvwEntries.Items.Clear();
                foreach (SuspendedInstance suspendedInstance in (from s in ((BizTalkSuspendedCountCollectorConfigEntry)currentConfig.Entries[0]).GetAllSuspendedInstances()
                                                                 orderby s.SuspendTime descending
                                                                 select s))
                {
                    ListViewItem lvi = new ListViewItem(suspendedInstance.Host);
                    lvi.SubItems.Add(suspendedInstance.Application);
                    lvi.SubItems.Add(suspendedInstance.MessageType);
                    lvi.SubItems.Add(suspendedInstance.PublishingServer);
                    lvi.SubItems.Add(suspendedInstance.SuspendTime.ToString());
                    lvi.SubItems.Add(suspendedInstance.Uri);
                    lvi.SubItems.Add(suspendedInstance.Adapter);
                    lvi.SubItems.Add(suspendedInstance.AdditionalInfo);
                    lvi.Tag = suspendedInstance;

                    lvwEntries.Items.Add(lvi);
                }
                toolStripStatusLabelDetails.Text = lvwEntries.Items.Count.ToString() + " item(s) found";
                ExportButtonVisible = false;
            }
        }
Exemple #3
0
 public BizTalkSuspendedCountCollector()
 {
     AgentConfig = new BizTalkSuspendedCountCollectorConfig();
 }
Exemple #4
0
        public override MonitorState RefreshState()
        {
            MonitorState returnState        = new MonitorState();
            string       lastAction         = "";
            int          instancesSuspended = 0;

            try
            {
                BizTalkSuspendedCountCollectorConfig currentConfig = (BizTalkSuspendedCountCollectorConfig)AgentConfig;
                if (currentConfig.Entries.Count == 1)
                {
                    BizTalkSuspendedCountCollectorConfigEntry entry = (BizTalkSuspendedCountCollectorConfigEntry)currentConfig.Entries[0];

                    returnState.RawDetails   = string.Format("BizTalk Managament DB: {0}", entry.Description);
                    returnState.HtmlDetails  = string.Format("<b>BizTalk Managament DB: {0}</b>", entry.Description);
                    returnState.CurrentValue = "None";

                    instancesSuspended = entry.GetSuspendedMsgsCount();
                    if (instancesSuspended < entry.InstancesWarning)
                    {
                        returnState.State = CollectorState.Good;
                    }
                    else if (instancesSuspended >= entry.InstancesError)
                    {
                        returnState.State = CollectorState.Error;
                    }
                    else
                    {
                        returnState.State = CollectorState.Warning;
                    }
                    if (instancesSuspended > 0)
                    {
                        returnState.ForAgent     = entry.Description;
                        returnState.CurrentValue = instancesSuspended;
                        MonitorState suspendedIstancesState = new MonitorState()
                        {
                            RawDetails  = "Suspended instances",
                            HtmlDetails = "<b>Suspended instances</b>"
                        };
                        foreach (SuspendedInstance si in entry.GetTopXSuspendedInstanced())
                        {
                            suspendedIstancesState.ChildStates.Add(
                                new MonitorState()
                            {
                                RawDetails  = si.ToString(),
                                HtmlDetails = si.ToString(true)
                            });
                        }
                        returnState.ChildStates.Add(suspendedIstancesState);
                    }
                }
                else
                {
                    returnState.State       = CollectorState.Error;
                    returnState.RawDetails  = "Configuration not set";
                    returnState.HtmlDetails = "Configuration not set";
                }
            }
            catch (Exception ex)
            {
                returnState.RawDetails  = ex.Message;
                returnState.HtmlDetails = string.Format("<p><b>Last action:</b> {0}</p><blockquote>{1}</blockquote>", lastAction, ex.Message);
                returnState.State       = CollectorState.Error;
            }
            return(returnState);
        }