[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Can someone tell me the function for getting MIB-2 object values from Debian Linux Kernel ?



Nate,

I dont know if you are looking for this information for the same purpose
that I am viz. how to get the TCP/IP/UDP/ICMP statistics being gathered in a
G4 PowerPC that is running Debian linux.

Here's what I know so far.

>From this link http://packages.debian.org/stable/net/net-tools.html, I
downloaded the source for the "netstat" application (the link for the source
code tar.gz file is in fineprint right near the bottom of the page.)
After looking at the code, files netstat.c and statistics.c , I found that
the statistics are stored (in a format described in statistics.c) in the
following files :

/proc/net/snmp
/proc/net/tcp
/proc/net/udp
/proc/net/ip
/proc/net/icmp

These files appear to be 0 bytes when you do "ls -al" but they actually
contain all the values for all of the following counters (the code is taken
from statistics.c).

( The netstat application reads these counters from the above mentioned
/proc/net files and displays them. I am still searching for those functions
which update these counters, and also how frequently are they updated - not
in real time, I guess ? )

struct entry Iptab[] =
{
    {"Forwarding", N_("Forwarding is %s"), i_forward | I_STATIC},
    {"DefaultTTL", N_("Default TTL is %u"), number | I_STATIC},
    {"InReceives", N_("%u total packets received"), number},
    {"InHdrErrors", N_("%u with invalid headers"), opt_number},
    {"InAddrErrors", N_("%u with invalid addresses"), opt_number},
    {"ForwDatagrams", N_("%u forwarded"), number},
    {"InUnknownProtos", N_("%u with unknown protocol"), opt_number},
    {"InDiscards", N_("%u incoming packets discarded"), number},
    {"InDelivers", N_("%u incoming packets delivered"), number},
    {"OutRequests", N_("%u requests sent out"), number},        /*? */
    {"OutDiscards", N_("%u outgoing packets dropped"), opt_number},
    {"OutNoRoutes", N_("%u dropped because of missing route"), opt_number},
    {"ReasmTimeout", N_("%u fragments dropped after timeout"), opt_number},
    {"ReasmReqds", N_("%u reassemblies required"), opt_number}, /* ? */
    {"ReasmOKs", N_("%u packets reassembled ok"), opt_number},
    {"ReasmFails", N_("%u packet reassembles failed"), opt_number},
    {"FragOKs", N_("%u fragments received ok"), opt_number},
    {"FragFails", N_("%u fragments failed"), opt_number},
    {"FragCreates", N_("%u fragments created"), opt_number}
};

struct entry Icmptab[] =
{
    {"InMsgs", N_("%u ICMP messages received"), number},
    {"InErrors", N_("%u input ICMP message failed."), number},
    {"InDestUnreachs", N_("destination unreachable: %u"), i_inp_icmp |
I_TITLE},
    {"InTimeExcds", N_("timeout in transit: %u"), i_inp_icmp | I_TITLE},
    {"InParmProbs", N_("wrong parameters: %u"), i_inp_icmp | I_TITLE},  /*?
*/
    {"InSrcQuenchs", N_("source quenches: %u"), i_inp_icmp | I_TITLE},
    {"InRedirects", N_("redirects: %u"), i_inp_icmp | I_TITLE},
    {"InEchos", N_("echo requests: %u"), i_inp_icmp | I_TITLE},
    {"InEchoReps", N_("echo replies: %u"), i_inp_icmp | I_TITLE},
    {"InTimestamps", N_("timestamp request: %u"), i_inp_icmp | I_TITLE},
    {"InTimestampReps", N_("timestamp reply: %u"), i_inp_icmp | I_TITLE},
    {"InAddrMasks", N_("address mask request: %u"), i_inp_icmp | I_TITLE},
/*? */
    {"InAddrMaskReps", N_("address mask replies: %u"), i_inp_icmp |
I_TITLE},   /*? */
    {"OutMsgs", N_("%u ICMP messages sent"), number},
    {"OutErrors", N_("%u ICMP messages failed"), number},
    {"OutDestUnreachs", N_("destination unreachable: %u"), i_outp_icmp |
I_TITLE},
    {"OutTimeExcds", N_("time exceeded: %u"), i_outp_icmp | I_TITLE},
    {"OutParmProbs", N_("wrong parameters: %u"), i_outp_icmp | I_TITLE},
/*? */
    {"OutSrcQuenchs", N_("source quench: %u"), i_outp_icmp | I_TITLE},
    {"OutRedirects", N_("redirect: %u"), i_outp_icmp | I_TITLE},
    {"OutEchos", N_("echo request: %u"), i_outp_icmp | I_TITLE},
    {"OutEchoReps", N_("echo replies: %u"), i_outp_icmp | I_TITLE},
    {"OutTimestamps", N_("timestamp requests: %u"), i_outp_icmp | I_TITLE},
    {"OutTimestampReps", N_("timestamp replies: %u"), i_outp_icmp |
I_TITLE},
    {"OutAddrMasks", N_("address mask requests: %u"), i_outp_icmp |
I_TITLE},
    {"OutAddrMaskReps", N_("address mask replies: %u"), i_outp_icmp |
I_TITLE},
};

struct entry Tcptab[] =
{
    {"RtoAlgorithm", N_("RTO algorithm is %s"), i_rto_alg | I_STATIC},
    {"RtoMin", "", number},
    {"RtoMax", "", number},
    {"MaxConn", "", number},
    {"ActiveOpens", N_("%u active connections openings"), number},
    {"PassiveOpens", N_("%u passive connection openings"), number},
    {"AttemptFails", N_("%u failed connection attempts"), number},
    {"EstabResets", N_("%u connection resets received"), number},
    {"CurrEstab", N_("%u connections established"), number},
    {"InSegs", N_("%u segments received"), number},
    {"OutSegs", N_("%u segments send out"), number},
    {"RetransSegs", N_("%u segments retransmited"), number},
    {"InErrs", N_("%u bad segments received."), number},
    {"OutRsts", N_("%u resets sent"), number},
};

struct entry Udptab[] =
{
    {"InDatagrams", N_("%u packets received"), number},
    {"NoPorts", N_("%u packets to unknown port received."), number},
    {"InErrors", N_("%u packet receive errors"), number},
    {"OutDatagrams", N_("%u packets sent"), number},
};




Do let me know if this helps.

Happy Computing!

Ruchir Malhotra

-----Original Message-----
From: nate [mailto:debian-user@aphroland.org]
Sent: Thursday, August 15, 2002 4:25 PM
To: debian-user@lists.debian.org
Subject: Re: Can someone tell me the function for getting MIB-2 object
values from Debian Linux Kernel ?
Importance: High


Ruchir Malhotra said:
> Hi,
> I need the IP, UDP and TCP statistics. Which function should I call ? Are
> there man pages on thse functions ?
>

if you find such information out please post it to the list,
in my quests, MIB values seem to be a holy grail which almost
nobody knows the values. I've searched for hours on the net
to try to find hints, but could never find anything other
then TCP stats which is:

.1.3.6.1.2.1.6.9.0&.1.3.6.1.2.1.6.9.0

at least it works for me under debian 2.2 & 3.0 and
kernel 2.2.19

sample output:
http://mrtg.aphroland.org/portal.aphroland.org/portal.aphroland.org.tcpopen.
html

nate




--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org





Reply to: