Operating System - HP-UX
1834017 Members
2472 Online
110063 Solutions
New Discussion

Re: How to get n/w card statistics

 
Prakash Achuthan
Occasional Advisor

How to get n/w card statistics

Hi,

Is there a way i can get the following statistics from my C++ program ?

1)Packets received
2)Receive errors
3)Packets transmitted
4)Transmit errors

Thanks,
Prakash
7 REPLIES 7
Michael Tully
Honored Contributor

Re: How to get n/w card statistics

Hi,

You use the lanadmin menu based program or netstat to get some stats. I not know of a way to do this via the command line using any C program.
You could also use glance and measureware to
get some performance stats.

Have a look at this link:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x29fc5e938a10d6118ff40090279cd0f9,00.html

-Michael
Anyone for a Mutiny ?
Ron Kinner
Honored Contributor

Re: How to get n/w card statistics

SNMP can get these for you. I'm not sure of the syntax but if you read up on it you can get it to work. If you want to see how it's done get MRTG. The default setup just does bytes in and out but with a little minor configuration it will pick up and graph any SNMP variable.

http://people.ee.ethz.ch/~oetiker/webtools/mrtg/

It's free and it works well on UNIX or WinNT.

Ron
Ron Kinner
Honored Contributor

Re: How to get n/w card statistics

Come to think of it there is no reason you couldn't just let MRTG run and use your C++ program to read the logfiles.

Ron
Eric Ladner
Trusted Contributor

Re: How to get n/w card statistics

netstat -s (per protocol, tcp, udp, etc.)

netstat -I (packet in and out counts, no errors)
Prakash Achuthan
Occasional Advisor

Re: How to get n/w card statistics

Hi Eric,

On HPUX 11i netstat -I shows only the incoming packets & outgoing packets. It doesn't show the collision and errors.

$ netstat -I lan0
Name Mtu Network Address Ipkts Opkts
lan0 1500 15.70.177.0 nask5 216315 148912

lanadmin shows all the lan info, but only in menu mode.

regards,
Prakash.
Steven Sim Kok Leong
Honored Contributor

Re: How to get n/w card statistics

Hi,

# netstat -s

Hope this helps. Regards.

Steven Sim Kok Leong
Bill Hassell
Honored Contributor

Re: How to get n/w card statistics

Just a note: lanadmin can run on the command line too:

echo "l\np 0\nd\n" | /usr/sbin/lanadmin

Change p 0 to p 1 or p 3 for each of your LAN interfaces.


Bill Hassell, sysadmin