#!/usr/bin/perl #loading all the required modules use strict; use warnings; use DBI; use Net::OpenSSH; $host = q(202.123.43.17); $hostname = q(TVM-ISP-ACC-SWH-190); $username = q(netcool); $password = q(Hello@123); eval { $ssh = Net::OpenSSH->new($host, user => $username, password => $password, timeout => 10); @output = $ssh->capture("admin show environment leds") or die "remote command failed: " . $ssh->error; print LOG "output of command = @output\n"; }; if($@) { print LOG "since we got error w.r.t shell prompt for the IP $host, we are proceeding with next device\n"; next; }