Exemple #1
0
        internal static UdpGlobalStatisticsTable ParseUdpv6GlobalStatisticsFromSnmp6File(string filePath)
        {
            string          fileContents  = ReadAllText(filePath);
            RowConfigReader reader        = new RowConfigReader(fileContents);
            bool            hasUdp6Errors = fileContents.Contains("Udp6SndbufErrors");

            return(new UdpGlobalStatisticsTable()
            {
                InDatagrams = reader.GetNextValueAsInt64("Udp6InDatagrams"),
                NoPorts = reader.GetNextValueAsInt64("Udp6NoPorts"),
                InErrors = reader.GetNextValueAsInt64("Udp6InErrors"),
                OutDatagrams = reader.GetNextValueAsInt64("Udp6OutDatagrams"),
                RcvbufErrors = hasUdp6Errors ? reader.GetNextValueAsInt64("Udp6RcvbufErrors") : 0,
                SndbufErrors = hasUdp6Errors ? reader.GetNextValueAsInt64("Udp6SndbufErrors") : 0,
                InCsumErrors = hasUdp6Errors ? reader.GetNextValueAsInt64("Udp6InCsumErrors") : 0,
            });
        }
        internal static UdpGlobalStatisticsTable ParseUdpv6GlobalStatisticsFromSnmp6File(string filePath)
        {
            string          fileContents  = File.ReadAllText(filePath);
            RowConfigReader reader        = new RowConfigReader(fileContents);
            int             udp6ErrorsIdx = fileContents.IndexOf("Udp6SndbufErrors", StringComparison.Ordinal);

            return(new UdpGlobalStatisticsTable()
            {
                InDatagrams = reader.GetNextValueAsInt64("Udp6InDatagrams"),
                NoPorts = reader.GetNextValueAsInt64("Udp6NoPorts"),
                InErrors = reader.GetNextValueAsInt64("Udp6InErrors"),
                OutDatagrams = reader.GetNextValueAsInt64("Udp6OutDatagrams"),
                RcvbufErrors = udp6ErrorsIdx == -1 ? 0 : reader.GetNextValueAsInt64("Udp6RcvbufErrors"),
                SndbufErrors = udp6ErrorsIdx == -1 ? 0 : reader.GetNextValueAsInt64("Udp6SndbufErrors"),
                InCsumErrors = udp6ErrorsIdx == -1 ? 0 : reader.GetNextValueAsInt64("Udp6InCsumErrors"),
            });
        }
Exemple #3
0
        internal static IPGlobalStatisticsTable ParseIPv6GlobalStatisticsFromSnmp6File(string filePath)
        {
            // Read the remainder of statistics from snmp6.
            string          fileContents = ReadAllText(filePath);
            RowConfigReader reader       = new RowConfigReader(fileContents);

            return(new IPGlobalStatisticsTable()
            {
                InReceives = reader.GetNextValueAsInt64("Ip6InReceives"),
                InHeaderErrors = reader.GetNextValueAsInt64("Ip6InHdrErrors"),
                InAddressErrors = reader.GetNextValueAsInt64("Ip6InAddrErrors"),
                InUnknownProtocols = reader.GetNextValueAsInt64("Ip6InUnknownProtos"),
                InDiscards = reader.GetNextValueAsInt64("Ip6InDiscards"),
                InDelivers = reader.GetNextValueAsInt64("Ip6InDelivers"),
                ForwardedDatagrams = reader.GetNextValueAsInt64("Ip6OutForwDatagrams"),
                OutRequests = reader.GetNextValueAsInt64("Ip6OutRequests"),
                OutDiscards = reader.GetNextValueAsInt64("Ip6OutDiscards"),
                OutNoRoutes = reader.GetNextValueAsInt64("Ip6OutNoRoutes"),
                ReassemblyTimeout = reader.GetNextValueAsInt64("Ip6ReasmTimeout"),
                ReassemblyRequireds = reader.GetNextValueAsInt64("Ip6ReasmReqds"),
                ReassemblyOKs = reader.GetNextValueAsInt64("Ip6ReasmOKs"),
                ReassemblyFails = reader.GetNextValueAsInt64("Ip6ReasmFails"),
                FragmentOKs = reader.GetNextValueAsInt64("Ip6FragOKs"),
                FragmentFails = reader.GetNextValueAsInt64("Ip6FragFails"),
                FragmentCreates = reader.GetNextValueAsInt64("Ip6FragCreates"),
            });
        }
Exemple #4
0
        public static Icmpv6StatisticsTable ParseIcmpv6FromSnmp6File(string filePath)
        {
            string          fileContents      = ReadAllText(filePath);
            RowConfigReader reader            = new RowConfigReader(fileContents);
            bool            hasIcmp6OutErrors = fileContents.Contains("Icmp6OutErrors");

            return(new Icmpv6StatisticsTable()
            {
                InMsgs = reader.GetNextValueAsInt64("Icmp6InMsgs"),
                InErrors = reader.GetNextValueAsInt64("Icmp6InErrors"),
                OutMsgs = reader.GetNextValueAsInt64("Icmp6OutMsgs"),
                OutErrors = hasIcmp6OutErrors ? reader.GetNextValueAsInt64("Icmp6OutErrors") : 0,
                InDestUnreachs = reader.GetNextValueAsInt64("Icmp6InDestUnreachs"),
                InPktTooBigs = reader.GetNextValueAsInt64("Icmp6InPktTooBigs"),
                InTimeExcds = reader.GetNextValueAsInt64("Icmp6InTimeExcds"),
                InParmProblems = reader.GetNextValueAsInt64("Icmp6InParmProblems"),
                InEchos = reader.GetNextValueAsInt64("Icmp6InEchos"),
                InEchoReplies = reader.GetNextValueAsInt64("Icmp6InEchoReplies"),
                InGroupMembQueries = reader.GetNextValueAsInt64("Icmp6InGroupMembQueries"),
                InGroupMembResponses = reader.GetNextValueAsInt64("Icmp6InGroupMembResponses"),
                InGroupMembReductions = reader.GetNextValueAsInt64("Icmp6InGroupMembReductions"),
                InRouterSolicits = reader.GetNextValueAsInt64("Icmp6InRouterSolicits"),
                InRouterAdvertisements = reader.GetNextValueAsInt64("Icmp6InRouterAdvertisements"),
                InNeighborSolicits = reader.GetNextValueAsInt64("Icmp6InNeighborSolicits"),
                InNeighborAdvertisements = reader.GetNextValueAsInt64("Icmp6InNeighborAdvertisements"),
                InRedirects = reader.GetNextValueAsInt64("Icmp6InRedirects"),
                OutDestUnreachs = reader.GetNextValueAsInt64("Icmp6OutDestUnreachs"),
                OutPktTooBigs = reader.GetNextValueAsInt64("Icmp6OutPktTooBigs"),
                OutTimeExcds = reader.GetNextValueAsInt64("Icmp6OutTimeExcds"),
                OutParmProblems = reader.GetNextValueAsInt64("Icmp6OutParmProblems"),
                OutEchos = reader.GetNextValueAsInt64("Icmp6OutEchos"),
                OutEchoReplies = reader.GetNextValueAsInt64("Icmp6OutEchoReplies"),
                OutInGroupMembQueries = reader.GetNextValueAsInt64("Icmp6OutGroupMembQueries"),
                OutGroupMembResponses = reader.GetNextValueAsInt64("Icmp6OutGroupMembResponses"),
                OutGroupMembReductions = reader.GetNextValueAsInt64("Icmp6OutGroupMembReductions"),
                OutRouterSolicits = reader.GetNextValueAsInt64("Icmp6OutRouterSolicits"),
                OutRouterAdvertisements = reader.GetNextValueAsInt64("Icmp6OutRouterAdvertisements"),
                OutNeighborSolicits = reader.GetNextValueAsInt64("Icmp6OutNeighborSolicits"),
                OutNeighborAdvertisements = reader.GetNextValueAsInt64("Icmp6OutNeighborAdvertisements"),
                OutRedirects = reader.GetNextValueAsInt64("Icmp6OutRedirects")
            });
        }
        public static Icmpv6StatisticsTable ParseIcmpv6FromSnmp6File(string filePath)
        {
            string          fileContents      = File.ReadAllText(filePath);
            RowConfigReader reader            = new RowConfigReader(fileContents);
            int             Icmp6OutErrorsIdx = fileContents.IndexOf("Icmp6OutErrors", StringComparison.Ordinal);

            return(new Icmpv6StatisticsTable()
            {
                InMsgs = reader.GetNextValueAsInt64("Icmp6InMsgs"),
                InErrors = reader.GetNextValueAsInt64("Icmp6InErrors"),
                OutMsgs = reader.GetNextValueAsInt64("Icmp6OutMsgs"),
                OutErrors = Icmp6OutErrorsIdx == -1 ? 0 : reader.GetNextValueAsInt64("Icmp6OutErrors"),
                InDestUnreachs = reader.GetNextValueAsInt64("Icmp6InDestUnreachs"),
                InPktTooBigs = reader.GetNextValueAsInt64("Icmp6InPktTooBigs"),
                InTimeExcds = reader.GetNextValueAsInt64("Icmp6InTimeExcds"),
                InParmProblems = reader.GetNextValueAsInt64("Icmp6InParmProblems"),
                InEchos = reader.GetNextValueAsInt64("Icmp6InEchos"),
                InEchoReplies = reader.GetNextValueAsInt64("Icmp6InEchoReplies"),
                InGroupMembQueries = reader.GetNextValueAsInt64("Icmp6InGroupMembQueries"),
                InGroupMembResponses = reader.GetNextValueAsInt64("Icmp6InGroupMembResponses"),
                InGroupMembReductions = reader.GetNextValueAsInt64("Icmp6InGroupMembReductions"),
                InRouterSolicits = reader.GetNextValueAsInt64("Icmp6InRouterSolicits"),
                InRouterAdvertisements = reader.GetNextValueAsInt64("Icmp6InRouterAdvertisements"),
                InNeighborSolicits = reader.GetNextValueAsInt64("Icmp6InNeighborSolicits"),
                InNeighborAdvertisements = reader.GetNextValueAsInt64("Icmp6InNeighborAdvertisements"),
                InRedirects = reader.GetNextValueAsInt64("Icmp6InRedirects"),
                OutDestUnreachs = reader.GetNextValueAsInt64("Icmp6OutDestUnreachs"),
                OutPktTooBigs = reader.GetNextValueAsInt64("Icmp6OutPktTooBigs"),
                OutTimeExcds = reader.GetNextValueAsInt64("Icmp6OutTimeExcds"),
                OutParmProblems = reader.GetNextValueAsInt64("Icmp6OutParmProblems"),
                OutEchos = reader.GetNextValueAsInt64("Icmp6OutEchos"),
                OutEchoReplies = reader.GetNextValueAsInt64("Icmp6OutEchoReplies"),
                OutInGroupMembQueries = reader.GetNextValueAsInt64("Icmp6OutGroupMembQueries"),
                OutGroupMembResponses = reader.GetNextValueAsInt64("Icmp6OutGroupMembResponses"),
                OutGroupMembReductions = reader.GetNextValueAsInt64("Icmp6OutGroupMembReductions"),
                OutRouterSolicits = reader.GetNextValueAsInt64("Icmp6OutRouterSolicits"),
                OutRouterAdvertisements = reader.GetNextValueAsInt64("Icmp6OutRouterAdvertisements"),
                OutNeighborSolicits = reader.GetNextValueAsInt64("Icmp6OutNeighborSolicits"),
                OutNeighborAdvertisements = reader.GetNextValueAsInt64("Icmp6OutNeighborAdvertisements"),
                OutRedirects = reader.GetNextValueAsInt64("Icmp6OutRedirects")
            });
        }