Beta Shell
v2.0 ยท web2.us.cloudlogin.co
[FM]
[CMD]
[PHP]
[DB]
[INFO]
[SEC]
File Manager
~
/
usr
/
share
/
fusioninventory
/
lib
/
FusionInventory
/
Agent
/
Task
/
Inventory
/
Generic
/
Ipmi
Upload
5 items
Name
Size
Perms
Modified
Actions
[ .. / .. ]
Fru
-
drwxr-xr-x
2022-02-23 11:31:06
Del
Fru.pm
269 B
-rw-r--r--
2020-11-02 14:25:58
Edit
Del
Lan.pm
2.23 KB
-rw-r--r--
2020-08-04 07:36:42
Edit
Del
Editing: Lan.pm
(2.23 KB)
Path: /usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Generic/Ipmi/Lan.pm
Back
# # OcsInventory agent - IPMI lan channel report # # Copyright (c) 2008 Jean Parpaillon <jean.parpaillon@kerlabs.com> # # The Intelligent Platform Management Interface (IPMI) specification # defines a set of common interfaces to a computer system which system # administrators can use to monitor system health and manage the # system. The IPMI consists of a main controller called the Baseboard # Management Controller (BMC) and other satellite controllers. # # The BMC can be fetched through client like OpenIPMI drivers or # through the network. Though, the BMC hold a proper MAC address. # # This module reports the MAC address and, if any, the IP # configuration of the BMC. This is reported as a standard NIC. # package FusionInventory::Agent::Task::Inventory::Generic::Ipmi::Lan; use strict; use warnings; use FusionInventory::Agent::Tools; use FusionInventory::Agent::Tools::Network; sub isEnabled { my (%params) = @_; return 0 if $params{no_category}->{network}; return 1; } sub doInventory { my (%params) = @_; my $inventory = $params{inventory}; my $logger = $params{logger}; my $handle = getFileHandle( logger => $logger, command => "ipmitool lan print", ); return unless $handle; my $interface = { DESCRIPTION => 'bmc', TYPE => 'ethernet', MANAGEMENT => 1, STATUS => 'Down', }; while (my $line = <$handle>) { if ($line =~ /^IP Address\s+:\s+($ip_address_pattern)/) { $interface->{IPADDRESS} = $1 unless $1 eq '0.0.0.0'; } if ($line =~ /^Default Gateway IP\s+:\s+($ip_address_pattern)/) { $interface->{IPGATEWAY} = $1 unless $1 eq '0.0.0.0'; } if ($line =~ /^Subnet Mask\s+:\s+($ip_address_pattern)/) { $interface->{IPMASK} = $1 unless $1 eq '0.0.0.0'; } if ($line =~ /^MAC Address\s+:\s+($mac_address_pattern)/) { $interface->{MACADDR} = $1; } } close $handle; $interface->{IPSUBNET} = getSubnetAddress( $interface->{IPADDRESS}, $interface->{IPMASK} ); $interface->{STATUS} = 'Up' if $interface->{IPADDRESS}; $inventory->addEntry( section => 'NETWORKS', entry => $interface ); } 1;