LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-28-2006, 08:42 AM   #1
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Rep: Reputation: 0
Question SNMP IF-MIB counters


Hi,
I'm implementing an SNMP agent on Linux and want to get the following IF-MIB counters for Ethernet interfaces from the network device drivers: ifInUcastPkts, ifInMulticastPkts, ifInBroadcastPkts, ifOutUcastPkts, ifOutMulticastPkts, ifOutBroadcastPkts. I've looked at the /proc/net/dev info and it looks like it provides total packets, but does not break them down between unicast, multicast and broadcast. Is there any way to find this information (without rewriting the drivers)?
[on soapbox] It seems strange to me that some of these counters have been part of the original MIB-II (RFC 1213) Internet Standard since before 1991, and yet Unix doesn't seem to support them. Is the Linux community not aware of the IAB/IETF? [off soapbox]
Ken
 
Old 03-28-2006, 08:49 AM   #2
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
On www.net-snmp.org , I see some tutorials said how to implement SNMP agent ( and agentx ) on Linux / Unix . If I'm not mistaken , this site introduces IF-MIB too .
 
Old 03-28-2006, 08:53 AM   #3
nguyennh
Member
 
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106

Rep: Reputation: 15
By the way , I wonder that do you code your agent(x) from scratch ? It means that do you have to create your MIB-tree instead of using existing IF-MIB ?
 
Old 03-28-2006, 09:06 AM   #4
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
The SNMP agent is not the issue... Linux is.

We have a commercial SNMP agent that works just fine. The SNMP part is not the issue. Getting the correct values out of Linux is what I'm asking for help with.
Ken
 
Old 03-28-2006, 07:04 PM   #5
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
This may be no different from what you get now, but does 'netstat -s' show what you want? I believe it parses from /proc/net/snmp.
On Solaris now, or I'd test first......well, maybe.
 
Old 03-29-2006, 06:30 AM   #6
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
netstat shows the network layer counters: IP, ICMP, TCP and UDP. I'm looking for the datalink layer counters for Ethernet. ifconfig -a shows what Linux is willing to collect; that is the total packet count, but not the breakdown that SNMP wants. If we look at /proc/net/dev, on versions after 2.2, there is a receive multicast counter (that doesn't show up on ifconfig -a) that is a step in the right direction, but that still doesn't allow me to calculate unicast packets, because I don't know the broadcast count (unless the "packets" value does not include broadcast).
Is there a man page (or other form of documentation) somewhere that explains the meaning of the fields in /proc/net/dev?
 
Old 03-29-2006, 01:01 PM   #7
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
Here:
http://www.linuxdevcenter.com/pub/a/...inuxAdmin.html
 
1 members found this post helpful.
Old 03-30-2006, 06:59 AM   #8
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
Jules,
Thanks for the pointer. It has a little more info but still doesn't tell me if the multicast counter includes broadcasts or not.
I got kinda excited when I read "If you're [...] hungry for more network-related configuration and statistical information, you should explore the /proc/sys/net/ directory." I went there and found /proc/sys/net/ethernet/! But, alas there is nothing in it (on 2 different Linux systems). Another blind lead. :^(
Looks like I have to learn how to patch the drivers.
Ken
 
Old 03-30-2006, 12:14 PM   #9
RHELL
Member
 
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
Weird, wonder if it's a kernel option.

I once used a perl snmp module and socket module for this kind of stuff, but it's been a long time, so the details have eroded.

Last edited by RHELL; 03-30-2006 at 12:45 PM.
 
Old 03-30-2006, 05:06 PM   #10
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
I've been digging into the drivers. On the old Linux (2.4.21) port to the PowerPC that we are using on one product, I can't even figure out how to get at the MAC address to see if it is a multicast or a broadcast. However in the version of Red Hat that we are using on another product (2.6.9), I have found all the counters (burried deep in the driver) and they are 64-bit values (which is what the lastest IF-MIB asks for). Now I just need to figure out how to get them out to the user process. Any ioctl gurus out there? (It's new turf for me.)
 
Old 05-02-2006, 06:49 AM   #11
Ken Chapman
LQ Newbie
 
Registered: Mar 2006
Posts: 6

Original Poster
Rep: Reputation: 0
I am able to expose the counters on Red Hat 2.6.9. :^) I've created a /proc/net/dev_ifmib "file" which shows the 64-bit Ethernet counters needed to support the IF-MIB. (I only did it for the Ethernet so far. I don't have a need for other interface types yet.) My question now is, "How do I submit my enhancement so that it can become part of all furture releases?" It seems to me that others may want this code and I'd like it to be available on "off the shelf" platforms (without needing to build a special kernel).
ps, I tried to read the MAC address and count the packets on our PowerPC platform (2.4.21), but for some reason that totally eludes me, it causes the kernel to hang. :^(

Last edited by Ken Chapman; 05-02-2006 at 06:53 AM.
 
Old 02-19-2013, 12:41 PM   #12
yoave
LQ Newbie
 
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
rx/tx mcast, bcast and ucast counters

may you elaborate about exposing/retrieving counters for Ethernet interfaces from the network device drivers: ifInUcastPkts, ifInMulticastPkts, ifInBroadcastPkts, ifOutUcastPkts, ifOutMulticastPkts, ifOutBroadcastPkts
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MIB and SNMP allomeen Programming 2 01-17-2006 10:23 AM
Retrieving SNMP MIB basu_arani Programming 0 02-09-2005 06:21 AM
snmp mib ody1 Programming 0 01-09-2005 09:31 AM
SNMP MIB browser glock19 Linux - Networking 1 03-28-2003 03:26 AM
SNMP MIB question arffer Linux - Networking 2 10-30-2000 04:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration