File: Sgimips.pm

package info (click to toggle)
ocsinventory-agent 2%3A2.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,424 kB
  • sloc: perl: 26,492; xml: 773; objc: 528; sh: 386; ansic: 333; makefile: 12
file content (73 lines) | stat: -rw-r--r-- 2,056 bytes parent folder | download | duplicates (4)
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
package Ocsinventory::Agent::Backend::OS::BSD::Archs::Sgimips;

use strict;

sub check{
    my $arch;
    chomp($arch=`sysctl -n hw.machine`);
    $arch =~ m/^sgi/; 
}

sub run {
    my $params = shift;
    my $common = $params->{common};
  
    my ($SystemSerial , $SystemModel, $SystemManufacturer, $BiosManufacturer, $BiosVersion, $BiosDate);
    my ($processort , $processorn , $processors );
  
    ### Get system model with "sysctl hw.model"
    #
    # example on NetBSD
    # hw.model = SGI-IP22
    # example on OpenBSD
    # hw.model=SGI-O2 (IP32)
  
    chomp($SystemModel=`sysctl -n hw.model`);
    $SystemManufacturer = "SGI";
  
    ### Get processor type and speed in dmesg
    #
    # Examples of dmesg output :
    #
    # I) Indy
    # a) NetBSD
    # mainbus0 (root): SGI-IP22 [SGI, 6906e152], 1 processor
    # cpu0 at mainbus0: MIPS R4400 CPU (0x450) Rev. 5.0 with MIPS R4010 FPC Rev. 0.0
    # int0 at mainbus0 addr 0x1fbd9880: bus 75MHz, CPU 150MHz
    #
    # II) O2
    # a) NetBSD
    # mainbus0 (root): SGI-IP32 [SGI, 8], 1 processor
    # cpu0 at mainbus0: MIPS R5000 CPU (0x2321) Rev. 2.1 with built-in FPU Rev. 1.0
    # b) OpenBSD
    # mainbus0 (root)
    # cpu0 at mainbus0: MIPS R5000 CPU rev 2.1 180 MHz with R5000 based FPC rev 1.0
    # cpu0: cache L1-I 32KB D 32KB 2 way, L2 512KB direct
  
    for (`dmesg`) {
        if (/$SystemModel\s*\[\S*\s*(\S*)\]/) { $SystemSerial = $1; }
        if (/cpu0 at mainbus0:\s*(.*)$/) { $processort = $1; }
        if (/CPU\s*.*\D(\d+)\s*MHz/) { $processors = $1; }
    }
    
    # number of procs with sysctl (hw.ncpu)
    chomp($processorn=`sysctl -n hw.ncpu`);
  
    # Writing data
    $common->setBios ({
        SMANUFACTURER => $SystemManufacturer,
        SMODEL => $SystemModel,
        SSN => $SystemSerial,
        BMANUFACTURER => $BiosManufacturer,
        BVERSION => $BiosVersion,
        BDATE => $BiosDate,
    });
  
    $common->setHardware({
        PROCESSORT => $processort,
        PROCESSORN => $processorn,
        PROCESSORS => $processors
    });
}

1;