################################################ 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 issued 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: 2254575167MB Drive# 2 (P1 D2) Green Online; Drive Empty Media Loads: 1160 - Read Errors: 83 - Write Errors: 571 Read: 205251608MB - Written: 736927492MB Drive# 3 (P1 D3) Green Online; Drive Mounted Media Loads: 700 - Read Errors: 46 - Write Errors: 360 Read: 103106456MB - Written: 473463422MB Drive# 4 (P1 D4) Yellow Online; Drive Mounted Media Loads: 285 - Read Errors: 5 - Write Errors: 31 Read: 21165341MB - Written: 65814048MB Drive# 5 (P1 D5) Green Online; Drive Mounted Media Loads: 1453 - Read Errors: 46 - Write Errors: 159 Read: 5449221MB - Written: 100007601MB Drive# 6 (P1 D6) Green Online; Drive Mounted Media Loads: 839 - Read Errors: 17 - Write Errors: 56 Read: 3844530MB - Written: 74439198MB Drive# 7 (P1 D7) Green Online; Drive Empty Media Loads: 657 - Read Errors: 10 - Write Errors: 59 Read: 4948358MB - Written: 42267420MB Drive# 8 (P1 D8) Green Online; Drive Empty Media Loads: 526 - Read Errors: 11 - Write Errors: 113 Read: 11475257MB - Written: 44659344MB Drive# 9 (P1 D9) Green Online; Drive Empty Media Loads: 4153 - Read Errors: 3040 - Write Errors: 7810 Read: 51868269MB - Written: 227092327MB Drive# 10 (P1 D10) Green Online; Drive Empty Media Loads: 3547 - Read Errors: 84 - Write Errors: 167 Read: 29919339MB - Written: 166894470MB Drive# 11 (P1 D11) Green Online; Drive Empty Media Loads: 3090 - Read Errors: 116 - Write Errors: 76 Read: 33787260MB - Written: 131713377MB Drive# 12 (P1 D12) Green Online; Drive Empty Media Loads: 812 - Read Errors: 6 - Write Errors: 14 Read: 6607257MB - Written: 15037428MB /> /> />exit Connection to YY.YY.YY.YY closed. $