예제 #1
0
        public void EditMonitor_AddMonitorEditAndDelete(OutputType output)
        {
            //Add monitor
            string testName = "test ping" + Common.GenerateRandomString(5);
            string newName  = "new name";/*edit name*/

            string url = "www.yandex.ru";
            string tag = tagNew;

            int[] locationsIds           = new int[] { 4, 11 };
            var   locationsIdAndIntrvals = new Dictionary <int, ExternalMonitor.CheckInterval>();

            //edit monitor id (4 -> 5)
            locationsIdAndIntrvals.Add(5, ExternalMonitor.CheckInterval.five);
            locationsIdAndIntrvals.Add(11, ExternalMonitor.CheckInterval.fifteen);

            var resultAddMonitor = externalMonitor.AddMonitor(
                ExternalMonitor.TestType.ping,
                testName,
                url,
                ExternalMonitor.CheckInterval.five,
                tag,
                output: output,
                locationIds: locationsIds);

            monitorsToDelete.Add(resultAddMonitor.testId);

            int uptimeSLA = 10;

            //Edit monitor
            externalMonitor.EditMonitor(resultAddMonitor.testId, name: newName, url: url, locationIdIntervals: locationsIdAndIntrvals,
                                        tag: tag, uptimeSLA: uptimeSLA, output: output);
        }
        public static int AddMonitor(ExternalMonitor externalMonitor, OutputType output,bool dnsWithParams=false)
        {
            string testName = "test ping ololo: ololo;" + Common.GenerateRandomString(5);
             string tag = tagNew;
            int[] locationsIds = new int[] { 4, 11 };
            ExternalMonitor.TestType testType = ExternalMonitor.TestType.ping;
            if (dnsWithParams)
                testType = ExternalMonitor.TestType.dns;

            var testparams = new Dictionary<string, string>();
            if (dnsWithParams)
            {
                //testparams.Add("test1", "fffgfygfhgf");
                //testparams.Add("test2", "bbb");
                //testparams.Add("test3", "dddd");
                //testparams.Add("test4", "ffff");
                //testparams.Add("test5", "ffff");

                testparams.Add("server", "google.com");
                testparams.Add("expip", "209.85.148.113");
                testparams.Add("expauth", "A");
            }

            var result = externalMonitor.AddMonitor(
                testType,
                testName,
                url,
                ExternalMonitor.CheckInterval.five,
                tag,
                output: output,
                locationIds: locationsIds,
                testParams: testparams);
            return result.testId;
        }
예제 #3
0
        public static int AddMonitor(ExternalMonitor externalMonitor, OutputType output, bool dnsWithParams = false)
        {
            string testName = "test ping ololo: ololo;" + Common.GenerateRandomString(5);
            string tag      = tagNew;

            int[] locationsIds = new int[] { 4, 11 };
            ExternalMonitor.TestType testType = ExternalMonitor.TestType.ping;
            if (dnsWithParams)
            {
                testType = ExternalMonitor.TestType.dns;
            }

            var testparams = new Dictionary <string, string>();

            if (dnsWithParams)
            {
                //testparams.Add("test1", "fffgfygfhgf");
                //testparams.Add("test2", "bbb");
                //testparams.Add("test3", "dddd");
                //testparams.Add("test4", "ffff");
                //testparams.Add("test5", "ffff");

                testparams.Add("server", "google.com");
                testparams.Add("expip", "209.85.148.113");
                testparams.Add("expauth", "A");
            }

            var result = externalMonitor.AddMonitor(
                testType,
                testName,
                url,
                ExternalMonitor.CheckInterval.five,
                tag,
                output: output,
                locationIds: locationsIds,
                testParams: testparams);

            return(result.testId);
        }