internal void Remove(MonitorInput monitorInput)
    {
        int index = inputs.IndexOf(monitorInput);

        subject.inputs.RemoveAt(index);
        //subject.colors.RemoveAt(index);
    }
    public void Add()
    {
        MonitorInput newO = Instantiate(prefab, content);

        newO.panel = this;
        newO.transform.SetAsLastSibling();
        subject.inputs.Add(null);
        newO.image.color = subject.colors[inputs.Count];
        inputs.Add(newO);
        //subject.colors.Add(Color.black);
    }
Exemplo n.º 3
0
 void Awake()
 {
     monitor = new Monitor("My monitor");
     highWaveMonitorInput = new MonitorInput(monitor, "high wave", Color.red);
     lowWaveMonitorInput  = new MonitorInput(monitor, "low wave", Color.magenta);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Touch all the properties of all any input
        /// </summary>
        /// <param name="input">The Input</param>
        private void TouchSpecificInput(Input input)
        {
            InputKind      inputKind      = input.GetKind();
            TcpConnections tcpConnections = null;
            UdpConnections udpConnections = null;

            string[] dummyStrings;
            string   dummyString;
            bool     dummyBoolean;
            DateTime dummyDate;
            int      dummyInt;

            if (inputKind.Equals(InputKind.Monitor))
            {
                MonitorInput monitorInput = (MonitorInput)input;
                dummyString  = monitorInput.Blacklist;
                dummyString  = monitorInput.CrcSalt;
                dummyInt     = monitorInput.FileCount;
                dummyBoolean = monitorInput.FollowTail;
                dummyString  = monitorInput.Host;
                dummyString  = monitorInput.HostRegex;
                dummyString  = monitorInput.IgnoreOlderThan;
                dummyString  = monitorInput.Index;
                dummyString  = monitorInput.Queue;
                dummyBoolean = monitorInput.IsRecursive;
                dummyString  = monitorInput.Source;
                dummyString  = monitorInput.SourceType;
                dummyInt     = monitorInput.TimeBeforeClose;
                dummyString  = monitorInput.Whitelist;
            }
            else if (inputKind.Equals(InputKind.Script))
            {
                ScriptInput scriptInput = (ScriptInput)input;
                dummyDate   = scriptInput.EndTime;
                dummyString = scriptInput.Group;
                dummyString = scriptInput.Host;
                dummyString = scriptInput.Index;
                dummyString = scriptInput.Interval;
                dummyDate   = scriptInput.StartTime;
            }
            else if (inputKind.Equals(InputKind.Tcp))
            {
                TcpInput tcpInput = (TcpInput)input;
                dummyString    = tcpInput.ConnectionHost;
                dummyString    = tcpInput.Group;
                dummyString    = tcpInput.Host;
                dummyString    = tcpInput.Index;
                dummyString    = tcpInput.Queue;
                dummyString    = tcpInput.RestrictToHost;
                dummyString    = tcpInput.Source;
                dummyString    = tcpInput.SourceType;
                dummyBoolean   = tcpInput.SSL;
                tcpConnections = tcpInput.Connections();
                dummyString    = tcpConnections.Connection;
                dummyString    = tcpConnections.Servername;
            }
            else if (inputKind.Equals(InputKind.TcpSplunk))
            {
                TcpSplunkInput tcpSplunkInput = (TcpSplunkInput)input;
                dummyString    = tcpSplunkInput.ConnectionHost;
                dummyString    = tcpSplunkInput.Group;
                dummyString    = tcpSplunkInput.Host;
                dummyString    = tcpSplunkInput.Index;
                dummyString    = tcpSplunkInput.Queue;
                dummyString    = tcpSplunkInput.Source;
                dummyString    = tcpSplunkInput.SourceType;
                dummyBoolean   = tcpSplunkInput.SSL;
                tcpConnections = tcpSplunkInput.Connections();
                dummyString    = tcpConnections.Connection;
                dummyString    = tcpConnections.Servername;
            }
            else if (inputKind.Equals(InputKind.Udp))
            {
                UdpInput udpInput = (UdpInput)input;
                dummyString    = udpInput.ConnectionHost;
                dummyString    = udpInput.Group;
                dummyString    = udpInput.Host;
                dummyString    = udpInput.Index;
                dummyString    = udpInput.Queue;
                dummyString    = udpInput.Source;
                dummyString    = udpInput.SourceType;
                dummyBoolean   = udpInput.NoAppendingTimeStamp;
                dummyBoolean   = udpInput.NoPriorityStripping;
                udpConnections = udpInput.Connections();
                dummyString    = udpConnections.Group;
            }
            else if (inputKind.Equals(InputKind.WindowsActiveDirectory))
            {
                WindowsActiveDirectoryInput windowsActiveDirectoryInput = (WindowsActiveDirectoryInput)input;
                dummyString  = windowsActiveDirectoryInput.Index;
                dummyBoolean = windowsActiveDirectoryInput.MonitorSubtree;
                dummyString  = windowsActiveDirectoryInput.StartingNode;
                dummyString  = windowsActiveDirectoryInput.TargetDc;
            }
            else if (inputKind.Equals(InputKind.WindowsEventLog))
            {
                WindowsEventLogInput windowsEventLogInput = (WindowsEventLogInput)input;
                dummyString  = windowsEventLogInput.Hosts;
                dummyString  = windowsEventLogInput.Index;
                dummyString  = windowsEventLogInput.LocalName;
                dummyStrings = windowsEventLogInput.Logs;
                dummyString  = windowsEventLogInput.LookupHost;
            }
            else if (inputKind.Equals(InputKind.WindowsPerfmon))
            {
                WindowsPerfmonInput windowsPerfmonInput = (WindowsPerfmonInput)input;
                dummyStrings = windowsPerfmonInput.Counters;
                dummyString  = windowsPerfmonInput.Index;
                dummyStrings = windowsPerfmonInput.Instances;
                dummyInt     = windowsPerfmonInput.Interval;
                dummyString  = windowsPerfmonInput.Object;
            }
            else if (inputKind.Equals(InputKind.WindowsRegistry))
            {
                WindowsRegistryInput windowsRegistryInput = (WindowsRegistryInput)input;
                dummyBoolean = windowsRegistryInput.Baseline;
                dummyString  = windowsRegistryInput.Hive;
                dummyString  = windowsRegistryInput.Index;
                dummyBoolean = windowsRegistryInput.MonitorSubnodes;
                dummyString  = windowsRegistryInput.Proc;
                dummyStrings = windowsRegistryInput.Type;
            }
            else if (inputKind.Equals(InputKind.WindowsWmi))
            {
                WindowsWmiInput windowsWmiInput = (WindowsWmiInput)input;
                dummyString  = windowsWmiInput.Classes;
                dummyStrings = windowsWmiInput.Fields;
                dummyString  = windowsWmiInput.Index;
                dummyStrings = windowsWmiInput.Instances;
                dummyInt     = windowsWmiInput.Interval;
                dummyString  = windowsWmiInput.LocalName;
                dummyString  = windowsWmiInput.LookupHost;
                dummyString  = windowsWmiInput.Servers;
                dummyString  = windowsWmiInput.Wql;
            }
            else
            {
                Assert.Fail();
            }
        }
Exemplo n.º 5
0
        public void MonitorInputCRUD()
        {
            Service         service         = Connect();
            InputCollection inputCollection = service.GetInputs();
            ServiceInfo     info            = service.GetInfo();

            // CRUD Monitor input
            string filename;

            if (info.OsName.Equals("Windows"))
            {
                filename = "C:\\Windows\\WindowsUpdate.log"; // normally here
            }
            else if (info.OsName.Equals("Linux"))
            {
                filename = "/var/log/syslog";
            }
            else if (info.OsName.Equals("Darwin"))
            {
                filename = "/var/log/system.log";
            }
            else
            {
                throw new Exception("OS: " + info.OsName + " not supported");
            }

            if (inputCollection.ContainsKey(filename))
            {
                inputCollection.Remove(filename);
            }

            inputCollection.Create(filename, InputKind.Monitor);
            Assert.IsTrue(inputCollection.ContainsKey(filename));
            MonitorInput monitorInput = (MonitorInput)inputCollection.Get(filename);

            monitorInput.Blacklist  = "phonyregex*1";
            monitorInput.CheckIndex = true;
            monitorInput.CheckPath  = true;
            if (service.VersionCompare("4.2.1") >= 0)
            {
                monitorInput.CrcSalt         = "ThisIsSalt";
                monitorInput.IgnoreOlderThan = "1d";
                monitorInput.TimeBeforeClose = 120;
            }

            monitorInput.FollowTail   = false;
            monitorInput.Host         = "three.four.com";
            monitorInput.HostRegex    = "host*regex*";
            monitorInput.HostSegment  = string.Empty;
            monitorInput.Index        = "main";
            monitorInput.IsRecursive  = false;
            monitorInput.RenameSource = "renamedSource";
            monitorInput.SourceType   = "monitor";
            monitorInput.Whitelist    = "phonyregex*2";
            String index = monitorInput.Index;

            monitorInput.Update();

            //monitorInput.Disable();
            // some attributes are write only; check what we can.
            Assert.AreEqual("phonyregex*1", monitorInput.Blacklist, assertRoot + "#1");
            Assert.IsFalse(monitorInput.FollowTail, assertRoot + "#2");
            Assert.AreEqual("three.four.com", monitorInput.Host, assertRoot + "#3");
            Assert.AreEqual("host*regex*", monitorInput.HostRegex, assertRoot + "#4");
            if (service.VersionCompare("4.2.1") >= 0)
            {
                Assert.AreEqual("1d", monitorInput.IgnoreOlderThan, assertRoot + "#4");
                Assert.AreEqual(120, monitorInput.TimeBeforeClose, assertRoot + "#5");
            }
            Assert.AreEqual("main", index, assertRoot + "#6");
            Assert.IsFalse(monitorInput.IsRecursive, assertRoot + "#7");
            Assert.AreEqual("renamedSource", monitorInput.Source, assertRoot + "#8");
            Assert.AreEqual("monitor", monitorInput.SourceType, assertRoot + "#9");
            Assert.AreEqual("phonyregex*2", monitorInput.Whitelist, assertRoot + "#10");

            monitorInput.Disable();

            monitorInput.Remove();
            inputCollection.Refresh();
            inputCollection.Refresh();
            Assert.IsFalse(inputCollection.ContainsKey(filename), assertRoot + "#10");
        }