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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
package Ocsinventory::Agent::Backend::OS::Solaris::Bios;
# SPARC
# $ showrev
#Hostname: 157501s021plc
#Hostid: 83249bbf
#Release: 5.10
#Kernel architecture: sun4u
#Application architecture: sparc
#Hardware provider: Sun_Microsystems
#Domain: be.cnamts.fr
#Kernel version: SunOS 5.10 Generic_118833-17
#
# $ prtconf -pv (-b would be great...but doesn't work before S10)
#System Configuration: Sun Microsystems sun4u
#Memory size: 16384 Megabytes
#System Peripherals (PROM Nodes):
#
#Node 0xf0819f00
# scsi-initiator-id: 00000007
# node#: 00000000
# #size-cells: 00000002
# stick-frequency: 00bebc20
# clock-frequency: 08f0d180
# idprom: 01840014.4f4162cb.45255cf4.4162cb16.55555555.55555555.55555555.55555555
# breakpoint-trap: 0000007f
# device_type: 'gptwo'
# banner-name: 'Sun Fire E6900'
# compatible: 'SUNW,Serengeti'
# newio-addr: 00000001
# name: 'SUNW,Sun-Fire'
# X64
# $ showrev
#Hostname: stlaurent
#Hostid: 403100b
#Release: 5.10
#Kernel architecture: i86pc
#Application architecture: i386
#Hardware provider:
#Domain:
#Kernel version: SunOS 5.10 Generic_127112-07
#
# $ smbios -t SMB_TYPE_SYSTEM
#ID SIZE TYPE
#1 76 SMB_TYPE_SYSTEM (system information)
#
# Manufacturer: Sun Microsystems, Inc.
# Product: Sun Fire V40z
# Version: 00
# Serial Number: R00T34E0009
#
# UUID: be1630df-d130-41a4-be32-fd28bb4bd1ac
# Wake-Up Event: 0x6 (power switch)
# SKU Number:
# Family:
use strict;
sub check { can_run ("showrev") }
sub run {
my $params = shift;
my $common = $params->{common};
my $zone;
my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer,
$BiosVersion, $BiosDate, $aarch);
my $OSLevel=`uname -r`;
if ( $OSLevel =~ /5.8/ ){
$zone = "global";
}else{
foreach (`zoneadm list -p`){
$zone=$1 if /^0:([a-z]+):.*$/;
}
}
if ($zone){
foreach(`showrev`){
if(/^Application architecture:\s+(\S+)/){$SystemModel = $1};
if(/^Hardware provider:\s+(\S+)/){$SystemManufacturer = $1};
if(/^Application architecture:\s+(\S+)/){$aarch = $1};
}
if( $aarch eq "i386" ){
#
# For a Intel/AMD arch, we're using smbios
#
foreach(`/usr/sbin/smbios -t SMB_TYPE_SYSTEM`) {
if(/^\s*Manufacturer:\s*(.+)$/){$SystemManufacturer = $1};
if(/^\s*Serial Number:\s*(.+)$/){$SystemSerial = $1;}
if(/^\s*Product:\s*(.+)$/){$SystemModel = $1;}
}
foreach(`/usr/sbin/smbios -t SMB_TYPE_BIOS`) {
if(/^\s*Vendor:\s*(.+)$/){$BiosManufacturer = $1};
if(/^\s*Version String:\s*(.+)$/){$BiosVersion = $1};
if(/^\s*Release Date:\s*(.+)$/){$BiosDate = $1};
}
} elsif( $aarch eq "sparc" ) {
#
# For a Sparc arch, we're using prtconf
#
my $name;
my $OBPstring;
foreach(`/usr/sbin/prtconf -pv`) {
# prtconf is an awful thing to parse
if(/^\s*banner-name:\s*'(.+)'$/){$SystemModel = $1;}
unless ($name)
{ if(/^\s*name:\s*'(.+)'$/){$name = $1;} }
unless ($OBPstring) {
if(/^\s*version:\s*'(.+)'$/){
$OBPstring = $1;
# looks like : "OBP 4.16.4 2004/12/18 05:18"
# with further informations sometimes
if( $OBPstring =~ m@OBP\s+([\d|\.]+)\s+(\d+)/(\d+)/(\d+)@ ){
$BiosVersion = "OBP $1";
$BiosDate = "$2/$3/$4";
} else { $BiosVersion = $OBPstring }
}
}
}
$SystemModel .= " ($name)" if( $name );
if( -x "/opt/SUNWsneep/bin/sneep" ) {
chomp($SystemSerial = `/opt/SUNWsneep/bin/sneep`);
}else {
foreach(`/bin/find /opt -name sneep`) {
chomp($SystemSerial = `$1`) if /^(\S+)/;
}
if (!$SystemSerial){
$SystemSerial = "Please install package SUNWsneep";
}
}
}
}else{
foreach(`showrev`){
if(/^Hardware provider:\s+(\S+)/){$SystemManufacturer = $1};
}
$SystemModel = "Solaris Containers";
$SystemSerial = "Solaris Containers";
}
# Writing data
$common->setBios ({
BVERSION => $BiosVersion,
BDATE => $BiosDate,
SMANUFACTURER => $SystemManufacturer,
SMODEL => $SystemModel,
SSN => $SystemSerial
});
}
1;
|