niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » HP-UX
netstat - monitoring
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Satish
*nix forums beginner


Joined: 23 Aug 2005
Posts: 3

PostPosted: Thu Jul 20, 2006 5:09 am    Post subject: Re: netstat - monitoring Reply with quote

works fine for me.. thank you.

-- Satish

Jon Fife wrote:
Quote:
Satish wrote:
Hello All,

using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?

Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?

There is no option for the number of outputs....

Is there something simmilar to 'netstat 5 5' ??

Any input is appreciated..

-- Satish

I'd suggest something like:

% cat netlist.sh
#!/bin/ksh

interval=$1
iterations=$2

netstat $1 &
sleep $(expr $1 \* $2)
kill $!

%./netlist.sh 5 3
(lan1)-> input output (Total)-> input output
packets packets packets packets
-2126205170 1367052622 -2122484504 1370773288
-2126205152 1367052625 -2122484486 1370773291
-2126205128 1367052626 -2122484462 1370773292
%

HTH,

Jon
Back to top
jon.fife@gmail.com
*nix forums beginner


Joined: 07 Jun 2006
Posts: 8

PostPosted: Mon Jul 17, 2006 4:30 pm    Post subject: Re: netstat - monitoring Reply with quote

Satish wrote:
Quote:
Hello All,

using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?

Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?

There is no option for the number of outputs....

Is there something simmilar to 'netstat 5 5' ??

Any input is appreciated..

-- Satish

I'd suggest something like:

% cat netlist.sh
#!/bin/ksh

interval=$1
iterations=$2

netstat $1 &
sleep $(expr $1 \* $2)
kill $!

%./netlist.sh 5 3
(lan1)-> input output (Total)-> input output
packets packets packets packets
-2126205170 1367052622 -2122484504 1370773288
-2126205152 1367052625 -2122484486 1370773291
-2126205128 1367052626 -2122484462 1370773292
%

HTH,

Jon
Back to top
Satish
*nix forums beginner


Joined: 23 Aug 2005
Posts: 3

PostPosted: Mon Jul 17, 2006 11:07 am    Post subject: netstat - monitoring Reply with quote

Hello All,

using the command 'netstat 5' gives me continous monitoring every 5
seconds. But when I use this in scripts. How do I stop it after 10
instances?

Meaning, 'sar -u 5 5' will monitor cpu for every 5 seconds for 5 times
and STOP.
How do I do the same with netstat?

There is no option for the number of outputs....

Is there something simmilar to 'netstat 5 5' ??

Any input is appreciated..

-- Satish
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 12:48 pm | All times are GMT
navigation Forum index » *nix » HP-UX
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts monitoring Xeon temp michael Debian 0 Wed Jul 19, 2006 10:50 am
No new posts remote monitoring of mySQL Andy Ford MySQL 2 Thu Jul 06, 2006 4:05 pm
No new posts event monitoring Jo IBM DB2 1 Fri Jun 30, 2006 3:23 am
No new posts testing and monitoring time for message to leave server hbeaumont hbeaumont Qmail 2 Wed Jun 28, 2006 1:46 pm
No new posts Monitoring idle time of TCP connections C3 networking 3 Wed Jun 28, 2006 12:32 am

Society 2007 | Home Loan | Credit Card | Record Internet Radio with Tags | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2906s ][ Queries: 20 (0.1992s) ][ GZIP on - Debug on ]