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 2023-05-15 10:55:34

flex-pgum
Member
Registered: 2023-05-15
Posts: 2

Hook after Agent-Inventory from glpiinventory or fusioninventory

Hi, I was curious if any hook is called after an inventory is done by the GLPI Inventory Plugin or the Fusioninventory plugin.

I tested several hooks (like item_add, pre_item_update/item_update, handle_inventory_task and autoinventory_information) but none of them are called right after an agent-inventory by the above mentioned plugins is done.
Also, I noticed that the documentation about the "autoinventory_information" hook is not correct. The documentation says "After an automated inventory has occured" but in my case this hook is called every time when I open the detail page of an asset (like the detail form of a computer).

Is there anything I can use or call to get the added/updated item right after the inventory by the plugin? (inventory is done by agent which sends to "/glpi/plugins/glpiinventory/" url).

Thanks

Offline

#2 2023-05-15 12:35:52

gbougard
Moderator
From: Montpellier, France
Registered: 2021-07-21
Posts: 537
Website

Re: Hook after Agent-Inventory from glpiinventory or fusioninventory

Hi flex-pgum,

I don't know for FI plugin, but I can tell you for GLPI Inventory plugin: none is call as an inventory in GLPI 10 is handled by native inventory... GLPI Inventory plugin is only used to handle tasks management. But as far I know, there's no such hook.


GLPI-Agent developer from Teclib' and GLPI-Network team
Previously FusionInventory-Agent maintainer

Offline

#3 2023-05-16 14:53:20

flex-pgum
Member
Registered: 2023-05-15
Posts: 2

Re: Hook after Agent-Inventory from glpiinventory or fusioninventory

Hi, thank you for your reply.

You are right, after some deeper research I found a recent question/bug on github: github.com/glpi-project/glpi/issues/14228 which describes a similar problem.
A GLPI member answered following:
"Using GLPI framework while importing software is not possible; all hooks will slower the proceess, and inventory is using prepared queries that reallly have an impact."

Also FI and GI directly query the database.

Therefore I guess I have to go back to good old database triggers..
For anyone who is curious what I try to achieve: I want to create a plugin for a user/asset relation history (when an asset was assigned to a user and when it got removed again).
Obviously I could crawl the log to get this information but due to performance reasons I'd like to hold it separately.

Offline

Board footer

Powered by FluxBB