/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Linux/iLO.pm is in fusioninventory-agent 1:2.3.10.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | package FusionInventory::Agent::Task::Inventory::Linux::iLO;
use strict;
use warnings;
use FusionInventory::Agent::Tools;
use FusionInventory::Agent::Tools::Network;
sub isEnabled {
return unless canRun('hponcfg');
}
sub _parseHponcfg {
my (%params) = @_;
my $handle = getFileHandle(%params);
return unless $handle;
my $interface = {
DESCRIPTION => 'Management Interface - HP iLO',
TYPE => 'ethernet',
MANAGEMENT => 'iLO',
STATUS => 'Down',
};
while (my $line = <$handle>) {
if ($line =~ /<IP_ADDRESS VALUE="($ip_address_pattern)"\/>/) {
$interface->{IPADDRESS} = $1 unless $1 eq '0.0.0.0';
}
if ($line =~ /<SUBNET_MASK VALUE="($ip_address_pattern)"\/>/) {
$interface->{IPMASK} = $1;
}
if ($line =~ /<GATEWAY_IP_ADDRESS VALUE="($ip_address_pattern)"\/>/) {
$interface->{IPGATEWAY} = $1;
}
if ($line =~ /<NIC_SPEED VALUE="([0-9]+)"\/>/) {
$interface->{SPEED} = $1;
}
if ($line =~ /<ENABLE_NIC VALUE="Y"\/>/) {
$interface->{STATUS} = 'Up';
}
if ($line =~ /not found/) {
chomp $line;
$params{logger}->error("error in hponcfg output: $line")
if $params{logger};
}
}
close $handle;
$interface->{IPSUBNET} = getSubnetAddress(
$interface->{IPADDRESS}, $interface->{IPMASK}
);
return $interface;
}
sub doInventory {
my (%params) = @_;
my $inventory = $params{inventory};
my $logger = $params{logger};
my $entry = _parseHponcfg(
logger => $logger,
command => 'hponcfg -aw -'
);
$inventory->addEntry(
section => 'NETWORKS',
entry => $entry
);
}
1;
|