Example #1
0
        //private void addCollection() {
        //    col.Add(new Oid("1.3.6.1.2.1.1.1.0"), new OctetString("Test string"));
        //    col.Add(new Oid("1.3.6.1.2.1.1.2.0"), new Oid("1.3.6.1.9.1.1.0"));
        //    col.Add(new Oid("1.3.6.1.2.1.1.3.0"), new TimeTicks(2324));
        //    col.Add(new Oid("1.3.6.1.2.1.1.4.0"), new OctetString("Milan"));
        //}

        private void notifyButton_Click(object sender, EventArgs e)
        {
            //addCollection();
            col.Add(new Oid(textBoxOID.Text), new OctetString(textBoxValue.Text));
            agent.SendV2Trap(new IpAddress(textBoxIpAddress.Text), Int32.Parse(textBoxPort.Text), textBoxCommunity.Text, 13433,
                             new Oid(textBoxOID.Text), col);
            col.Clear();
        }
Example #2
0
        /// <summary>
        /// Send a trap at the IP specified.
        /// </summary>
        /// <param name="trapReceiverIp">IP of the recipient</param>
        /// <param name="trapReceiverPort">The port of the recipient</param>
        /// <param name="oidTrap"></param>
        /// <param name="oidCollection"></param>
        public static void SendTrap(string trapReceiverIp, int trapReceiverPort, Oid oidTrap, VbCollection oidCollection)
        {
            TrapAgent agent = new TrapAgent();

            agent.SendV2Trap(new IpAddress(trapReceiverIp), trapReceiverPort, AxisOidsHelper.Community, 13433, oidTrap, oidCollection);
        }