Thanks to all who replied: I decided to keep my scripts which uses
netstat -i, Also, I added snoop to the script which will provides more
information. Furthermore. I plan to explore the following site;
www.sun.com/sun-on-net/performance/se3
Once agian many thanks to my SUN gurus and comrades;
Original posting:
> Hi SUN gurus:
>
> Occasionally, we experience network performance issues. So, I am in
> process of writing a script using " netstat -i " to monitor and log
> network activities. Although, I need to use the "date " command since
"
> netstat -i" does not time stamp its entries. Is there a better way
> (command) to do this ?? Thanks in advance..alex
################################################
################################################
Steve Phelps [phelpss@ozemail.com.au] Wrote:
You might want to try a public domain package called nocol, available
from
anon ftp at:
ftp.navya.com
in the file /pub/nocol-4.01.tar.Z
run the perl script hostmon-client on the host you want to monitor
netstat
output on.
################################################
################################################
Mark_Conroy@em.fcnbd.com wrote:
I use the following to insert the date and to log the output to a
file:
date >> /performance/network.stats.`date +%b%d` &
netstat -i >> /performance/network.stats.`date +%b%d`
Kenneth Ash [knash@ti.com] wrote:
Take a look at the man page for 'sar'. Its output is normally time
stamped.
Also, it has numerous options for gathering different information
################################################
################################################
V. Q. Hoang [vqh@dw.lucent.com] wrote:
# Save output from 'netstat -s'
# This program loops and save the output from 'netstat -s' in one file
# per day.
#
$datadir = "/var/spool/netstats";
while (1) {
$data = "";
$cur_time = time;
open(IF, "/bin/netstat -s |") || exit(1);
while (<IF>) {
next unless /=/;
chop;
s/=/ = /g;
s/^\s+//;
@a = split(/\s+/);
while ($x = shift(@a)) {
next unless ($x eq '=');
$x = shift(@a);
$data .= ":$x";
}
}
close(IF);
($sec, $min, $hr, $mday, $mon, $yr, $wday) =
localtime($cur_time);
$filename = sprintf("%02d%02d%02d.data", $yr, $mon+1, $mday);
open(OF, ">>$datadir/$filename") || exit (2);
print OF "$cur_time$data\n";
close(OF);
sleep(600);
}
################################################
################################################
Peter Polasek [pete@cobra.brass.com] wrote:
case ${FUNC_SEL_NETLOAD}:
set remote_command = "netstat -i; sleep $NETLOAD_INTERVAL; netstat
-i"
breaksw
else if ($func_code == $FUNC_SEL_NETLOAD) then
# evaluate results for each interface in list
foreach interface ($NETLOAD_IF_LIST)
# Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs
Collis Queue
# le0 1500 200.0.1.0 cheetah 28828 0 6498 0
568 0
set net_res = (`awk '$1==i {print $5,$6,$7,$8,$9,$10}'
i="$interface" $results_file`)
if ($#net_res == 12) then
@ Ipkts1 = $net_res[1]; @ Ipkts2 = $net_res[7];
@ Ierrs1 = $net_res[2]; @ Ierrs2 = $net_res[8];
@ Opkts1 = $net_res[3]; @ Opkts2 = $net_res[9];
@ Oerrs1 = $net_res[4]; @ Oerrs2 = $net_res[10];
@ Collis1= $net_res[5]; @ Collis2= $net_res[11];
@ Queue1 = $net_res[6]; @ Queue2 = $net_res[12];
# compute collision percent for this interval
if ($Opkts1 != $Opkts2) then
@ coll_perc_int = (($Collis2 - $Collis1) * 100) / ($Opkts2 -
$Opkts1)
else
@ coll_perc_int = 0
endif
if ($coll_perc_int > $NETLOAD_COLL_INT) then
echo "$msg_hdr WARNING: $interface 'interval' collision rate of
${coll_perc_int}% exceeds limit of $NETLOAD_COLL_INT"
endif
# compute sustained collision percent rate (since last reboot)
if ($Opkts2) then
@ coll_perc_avg = ($Collis2 * 100) / $Opkts2
else
@ coll_perc_avg = 0
endif
if ($coll_perc_avg > $NETLOAD_COLL_AVG) then
echo "$msg_hdr WARNING: $interface 'sustained' collision rate of
${coll_perc_avg}% exceeds limit of $NETLOAD_COLL_AVG"
endif
Alex Farajian
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:12:46 CDT