Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: netstat on remote with perl (possible?)

by McA (Priest)
on Oct 24, 2013 at 14:09 UTC ( #1059468=note: print w/replies, xml ) Need Help??

in reply to netstat on remote with perl (possible?)


I don't know how the output looks like, but you can do the searching in the result also in perl itself. So have a look at your output with:

print Dumper(\@out);

You have to put a use Data::Dumper; at the top of your script.

Searching in the array of output lines can be done this way:

foreach my $line (@out) { next unless $line =~ /port_number/; # skip unrelevant lines print $line; # extract or search for ESTABLISHED }

Best regards

Replies are listed 'Best First'.
Re^2: netstat on remote with perl (possible?)
by softestplease (Initiate) on Oct 24, 2013 at 14:53 UTC
    Thanks McA for your comment, the output is not a problem anymore but the pipe to execute the netstat is still not working.. any ideas or do you have any other solution? Cheers, Win


      Probably I'm totally wrong, but I thought that you search for a certain information in the output of your netstat, isn't it?

      I don't have an environment to test on, so I just assumed that the output of the netstat command is piped to find and then to findstr.

      My proposal was: If piping doesn't work you can grep the information on the perl side and not on the server side.

      Sorry, when I was totally wrong with my assumption. Let us see an example output of the netstat and what you want to search for.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059468]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2018-03-19 23:04 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.