Rev 56 | Rev 69 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/usr/bin/env perl
use warnings;
use strict;
# Description: Get IPMI network information
our $VERSION = '1.2';
# IPMI network module for sysinfo client
# Author: R. W. Rodolico
# Date: 2016-09-17
# 20171124 RWR
# Fixed where STDERR now goes to /dev/null
#
# module to get network interface information for ipmi
# requires ipmitool (runs ipmitool lan print)
# NOTE: this takes the ipmitool output and parses it, so changes to
# this output invalidates this module
BEGIN {
push @INC, shift;
}
use library;
my $command = &validCommandOnSystem('ipmitool');
exit 1 unless $command;
my %storage = (
'address' => { 'key' => 'IP Address' },
'netmask' => { 'key' => 'Subnet Mask' },
'mac' => { 'key' => 'MAC Address' }
);
my $CATEGORY = 'network';
my @temp = qx( $command lan print 2>/dev/null );
chomp @temp;
foreach my $line ( @temp ) {
my ( $key, $value ) = split( /\s+:\s+/, $line );
foreach my $test ( keys %storage ) {
next if defined( $storage{$test}{'value'} );
if ( $key eq $storage{$test}{'key'} ) {
$storage{$test}{'value'} = $value;
last;
} # if
} # foreach
}
foreach my $key ( keys %storage ) {
print "$CATEGORY\tipmi\t$key\t$storage{$key}{'value'}\n";
}
1;