private void BCCAgentIndicator()
    {
        try
        {
            StringCollection serviceList = new StringCollection();
            serviceList.Add(ConfigurationManager.AppSettings["BCCAgentName"].ToString());

            if (serviceList != null && serviceList.Count > 0)
            {
                BCCOperator bccOperator = new BCCOperator();
                DataTable dtService = bccOperator.GetServiceStatus(serviceList);

                if (dtService != null && dtService.Rows != null && dtService.Rows.Count > 0)
                {
                    string agent = "BCC Agent";
                    agentName.Text = agent;
                    agentStatus.Status = dtService.Rows[0][1].ToString();
                    agentStatus.ToolTip = dtService.Rows[0][1].ToString();
                    agentName.ToolTip = agent + " - " + dtService.Rows[0][1].ToString();
                }
            }
        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.Write(ex.Message + ex.StackTrace, "Controls_AgentIndicator");
        }
    }
    private void CheckAgentServices()
    {
        try
        {
            StringCollection serviceList = new StringCollection();
            serviceList.Add(ConfigurationManager.AppSettings["BCCAgentName"].ToString());

            if (serviceList != null && serviceList.Count > 0)
            {
                BCCOperator bccOperator = new BCCOperator();
                DataTable dtService = bccOperator.GetServiceStatus(serviceList);

                foreach (DataRow serviceRecord in dtService.Rows)
                {
                    if (serviceRecord[1].ToString().Equals("Not Installed"))
                    {
                        AnnounceError("Alert: " + serviceRecord[0] + " is not installed, monitoring will not work.");
                        break;
                    }
                    else if (serviceRecord[1].ToString().Equals("Stopped"))
                    {
                        AnnounceError("Alert: " + serviceRecord[0] + " is currently stopped, monitoring will not work.");
                        break;
                    }
                }

            }
        }
        catch (Exception ex)
        {
            DisplayError(ex.Message);
        }
    }
Esempio n. 3
0
    private void PopulateViewServiceDetails()
    {
        try
        {
            StringCollection serviceList = new StringCollection();
            serviceList.Add(ConfigurationManager.AppSettings["BCCAgentName"].ToString());

            if (serviceList != null && serviceList.Count > 0)
            {
                BCCOperator bccOperator = new BCCOperator();
                DataTable dtService = bccOperator.GetServiceStatus(serviceList);

                gridBCCAgent.DataSource = dtService;
                gridBCCAgent.DataBind();
                gridBCCAgent.Visible = true;
            }
        }
        catch (Exception ex)
        {
            DisplayError("Specify the correct service name in the filters. See 'Administration > System Settings'." + ex.Message);
        }
    }