jackburton79 / ocs-agent

Lite inventory agent (compatibile with ocsinventory-ng and glpi)
GNU General Public License v3.0
15 stars 6 forks source link

Request - Enhancement - use flag to bypass AssetTag <> Inventory Number import #46

Open inext68 opened 3 months ago

inext68 commented 3 months ago

Thanks for you job. Using the agent with 10Zig thinclient we have these data for BIOS (see below). The problem is that importing data in GLPI the value overwrite the value in the field "Inventory number". This appen first time we launch the agent. If we change manually the value imported from agent in GLPI the import will be locked by "lock system" of GLPI.

Having hundreds o thinclient we have to change the info manually for everyone after first import.

Is possibile modifiy the code to set a flag to enable or disable the import for field? Below an example of the inventory generated from agent. Thank you

############
<BIOS>
           <ASSETTAG>Chassis Asset Tag</ASSETTAG>
            <BDATE>09/23/2019</BDATE>
            <BMANUFACTURER>INSYDE Corp.</BMANUFACTURER>
            <BVERSION>V:3.4.21-08082019</BVERSION>
            <MMANUFACTURER>Type2 - Board Manufacturer</MMANUFACTURER>
            <MSN>Type2 - Board Serial Number</MSN>
            <SMANUFACTURER>10ZiG Technology</SMANUFACTURER>
           <SMODEL>4500</SMODEL>
           <SSN>xxxxxxxxxxxx</SSN>
           <TYPE>Notebook</TYPE>    
</BIOS> 
jackburton79 commented 3 months ago

Hi, thanks for reporting! Will have a look next week.

jackburton79 commented 3 months ago

I had a look at what glpi agent does:

--assetname-support=1|2        [unix/linux only] set the asset name depending on the given value:
                                        - 1 (the default), the short hostname is used as asset name
                                        - 2, the as-is hostname (can be fqdn) is used as asset name

As default behaviour it uses the hostname as asset tag. Would it be okay if this agent did the same ?

inext68 commented 3 months ago

I believe these behaviour is set in glpi-agent to retrieve the hostname that can be short or FQDN. Normally that info is filled into

`

asset-name
  ...
` The asset tag is from ` asset-tag ... ` The value ASSETTAG is read by dmidecode and is a readonly value from bios in the section "chassis information > Asset Tag" and is used to fill the inventory number field in GLPI We use the inventory number field with an internal Barcode number that is different by hostname. If not possibile to bypass the import than is better to choose a hostname value for import. thanks
jackburton79 commented 3 months ago

Hi, I'm checking against official glpi agent and they behaves the same. Do you know if in the glpi agent is it possible to skip the asset tag ?

inext68 commented 3 months ago

Hi, the only way that I know to bypass inventory number import is is present a lock on the field. But this lock is created when the content of the filed is manually modified after an automatic import.

Then our value are not imported by agent but manually filled in and than the fiels are not locked for change. In the official glpi-agent i believe the assets-tag I have to test if it us exported the Asset-Tag or if only the Asset-name I'll check in the same hardware with the official agent and report to you

inext68 commented 3 months ago

Hi, I have start a remoteinventory from glpi-agent to the thinclient and after 1hour the result is that also glpi-agent import "Chassis Asset Tag" as inventory number.

If is possibile I would try to fork you code to bypass this field. Can you tell me where is the function that you use to fill the Asset-name? Thank a lot

jackburton79 commented 2 months ago

Hi, with "asset-name" you mean the computer name ?

inext68 commented 2 months ago

HI, yes. Asset-Name = computer name Asset-TAg = TAG ID for support (same as DELL TAG) or Internal inventory number (we user our internal barcode) I've forked your repo and only commented the lines about asset-tag to prevent agent overwriting our data and it work as expected. not a real solution but... :)

Il giorno mar 30 lug 2024 alle ore 09:24 Stefano Ceccherini < @.***> ha scritto:

Hi, with "asset-name" you mean the computer name ?

— Reply to this email directly, view it on GitHub https://github.com/jackburton79/ocs-agent/issues/46#issuecomment-2257655207, or unsubscribe https://github.com/notifications/unsubscribe-auth/BAGZTKAIQB6FEY744FQ76X3ZO45TZAVCNFSM6AAAAABJTV3SJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJXGY2TKMRQG4 . You are receiving this because you authored the thread.Message ID: @.***>