source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/Backend/OS/BSD/Archs/Sgimips.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 1.9 KB
Line 
1package Ocsinventory::Agent::Backend::OS::BSD::Archs::Sgimips;
2
3use strict;
4
5sub check{
6    my $arch;
7    chomp($arch=`sysctl -n hw.machine`);
8    $arch =~ m/^sgi/; 
9}
10
11sub run {
12  my $params = shift;
13  my $common = $params->{common};
14
15  my( $SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer,
16    $BiosVersion, $BiosDate);
17  my ( $processort , $processorn , $processors );
18
19  ### Get system model with "sysctl hw.model"
20  #
21  # example on NetBSD
22  # hw.model = SGI-IP22
23  # example on OpenBSD
24  # hw.model=SGI-O2 (IP32)
25
26  chomp($SystemModel=`sysctl -n hw.model`);
27  $SystemManufacturer = "SGI";
28
29  ### Get processor type and speed in dmesg
30  #
31  # Examples of dmesg output :
32  #
33  # I) Indy
34  # a) NetBSD
35  # mainbus0 (root): SGI-IP22 [SGI, 6906e152], 1 processor
36  # cpu0 at mainbus0: MIPS R4400 CPU (0x450) Rev. 5.0 with MIPS R4010 FPC Rev. 0.0
37  # int0 at mainbus0 addr 0x1fbd9880: bus 75MHz, CPU 150MHz
38  #
39  # II) O2
40  # a) NetBSD
41  # mainbus0 (root): SGI-IP32 [SGI, 8], 1 processor
42  # cpu0 at mainbus0: MIPS R5000 CPU (0x2321) Rev. 2.1 with built-in FPU Rev. 1.0
43  # b) OpenBSD
44  # mainbus0 (root)
45  # cpu0 at mainbus0: MIPS R5000 CPU rev 2.1 180 MHz with R5000 based FPC rev 1.0
46  # cpu0: cache L1-I 32KB D 32KB 2 way, L2 512KB direct
47
48  for (`dmesg`) {
49      if (/$SystemModel\s*\[\S*\s*(\S*)\]/) { $SystemSerial = $1; }
50      if (/cpu0 at mainbus0:\s*(.*)$/) { $processort = $1; }
51      if (/CPU\s*.*\D(\d+)\s*MHz/) { $processors = $1; }
52  }
53 
54  # number of procs with sysctl (hw.ncpu)
55  chomp($processorn=`sysctl -n hw.ncpu`);
56
57# Writing data
58  $common->setBios ({
59      SMANUFACTURER => $SystemManufacturer,
60      SMODEL => $SystemModel,
61      SSN => $SystemSerial,
62      BMANUFACTURER => $BiosManufacturer,
63      BVERSION => $BiosVersion,
64      BDATE => $BiosDate,
65    });
66
67  $common->setHardware({
68
69      PROCESSORT => $processort,
70      PROCESSORN => $processorn,
71      PROCESSORS => $processors
72
73    });
74
75
76}
77
781;
Note: See TracBrowser for help on using the repository browser.