Changeset a7d2d7beb82bb785cdd2982a653f279494d3530a

Show
Ignore:
Timestamp:
07/18/07 17:19:55 (7 years ago)
Author:
Eric Sproul <esproul@omniti.com>
git-committer:
Eric Sproul <esproul@omniti.com> 1184779195 +0000
git-parent:

[1c2d107ca45fd019c7ef543e43e97ecabe5698f7]

git-author:
Eric Sproul <esproul@omniti.com> 1184779195 +0000
Message:

Fix a regex bug with remoteport match, update regexes to work on Linux as well as Solaris

git-svn-id: https://labs.omniti.com/resmon/trunk@43 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Resmon/Module.pm

    r9e27991 ra7d2d7b  
    192192  my $output = cache_command("netstat -an", 30); 
    193193  my @lines = split(/\n/, $output); 
    194   @lines = grep(/\s$arg->{state}$/, @lines) if($arg->{state}); 
     194  @lines = grep(/\s$arg->{state}\s*$/, @lines) if($arg->{state}); 
    195195  @lines = grep(/^$arg->{localip}/, @lines) if($arg->{localip}); 
    196   @lines = grep(/^[\d\*\.]+\.$arg->{localport}/, @lines) if($arg->{localport}); 
    197   @lines = grep(/^[\d\*\.]+\d+\s+$arg->{remoteip}/, @lines) 
     196  @lines = grep(/^[\w\d\*\.]+.*[\.\:]+$arg->{localport}/, @lines) if($arg->{localport}); 
     197  @lines = grep(/[\d\*\.]+\d+\s+$arg->{remoteip}/, @lines) 
    198198        if($arg->{remoteip}); 
    199   @lines = grep(/^[\d\*\.]+\s+[\d\*\.+]\.$arg->{remoteport}/, @lines) 
     199  @lines = grep(/[\d\*\.]+\s+[\d\*\.]+[\.\:]+$arg->{remoteport}\s+/, @lines) 
    200200        if($arg->{remoteport}); 
    201201  my $count = scalar(@lines);