Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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?)

Hi,

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
McA


Comment on Re: netstat on remote with perl (possible?)
Select or Download Code
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

      Hi,

      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.

      Regards
      McA

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059468]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2015-07-30 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls