> -----Original Message-----
> From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, 28 February 2004 4:00 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Module to pull Netstat summary information?
> 
> Please bottom post....
> 
> > This works however I was hoping perl had a module so I 
> didn't have to
> run a system application.  I've been playing around with 
> modules such as
> scp, telnet and ftp.  I'm curious if there is one for netstat.
> > 
> > thanks :-)
> > > I am still new to working with Perl myself but I think I 
> know the anwer 
> > > to this one...
> > > 
> > > #!/bin/perl
> > > 
> > > use strict;
> > > use warnings;
> > > 
> > > my $cmd = system('netstat -s')or die "Could not run command: $1";
> > > my $cmd = system('netstat -a | grep tcp')or die "Could not run
> command: $1";
> > > 
> > > HTH
> > > Jas
> > > 
> > > [EMAIL PROTECTED] wrote:
> > > 
> > > > Is there a CPAN module to pull netstat summary 
> information from a
> system?
> > > > 
> > > > Rather than run 'netstat -s', I was hoping to find some 
> way within
> perl.
> > > > 
> > > > What I basically want to do is generate a couple of reports from
> the summary 
> > > output.  ICMP and TCP information.  If someone can point me in the
> right 
> > > direction I should be good to go :-)
> > > > 
> > > > Thanks
> > > 
> > > 
> 
> It appears netstat just reads the values from /proc/net and 
> prints them
> in a nice way, so presumably you could use standard opens on the /proc
> files and read specifically what you want rather than having netstat
> parse them for you.  Though this might actually be one of the places
> where shelling out makes sense.  CPAN didn't turn up much...

/proc is not available on most OS's.  Mind you 'netstat'  isn't worth
much on some of them either.

Are you developing for Linux?  A generic Linux PROC handler might
be they way you go.  Want to achieve CPAN developer status?  :-)



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to