You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2008-04-15 02:23:43

dan2003
Guest
Registered: 2008-04-14
Posts: 29

GLPI not displaying correct OS RAM SIZE on main page

I've setup a few machines that send inventory to my OCS server then i import the data into GLPI. The problem is, GLPI seems to be displaying the total amount of physical RAM inside of the machine rather than the amount used by the OS. In OCS, there are 2 RAM #'s for each computer. The first RAM # in OCS is on the main computer page where it displays the correct amount of RAM used by the OS for each computer. When you click on a computer link in OCS then click the RAM icon, the total amount of RAM displays the amount attached to the machine instead of the actual RAM used by the OS. Well, GLPI gathers its amount from the 2nd RAM # instead of the first so i end up getting the wrong RAM SIZE # when i want to print PDF reports for computers with 4GB+.

Example of problem in OCS:
Windows 2003 Server Computer
On main computer page of OCS it displays a RAM amount of : 3584
When you click on the computer link, the amount of memory displays 5120
Physical Memory  DIMM 03 (Single-bit ECC)  1024  System Memory  Unknown  200  3 
Physical Memory  DIMM 04 (Single-bit ECC)  1024  System Memory  Unknown  200  4 
Physical Memory  DIMM 05 (Single-bit ECC)  1024  System Memory  Unknown  200  5 
Physical Memory  DIMM 06 (Single-bit ECC)  1024  System Memory  Unknown  200  6 
Physical Memory  DIMM 01 (Single-bit ECC)  512  System Memory  Unknown  200  1 
Physical Memory  DIMM 02 (Single-bit ECC)  512  System Memory  Unknown  200  2 


Example of problem in GLPI:
Same Windows 2003 Server computer
On main inventory computer page it displays RAM SIZE amount of 5120
When you click on the computer link, it also shows the amount of RAM as 5120
Physical Memory  DIMM 03 (Single-bit ECC)  1024  System Memory  Unknown  200  3 
Physical Memory  DIMM 04 (Single-bit ECC)  1024  System Memory  Unknown  200  4 
Physical Memory  DIMM 05 (Single-bit ECC)  1024  System Memory  Unknown  200  5 
Physical Memory  DIMM 06 (Single-bit ECC)  1024  System Memory  Unknown  200  6 
Physical Memory  DIMM 01 (Single-bit ECC)  512  System Memory  Unknown  200  1 
Physical Memory  DIMM 02 (Single-bit ECC)  512  System Memory  Unknown  200  2 


Now, i've checked OCS's mysql db and found where both RAM data is stored. The OS RAM data is being stored in 'hardware'. The total physical RAM data is being stored in 'memories'. So it seems that GLPI is grabbing its data from 'memories' rather than 'hardware'. Any input on how to fix this will be great, thanks.

Last edited by dan2003 (2008-04-15 02:24:55)

Offline

#2 2008-04-15 09:13:17

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: GLPI not displaying correct OS RAM SIZE on main page

The OS memory is stored in HARDWARE.MEMORY field of OCS.

With OCS version 1.01 and 1.02RC1 it's only use when real physical memory not detected

if( $valMem["capa"] > 0 )
        $memory = $valMem["capa"];
else
        $memory = $item->MEMORY;

So, for me, the display is the same in both OCS and GLPI.

Which version are you using ?

I've add this data as missing in our development trac (https://dev.indepnet.net/glpi/wiki/MissingDatas)

++

Last edited by remi (2008-04-15 09:13:56)


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#3 2008-04-16 20:15:49

dan2003
Guest
Registered: 2008-04-14
Posts: 29

Re: GLPI not displaying correct OS RAM SIZE on main page

remi wrote:

The OS memory is stored in HARDWARE.MEMORY field of OCS.

With OCS version 1.01 and 1.02RC1 it's only use when real physical memory not detected

if( $valMem["capa"] > 0 )
        $memory = $valMem["capa"];
else
        $memory = $item->MEMORY;

So, for me, the display is the same in both OCS and GLPI.

Which version are you using ?

I've add this data as missing in our development trac (https://dev.indepnet.net/glpi/wiki/MissingDatas)

++

I'm using OCS version 1.02RC1 with GLPI 0.70.2.  Ok i understand but is it possible to have GLPI use the OS memory amount rather than Physical?

Last edited by dan2003 (2008-04-16 20:25:15)

Offline

#4 2008-04-16 21:00:59

dan2003
Guest
Registered: 2008-04-14
Posts: 29

Re: GLPI not displaying correct OS RAM SIZE on main page

Upon further investigation, ive found the code where GLPI grabs memory info from OCS :

taken from ocsng.function.php

case RAM_DEVICE :
            //Memoire
            if ($cfg_ocs["import_device_memory"]) {
                $do_clean = true;

                $query2 = "SELECT * 
                                                    FROM memories 
                                                    WHERE HARDWARE_ID = '" . $ocs_id . "' 
                                                    ORDER BY ID";
                $result2 = $DBocs->query($query2);
                if ($DBocs->numrows($result2) > 0) {
                    while ($line2 = $DBocs->fetch_array($result2)) {
                        $line2 = clean_cross_side_scripting_deep(addslashes_deep($line2));
                        if (!empty ($line2["CAPACITY"]) && $line2["CAPACITY"] != "No") {
                            if ($line2["DESCRIPTION"])
                                $ram["designation"] = $line2["DESCRIPTION"];
                            else
                                $ram["designation"] = "Unknown";
                            $ram["specif_default"] = $line2["CAPACITY"];
                            if (!in_array(RAM_DEVICE . '$$$$$' . $ram["designation"], $import_device)) {
                                $ram["frequence"] = $line2["SPEED"];
                                $ram["type"] = ocsImportDropdown("glpi_dropdown_ram_type", $line2["TYPE"]);
                                $ram_id = ocsAddDevice(RAM_DEVICE, $ram);
                                if ($ram_id) {
                                    $devID = compdevice_add($glpi_id, RAM_DEVICE, $ram_id, $line2["CAPACITY"], $dohistory);
                                    addToOcsArray($glpi_id, array (
                                        $devID => RAM_DEVICE . '$$$$$' . $ram["designation"]
                                    ), "import_device");
                                }
                            } else {
                                $id = array_search(RAM_DEVICE . '$$$$$' . $ram["designation"], $import_device);
                                update_device_specif($line2["CAPACITY"], $id, 1,true);
                                unset ($import_device[$id]);
                            }
                        }
                    }
                }
            }
            break;

So as you can see GLPI only grabs memory from OCS's memories db and not from 'hardware'.memory. Anyone able to post code to show me how to force glpi to grab its memory info from ocs's hardware.memory?

Offline

Board footer

Powered by FluxBB