glpi-project / glpi-agent

GLPI Agent
GNU General Public License v2.0
252 stars 61 forks source link

Configuration file not respecting the full-inventory-postpone parameter #792

Closed erique-souza closed 1 month ago

erique-souza commented 1 month ago

Bug reporting acknowledgment

Yes, I read it

Professional support

Still not applicable

Describe the bug

I did some tests using glpi-agent 1.10 and 1.11 using the parameter implemented since 1.8, which is "full-inventory-postpone" which was published in the links below, trying to set its parameter to a smaller interval, for example every 2 inventories , the 3rd would be the full

https://github.com/glpi-project/glpi-agent/discussions/669 https://github.com/glpi-project/glpi-agent/discussions/592

However, even changing the configuration file as usual, restarting the glpi-agent service, and forcing the inventory a few times, I noticed that the partial inventory continued to be sent, leading me to believe that the parameter itself is not actually being taken. into consideration

I also sent the glpi-agent log in debugg 2 below, and also a partial inventory

image

computer_0_3 (7).json glpi-agent.txt

I also noticed another situation that is linked to the documentation In the glpi-agent documentation, it is generally correctly mentioned about "full-inventory-postpone" https://glpi-agent.readthedocs.io/en/latest/man/glpi-agent.html#inventory-task-specific-options

I also noticed that it is correctly documented also in the parameter commands for windowshttps://glpi-agent.readthedocs.io/en/latest/installation/windows-command-line.html

However for Linux there is no mention of the parameter itself https://glpi-agent.readthedocs.io/en/latest/installation/linux-appimage.html

Taking advantage of the hook, we have a third situation also linked to the same parameter that I encountered in my tests, the "full-inventory-postpone" was not recognized when installing in Linux using the .pl file as usual, also leading me to believe that it is not implemented for installation via parameter but rather added manually to the post-installation configuration file

I didn't find any mention in the default agent.cfg linux file when it is installed to validate that the parameter I passed was correct Please correct me if I'm wrong at any point in this post, but these are the considerations I saw when carrying out some more precise tests

To reproduce

Expected behavior

Partial agent inventory, x number of times instead of the default 14

Operating system

Linux

GLPI Agent version

v1.11

GLPI version

10.0.16

GLPIInventory plugin or other plugin version

Not applicable

Additional context

No response

erique-souza commented 1 month ago

I believe it is the same case for the --full parameter for linux which is also highlighted here: https://glpi-agent.readthedocs.io/en/latest/man/glpi-agent.html#inventory-task-specific-options

{FCA7D163-4B94-4608-93CA-23A2CBD1CB69}

When trying to install glpi-agent passing this --full parameter, the .pl file does not accept it

cd /tmp && apt install wget curl perl -y && wget https://github.com/glpi-project/glpi-agent/releases/download/1.11/glpi-agent-1.11-linux-installer.pl --no-check-certificate && perl glpi-agent-1.11-linux-installer.pl --force --install --full --service --server=https://server.com.br --no-ssl-check --no-category=process --logfile=/var/log/glpi-agent.log --logger=stderr --debug=0 --color=1 --tag=LINUX --httpd-trust=127.0.0.1 --verbose

In the case of what I posted, I tried to use it like this: --full-inventory-postpone=2 in place of --full

g-bougard commented 1 month ago

Hello @erique-souza

...
[Wed Oct 16 20:12:18 2024][debug] Full inventory postponed: 2/2
...

This log line means the current inventory is the second inventory which have to be postponed so the next inventory, the third will be full.

Maybe you misunderstood the meaning of the option: it's really the number of inventories which have to be postponed before sending a full inventory. So when setting it to 2 means you will have 2 postponed inventories between full inventory.

I will check for linux installers option. But about --full option, this is a foreground glpi-agent shortcut option to be used when you want to force a full inventory from the commandline. This one can't be set in config file and so don't have to be supported by installer. You can't use it as replacement for --full-inventory-postpone=0.