in reply to Re^3: Need help to implement Net::SSH::Any
in thread Need help to implement Net::SSH::Any
Awsome it worked for Linux server to fetch uptime command output. Now my next part is to connect to quantum scalar i6000 and i2000 libra +ry and run command "show library status" I have below parameters. 1. Username 2. IP address 3. ssh access 4. password See below sequence of output what i have tried but its failing again d +uring execution. ################################################ cat check_lib.pl #!/usr/local/bin/perl #Check tape library status # use strict; use warnings; use Net::SSH::Any; use v5.10; my %library = ( 9 => "XX.XX.XX.XX", # for security reasons changed 10 => "YY.YY.YY.YY", # for security reasons changed 11 => "ZZ.ZZ.ZZ.ZZ", # for security reasons changed ); foreach my $lib ( sort keys %library ) { print "$lib $library{$lib}\n"; my $hostname = "$library{$lib}"; my $username = "root"; my $password = "XXXXXXXX"; # for security reasons changed my $cmd = "show library status"; if ( my $ssh = Net::SSH::Any->new($hostname, user => $username +, password => $password)) { print "I am connected to $hostname \n"; my @out = $ssh->capture($cmd); $ssh->error and die "capture method failed: " +. $ssh->error; say "Below is the output: \n"; say "@out"; } else { print "I am not able to connect $library{$lib}"; } } ################################################ > ./check_lib.pl 10 YY.YY.YY.YY Permission denied (publickey,password). I am connected to YY.YY.YY.YY capture method failed: unable to establish master SSH connection: bad +password or master process exited unexpectedly at ./check_lib.pl line + 27. ################################################ > ssh admin@YY.YY.YY.YY admin@YY.YY.YY.YY's password: Hello admin, welcome to the Command Line Interface for Quantum Scalar +i6000 library: LTO0XX Type 'help' at the prompt for context-sensitive help. />show library status Component Status Description ------------------------ ------- ----------------------------------- +------------------------- System Health Orange Degraded Control Green Operational Connectivity Green Operational Power Green Operational Cooling Green Operational Robotics Green Operational Robotics Green Operational Robot Green Online Active Drives Yellow Warning; Active events: 4 Event: 458 Yellow Data cartridge L60368L6 has issued +a Tape Alert 3 Event: 459 Yellow Data cartridge L60466L6 has issued +a Tape Alert 3 Event: 460 Yellow Drive sled at [1,1,1,4,1,1] has iss +ued a Tape Alert 37 Event: 462 Yellow Data cartridge C05155L3 has issued +a Tape Alert 33 Drive# 1 (P1 D1) Green Online; Drive Empty Media Loads: 1941 - Read Errors: 50 + - Write Errors: 1207 Read: 89266699MB - Written: 2254575 +167MB Drive# 2 (P1 D2) Green Online; Drive Empty Media Loads: 1160 - Read Errors: 83 + - Write Errors: 571 Read: 205251608MB - Written: 736927 +492MB Drive# 3 (P1 D3) Green Online; Drive Mounted Media Loads: 700 - Read Errors: 46 +- Write Errors: 360 Read: 103106456MB - Written: 473463 +422MB Drive# 4 (P1 D4) Yellow Online; Drive Mounted Media Loads: 285 - Read Errors: 5 - + Write Errors: 31 Read: 21165341MB - Written: 6581404 +8MB Drive# 5 (P1 D5) Green Online; Drive Mounted Media Loads: 1453 - Read Errors: 46 + - Write Errors: 159 Read: 5449221MB - Written: 10000760 +1MB Drive# 6 (P1 D6) Green Online; Drive Mounted Media Loads: 839 - Read Errors: 17 +- Write Errors: 56 Read: 3844530MB - Written: 74439198 +MB Drive# 7 (P1 D7) Green Online; Drive Empty Media Loads: 657 - Read Errors: 10 +- Write Errors: 59 Read: 4948358MB - Written: 42267420 +MB Drive# 8 (P1 D8) Green Online; Drive Empty Media Loads: 526 - Read Errors: 11 +- Write Errors: 113 Read: 11475257MB - Written: 4465934 +4MB Drive# 9 (P1 D9) Green Online; Drive Empty Media Loads: 4153 - Read Errors: 30 +40 - Write Errors: 7810 Read: 51868269MB - Written: 2270923 +27MB Drive# 10 (P1 D10) Green Online; Drive Empty Media Loads: 3547 - Read Errors: 84 + - Write Errors: 167 Read: 29919339MB - Written: 1668944 +70MB Drive# 11 (P1 D11) Green Online; Drive Empty Media Loads: 3090 - Read Errors: 11 +6 - Write Errors: 76 Read: 33787260MB - Written: 1317133 +77MB Drive# 12 (P1 D12) Green Online; Drive Empty Media Loads: 812 - Read Errors: 6 - + Write Errors: 14 Read: 6607257MB - Written: 15037428 +MB /> /> />exit Connection to YY.YY.YY.YY closed. $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Need help to implement Net::SSH::Any
by salva (Canon) on May 03, 2016 at 09:54 UTC | |
by mr.sagarbhamare (Novice) on May 03, 2016 at 12:25 UTC | |
by salva (Canon) on May 03, 2016 at 13:00 UTC |