This file is indexed.

/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Solaris/Storages.pm is in fusioninventory-agent 1:2.3.10.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
package FusionInventory::Agent::Task::Inventory::Solaris::Storages;

use strict;
use warnings;

use FusionInventory::Agent::Tools;

sub isEnabled {
    return canRun('iostat');
}

sub doInventory {
    my (%params) = @_;

    my $inventory = $params{inventory};
    my $logger    = $params{logger};

    my @storages = _getStorages(
        logger => $logger, command => 'iostat -En'
    );

    foreach my $storage (@storages) {
        if (-l "/dev/rdsk/$storage->{NAME}s2") {
            my $rdisk_path = getFirstLine(
                command => "ls -l /dev/rdsk/$storage->{NAME}s2"
            );
            $storage->{TYPE} =
                $rdisk_path =~ /->.*scsi_vhci/ ? 'MPxIO' :
                $rdisk_path =~ /->.*fp@/       ? 'FC'    :
                $rdisk_path =~ /->.*scsi@/     ? 'SCSI'  :
                                                 undef   ;
        }

        $inventory->addEntry(section => 'STORAGES', entry => $storage);
    }
}

sub _getStorages {

    my $handle = getFileHandle(@_);

    return unless $handle;

    my @storages;
    my $storage;

    while (my $line = <$handle>) {
        if ($line =~ /^(\S+)\s+Soft/) {
            $storage->{NAME} = $1;
        }
        if ($line =~ /^
            Vendor:       \s (\S+)          \s+
            Product:      \s (\S.*?\S)      \s+
            Revision:     \s (\S+)          \s+
            Serial \s No: \s (\S*)
        /x) {
            $storage->{MANUFACTURER} = $1;
            $storage->{MODEL} = $2;
            $storage->{FIRMWARE} = $3;
            $storage->{SERIALNUMBER} = $4 if $4;
        }
        if ($line =~ /<(\d+) bytes/) {
            $storage->{DISKSIZE} = int($1/(1000*1000));
        }
        if ($line =~ /^Illegal/) { # Last ligne

            ## To be removed when SERIALNUMBER will be supported
            if ($storage->{SERIALNUMBER}) {
                $storage->{DESCRIPTION} = $storage->{DESCRIPTION} ?
                $storage->{DESCRIPTION} . " S/N:" . $storage->{SERIALNUMBER} :
                                           "S/N:" . $storage->{SERIALNUMBER} ;

            }

            ## To be removed when FIRMWARE will be supported
            if ($storage->{FIRMWARE}) {
                $storage->{DESCRIPTION} = $storage->{DESCRIPTION} ?
                $storage->{DESCRIPTION} . " FW:" . $storage->{FIRMWARE} :
                                           "FW:" . $storage->{FIRMWARE} ;
            }

            if ($storage->{MANUFACTURER}) {
                ## Workaround for MANUFACTURER == ATA case
                if (
                    $storage->{MANUFACTURER} eq 'ATA' &&
                    $storage->{MODEL} =~ /^(Hitachi|Seagate|INTEL) (.+)/i) {
                        $storage->{MANUFACTURER} = $1;
                        $storage->{MODEL} = $2;
                }

                ## Drop the (R) from the manufacturer string
                $storage->{MANUFACTURER} =~ s/\(R\)$//i;
            }


            push @storages, $storage;
            undef $storage;
        }
    }
    close $handle;

    return @storages;
}

1;