[HPADM] Summary : HP-Ux equivalent for "netstat -atcnp" & checking NIC bandwidth utilization
- From: sunhux G <sunhux@xxxxxxxxx>
- Date: Sat, 4 Dec 2010 17:41:16 +0800
Wonderful replies below.
I liked the Perl script very much
U
===================================================
Secondly, my HP-UX doesn't have lsof & it's a bit difficult for me to getChange approval to install one.
Actually, HP does have it (now).
https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1123
https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1131
Because it comes from the official HP software site, it makes the change
control police more accepting.
lsof, rsync, and sudo are all mandatory for my systems, and they all come
from the HP site.
Bill
==================================
==================================
The answer to question Q2 is found here:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/lsof-4.84/
For question Q1, would netperf be a good option for you?
http://hpux.connect.org.uk/hppd/hpux/Networking/Admin/netperf-1.7.1/
I hope this helps,
Steve Illgen
==================================
Check out lanadmin in menu mode. I'm not sure how to get it from the
immediate mode.
For your second one check out netstat -a or netstat -p tcp if you only
wants stats for tcp ports.
Jeff Cleverly
==================================
sof is available for HP-UX at the HP software depot (for 11iV2 and later)
and at the HP-UX Porting and Archive center. I definitely recommend
downloading it – it is as useful on HP-UX as it is on Linux and Solaris.
The main tool for networking is “lanadmin”. If you review the man page it
has a section on statistics. I don’t know that it has exactly what you
want but it will probably be the closest you’ll get. The netstat on HP-UX
is not as robust as the one on Linux.
Jeff Lightner
==================================
Hi,
for Q1:
You can allways use glance or performance agent, if you have them installed?
if note there is a really nice perl script, that tells you the actual live
bandwith
It gives you this kind of output, if you are interested I can send it over,
let me know
root@on:/usr/local/bin> ./Netbandwith.pl # see below
Network ststistics
kbits/s packets/s kbits/pkt
In:Out In:Out In:Out
846.323 : 2.475 360 : 3 2.35 : 0.83
951.211 : 0.241 364 : 0 2.61 : 1.20
You also have netperf, but it's more a benchmarker/troubleshooter than a
network live monitor
#!/opt/perl/bin/perl -w
#
# Author Tim@xxxxxxxxxxx
# Date 18 Apr 2002
# Purpose Uses netstat to find out packets/s & kbit/s in & out
# Bugs None yet!
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Tim Fulford may not respond to external queries
# regarding the distribution or content of this file.
#
sub get_data {
my $if = shift;
if ( ! $if ) {
$if=0;
}
my $cmd = sprintf("echo 'lan\nppa %d\ndisplay\n' |
/usr/sbin/lanadmin 2>&1", $if);
open(CMD, "$cmd |") or die "could not run lanadmin: $!";
while(<CMD>) {
chomp();
if (/^Inbound Octets/) {
($pad, $ioctets) = split(/=/);
} elsif (/^Outbound Octets/) {
($pad, $ooctets) = split(/=/);
} elsif (/^Inbound Unicast Packets/) {
($pad, $iupkts) = split(/=/);
} elsif (/^Outbound Unicast Packets/) {
($pad, $oupkts) = split(/=/);
} elsif (/^Inbound Non-Unicast Packets/) {
($pad, $inpkts) = split(/=/);
} elsif (/^Outbound Non-Unicast Packets/) {
($pad, $onpkts) = split(/=/);
}
}
close(CMD);
# print "$ioctets $ooctets $iupktss $inpkts $oupkts $onpkts \n";
return($ioctets, $ooctets, $iupkts+$inpkts, $oupkts+$onpkts);
}
$sl = 5;
print "Network ststistics\n";
print " kbits/s packets/s kbits/pkt\n";
print " In:Out In:Out In:Out\n";
($lastioctets, $lastooctets, $lastipackets, $lastopackets) =
&get_data($ARGV[0]);
while(1) {
sleep($sl);
($ioctets, $ooctets, $ipackets, $opackets) = &get_data($ARGV[0]);
$ikbits = ( $ioctets - $lastioctets ) / 128 / $sl ;
$okbits = ( $ooctets - $lastooctets ) / 128 / $sl ;
$ipktra = ( $ipackets - $lastipackets ) / $sl ;
$opktra = ( $opackets - $lastopackets ) / $sl ;
if ( $ipktra == 0 ) {
$ipktsize = 0;
} else {
$ipktsize = $ikbits / $ipktra;
}
if ( $opktra == 0 ) {
$opktsize = 0;
} else {
$opktsize = $okbits / $opktra;
}
printf("%8.3f : %8.3f %4d : %4d %7.2f : %7.2f\n", $ikbits,
$okbits, $ipktra, $opktra, $ipktsize, $opktsize);
$lastioctets = $ioctets;
$lastipackets = $ipackets;
$lastooctets = $ooctets;
$lastopackets = $opackets;
}
On Thu, Dec 2, 2010 at 11:52 PM, sunhux G <sunhux@xxxxxxxxx> wrote:
Hi
Q1:
I'm looking for a command or tool or script in HP-UX B11.11 that would
give me bandwidth utilization of a NIC (say lan0).
"netstat -i" gave input & output bytes but not the rate (ie kbits/sec or
Mbits/sec)
Q2:
Secondly, my HP-UX doesn't have lsof & it's a bit difficult for me to
get Change approval to install one. On Solaris or Linux, I can issue
the following command to find out which process/app is listening on
a specific port. Any equivalent in HP-UX?
# netstat -atcnp | grep -i listen
tcp 0 0 0.0.0.0:9990 0.0.0.0:*
LISTEN 4783/awservices
tcp 0 0 0.0.0.0:9991 0.0.0.0:*
LISTEN 4783/awservices
tcp 0 0 0.0.0.0:4105 0.0.0.0:*
LISTEN 4348/cam
tcp 0 0 127.0.0.1:2222 0.0.0.0:*
LISTEN 15877/1
tcp 0 0 127.0.0.1:3310 0.0.0.0:*
LISTEN 14810/clamd
tcp 0 0 0.0.0.0:5555 0.0.0.0:*
LISTEN 20197/xinetd
tcp 0 0 0.0.0.0:21 0.0.0.0:*
LISTEN 4565/vsftpd
tcp 0 0 172.yy.xx.xx:7774 0.0.0.0:*
LISTEN 4792/aws_orb
tcp 0 0 :::47776 :::*
LISTEN 5217/aws_agtgate
U
- Prev by Date: [HPADM] Re: HP-Ux equivalent for "netstat -atcnp" & checking NIC bandwidth utilization
- Next by Date: [HPADM] Re: HP-Ux equivalent for "netstat -atcnp" & checking NIC bandwidth utilization
- Previous by thread: [HPADM] HP-Ux equivalent for "netstat -atcnp" & checking NIC bandwidth utilization
- Next by thread: [HPADM] Difficulty reading back sar output
- Index(es):
Relevant Pages
|