File: Alpha.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 (61 lines) | stat: -rw-r--r-- 1,644 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
package Ocsinventory::Agent::Backend::OS::BSD::Archs::Alpha;

use strict;

sub check{
    my $arch;
    chomp($arch=`sysctl -n hw.machine`);
    $arch eq "alpha";
}

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 *BSD
    # hw.model = AlphaStation 255 4/232
  
    chomp($SystemModel=`sysctl -n hw.model`);
    $SystemManufacturer = "DEC";
  
    ### Get processor type and speed in dmesg
    #
    # NetBSD:    AlphaStation 255 4/232, 232MHz, s/n
    #            cpu0 at mainbus0: ID 0 (primary), 21064A-2
    # OpenBSD:   AlphaStation 255 4/232, 232MHz
    #            cpu0 at mainbus0: ID 0 (primary), 21064A-2 (pass 1.1)
    # FreeBSD:   AlphaStation 255 4/232, 232MHz
    #            CPU: EV45 (21064A) major=6 minor=2
  
    for (`dmesg`) {
        if (/^cpu[^:]*:\s*(.*)$/i) { $processort = $1; }
        if (/$SystemModel,\s*(\S+)\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;