#!/usr/bin/perl -w use strict; use PowerEdge::RAC qw(prompt); # use Data::Dumper; my ($host, $user, $pass) = ('') x 3; print "This script requires access to an existing RAC card. \n". "It will print all information it can find out \n"; $host = prompt('Enter the RAC card\'s IP address : ','192.168.1.120'); $user = prompt('Enter the RAC username : ', 'root'); $pass = prompt('Enter the RAC password : ', 'calvin'); $user ||= 'root'; $pass ||= 'calvin'; my $server = new PowerEdge::RAC( host => $host, user => $user, password => $pass, ); print "\n",'According to the RCA the time is: ', $server->get_gmt(); print $server->arp(); my $powered_on = $server->is_powered_on(); print 'Server is powered '; print $powered_on ? 'on' : 'off'; print "\n"; print $server->console_status(); print $server->sysinfo(); my $v = $server->firmware_version(); print 'Firmware version: ', $v, "\n"; # print Dumper($server->multi_info()) unless ($v < '2.0'); print $server->test_email('root'); # Unfortunately this has been disabled in at least firmware version 2.20 print $server->getniccfg() if ($v ne '2.20'); print $server->netstat(); print $server->netstat(1); print $server->ping(); print $server->ping('192.168.1.64'); print $server->sessions(); print $server->session_id(), "\n"; print $server->rfbstatus(); print $server->post_log(); print $server->rac_log(400); print join(' ', %{ $server->selgetinfo()}), "\n"; print scalar($server->event_log()), "\n"; print $server->config(); unless ($powered_on) { print 'Collection of sensor data requires the server to be powered on. Skipping.'. "\n"; print 'Done.'. "\n"; exit 0; }; print 'Retrieving all available sensordata. This may take a while.' . "\n"; print 'Wait ...'. "\n"; print scalar($server->read_sensors_txt()), "\n"; print 'Printing maping from sensorid to name' . "\n"; my $s = $server->sensorid_to_name(); for my $k (sort keys %{ $s } ) { printf("%8s %-20s\n", $k, $s->{$k}); }; print "\n". 'So far so good.'. "\n"; print 'The last command may not work for all hard- and firmware'."\n"; # names of sensors common to both 1650 and 2650 my @x650 = ( 'BP_12V', 'BP_3.3V', 'BP_5V', 'BP_BOTTOM_TEMP', 'BP_TOP_TEMP', 'COVER_INTRUSION', 'DRIVE_1', 'DRIVE_2', 'DRIVE_3', 'DRIVE_4', 'DRIVE_5', 'FAN_CONTROL', 'POWER_SUPPLY_1', 'POWER_SUPPLY_2', 'SCSI_A_CON', 'SCSI_B_CON', ); my %sensors = %{ $server->read_sensors_by_name(@x650) }; for my $k (sort keys %sensors) { my %props = %{ $sensors{$k} }; my $name = $sensors{$k}->{'NAME'}; my $val = $sensors{$k}->{'VAL'}; my $units = $sensors{$k}->{'UNITS'}; printf("%-16s %16s %-6s\n", $name, $val, $units); }; print 'Done.'. "\n";