示例#1
0
        public static MonitorState GetCollectorHostState(CollectorHost entry, string hostAddressOverride, int portNumberOverride)
        {
            BasicHttpBinding myBinding  = new BasicHttpBinding();
            EndpointAddress  myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QuickMonRemoteHost", hostAddressOverride, portNumberOverride));
            ChannelFactory <IRemoteCollectorHostService> myChannelFactory = new ChannelFactory <IRemoteCollectorHostService>(myBinding, myEndpoint);
            IRemoteCollectorHostService relay = myChannelFactory.CreateChannel();

            RemoteCollectorHost colReq = new RemoteCollectorHost();

            colReq.FromCollectorHost(entry);
            return(relay.GetState(colReq));
        }
示例#2
0
        //public static System.Data.DataSet GetRemoteHostAllAgentDetails(CollectorHost entry)
        //{
        //    return GetRemoteHostAllAgentDetails(entry, entry.RemoteAgentHostAddress, entry.RemoteAgentHostPort);
        //}
        //public static System.Data.DataSet GetRemoteHostAllAgentDetails(CollectorHost entry, string hostAddressOverride, int portNumberOverride)
        //{
        //    BasicHttpBinding myBinding = new BasicHttpBinding();
        //    myBinding.MaxReceivedMessageSize = 2147483647;
        //    EndpointAddress myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QuickMonRemoteHost", hostAddressOverride, portNumberOverride));
        //    ChannelFactory<IRemoteCollectorHostService> myChannelFactory = new ChannelFactory<IRemoteCollectorHostService>(myBinding, myEndpoint);
        //    IRemoteCollectorHostService relay = myChannelFactory.CreateChannel();

        //    RemoteCollectorHost colReq = new RemoteCollectorHost();
        //    colReq.FromCollectorHost(entry);
        //    return relay.GetCollectorHostDetails(colReq);
        //}
        //public static System.Data.DataSet GetRemoteHostAgentDetails(string collectorAgentConfig, string hostAddressOverride, int portNumberOverride)
        //{
        //    BasicHttpBinding myBinding = new BasicHttpBinding();
        //    EndpointAddress myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QuickMonRemoteHost", hostAddressOverride, portNumberOverride));
        //    ChannelFactory<IRemoteCollectorHostService> myChannelFactory = new ChannelFactory<IRemoteCollectorHostService>(myBinding, myEndpoint);
        //    IRemoteCollectorHostService relay = myChannelFactory.CreateChannel();
        //    return relay.GetAgentDetails(collectorAgentConfig);
        //}
        public static List <string> GetCurrentMonitorPacks(string hostAddressOverride, int portNumberOverride)
        {
            BasicHttpBinding myBinding = new BasicHttpBinding();

            myBinding.MaxReceivedMessageSize = 2147483647;
            EndpointAddress myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QuickMonRemoteHost", hostAddressOverride, portNumberOverride));
            ChannelFactory <IRemoteCollectorHostService> myChannelFactory = new ChannelFactory <IRemoteCollectorHostService>(myBinding, myEndpoint);
            IRemoteCollectorHostService relay = myChannelFactory.CreateChannel();

            RemoteCollectorHost colReq = new RemoteCollectorHost();

            return(relay.GetCurrentMonitorPacks());
        }
示例#3
0
        public static System.Data.DataSet GetRemoteHostAllAgentDetails(CollectorHost entry, string hostAddressOverride, int portNumberOverride)
        {
            BasicHttpBinding myBinding = new BasicHttpBinding();

            myBinding.MaxReceivedMessageSize = 2147483647;
            EndpointAddress myEndpoint = new EndpointAddress(string.Format("http://{0}:{1}/QuickMonRemoteHost", hostAddressOverride, portNumberOverride));
            ChannelFactory <IRemoteCollectorHostService> myChannelFactory = new ChannelFactory <IRemoteCollectorHostService>(myBinding, myEndpoint);
            IRemoteCollectorHostService relay = myChannelFactory.CreateChannel();

            RemoteCollectorHost colReq = new RemoteCollectorHost();

            colReq.FromCollectorHost(entry);
            return(relay.GetCollectorHostDetails(colReq));
        }
示例#4
0
        public void CollectorHostToRemoteCollectorHostConversionTest()
        {
            string configXml = "<collectorHosts>\r\n" +
                               "<collectorHost uniqueId=\"1234\" name=\"Ping test\" enabled=\"True\" expandOnStart=\"True\" dependOnParentId=\"\" " +
                               "agentCheckSequence=\"All\" childCheckBehaviour=\"OnlyRunOnSuccess\" " +
                               "repeatAlertInXMin=\"0\" alertOnceInXMin=\"0\" delayErrWarnAlertForXSec=\"0\" " +
                               "repeatAlertInXPolls=\"0\" alertOnceInXPolls=\"0\" delayErrWarnAlertForXPolls=\"0\" " +
                               "correctiveScriptDisabled=\"False\" correctiveScriptOnWarningPath=\"\" correctiveScriptOnErrorPath=\"\" " +
                               "restorationScriptPath=\"\" correctiveScriptsOnlyOnStateChange=\"True\" enableRemoteExecute=\"False\" " +
                               "forceRemoteExcuteOnChildCollectors=\"True\" remoteAgentHostAddress=\"\" remoteAgentHostPort=\"48181\" " +
                               "blockParentRemoteAgentHostSettings=\"False\" runLocalOnRemoteHostConnectionFailure=\"False\" " +
                               "enabledPollingOverride=\"False\" onlyAllowUpdateOncePerXSec=\"1\" enablePollFrequencySliding=\"False\" " +
                               "pollSlideFrequencyAfterFirstRepeatSec=\"2\" pollSlideFrequencyAfterSecondRepeatSec=\"5\" " +
                               "pollSlideFrequencyAfterThirdRepeatSec=\"30\">\r\n" +
                               "<collectorAgents>\r\n" +
                               "<collectorAgent type=\"PingCollector\">\r\n" +
                               "<config>\r\n" +
                               "<entries>\r\n" +
                               "<entry pingMethod=\"Ping\" address=\"localhost\" />\r\n" +
                               "</entries>\r\n" +
                               "</config>\r\n" +
                               "</collectorAgent>\r\n" +
                               "</collectorAgents>\r\n" +
                               "</collectorHost>\r\n" +
                               "</collectorHosts>";
            List <CollectorHost> chList = CollectorHost.GetCollectorHostsFromString(configXml);

            Assert.IsNotNull(chList, "CollectorHost list is null");
            if (chList != null)
            {
                RemoteCollectorHost rch = new RemoteCollectorHost();
                rch.FromCollectorHost(chList[0]);
                Assert.AreEqual(1, rch.Agents.Count, "Expected 1 Agent - " + rch.ToCollectorHostXml());
                Assert.AreNotEqual("", rch.ToCollectorHostXml(), "RemoteCollectorHost.FromCollectorHost is empty");
                if (rch.Agents.Count == 1)
                {
                    Assert.AreEqual("PingCollector", rch.Agents[0].TypeName, "Type should be PingCollector");
                    Assert.AreNotEqual(0, rch.Agents[0].ConfigString.Length, "Agent config must not be blank");
                }
            }
        }