missing serial number on some HP servers + maybe fix

Registered by Frank

Hi,

after i put some (30+) different HP servers in OCS inventory (ver 1.3.3 on gentoo linux) i noticed that some servers missing serial numbers info which is important to us for
tracking equipment. looking at perl source in agent (./lib/Ocsinventory/Agent/Backend/OS/Generic/Dmidecode/Bios.pm) i noticed that you try to use "System information"
and then Motherboard info, and then CPU ID (as serial).
dmidecode on HP servers (i tried on G4-G6, some BL series and some DL series) have 2 different serials and one is for "System" (usually attached to motherboard serial) and one is
in "Chassis Information". usually second one is used for tracking equipment as is written on shipment info and bills. also "System Information" serial can be empty if there was replaced failed motherboard.
dmidecode example:

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: Hewlett-Packard
        Product Name: ProLiant BL490c G6
        Serial Number: CZC9387KKD
<cut>

Handle 0x0300, DMI type 3, 17 bytes
Chassis Information
<cut>
        Serial Number: GB88340E5X
<cut>

if ($SystemSerial !~ /[:alnum:]/) {
    $flag=0;
    for(@dmidecode){
      if(/dmi type 3,/i){$flag=1;}
      elsif(/^chassis information:/i){$flag=2;}
      elsif((/^serial number:\s*(.*)/i) && ($flag)) {
        $SystemSerial = $1;
        $SystemSerial =~ s/\ //g;
        last
      }
    }
  }

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
mortheres
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.