use Config::General; use Tie::IxHash; use Net::SNMP; sub SSH_Reference() { ($host,$user)=@_; #print "$host---$user--\n"; #($host,$user)= @_; $ssh = Net::SSH::Expect->new ( host => $host, user => $user, timeout=>10, raw_pty => 1 ); return $ssh; } sub Process_Output() { $ssh = shift; $process = shift; #( $ssh, $process ) = @_; $output; $ssh->eat($ssh->peek(0)); $ssh->send("ps -ef | grep $process | grep -v 'grep'"); while ( defined ($line = $ssh->read_line(2)) ) { next if ( $line =~ m/grep/ ); $output .= "$line"; } $ssh->eat($ssh->peek(0)); return $output; } 1;