glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
46 stars 27 forks source link

GLPI agent not reporting in GLPI Inventory agent management #294

Closed lexcyr closed 1 year ago

lexcyr commented 1 year ago

Describe the bug

After installation of GLPI agent on a computer, it's not reporting in the list of agent in the glpi inventory agent management section of the glpi inventory plugin. If i use the search filter and search for that server name, i can find it, but when i clic on it i am redirected to the home page.

To reproduce

  1. Install the glpi inventory plugin on your glpi server 10.0.5
  2. Install the glpi agent 1.4 on a computer with option run inventory after installation
  3. Navigate to "Administration » GLPI Inventory » General » Agent Management"
  4. Activate the search filter
  5. Search for the computer
  6. Clic on the computer in the result

Expected behavior

Have the glpi agent registered in the glpi inventory agent management list. And be able to config and activate/deactivate agent module.

Operating system

Windows

GLPI Agent version

1.4

GLPI version

10.0.5

GLPIInventory plugin

1.0.6

Additional context

No response

cedric-anne commented 1 year ago

Hi,

Could you please try to upgrade GLPI to version 10.0.6 and plugin to version 1.1.0 and check if problem persists ?

lexcyr commented 1 year ago

Update done, but still not able to have the computer reporting in the agent mangament list. this is the error i am having the Agent log: image

i feel like i am doing something wrong in the configuration of the agent but i am not able to find what. The only things i am setting during the agent configuration for the moment iare the server link (http://_glpi_server_IP_/glpi/plugins/glpiinventory) and disable the ssl_check.

GLPI 10.0.6 GLPI Inventory 1.1.0 GLPI Agent 1.4

lexcyr commented 1 year ago

I ran a php bin/console glpi:database:check_schema_integrity and i got some differences for the glpi_agent table:

--- Schéma attendu de la base de données
+++ Schéma actuel de la base de données
@@ @@
 CREATE TABLE glpi_agents (
-  id int NOT NULL AUTO_INCREMENT,
-  agenttypes_id int NOT NULL,
-  deviceid varchar(255) NOT NULL,
-  entities_id int NOT NULL DEFAULT 0,
-  is_recursive tinyint NOT NULL DEFAULT 0,
-  items_id int NOT NULL,
-  itemtype varchar(100) NOT NULL,
-  last_contact datetime,
-  locked tinyint NOT NULL DEFAULT 0,
-  name varchar(255),
-  port varchar(6),
-  remote_addr varchar(255),
-  tag varchar(255),
-  threads_networkdiscovery int NOT NULL DEFAULT 1,
-  threads_networkinventory int NOT NULL DEFAULT 1,
-  timeout_networkdiscovery int NOT NULL DEFAULT 0,
-  timeout_networkinventory int NOT NULL DEFAULT 0,
-  use_module_collect_data tinyint NOT NULL DEFAULT 0,
-  use_module_computer_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_esx_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_network_discovery tinyint NOT NULL DEFAULT 0,
-  use_module_network_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_package_deployment tinyint NOT NULL DEFAULT 0,
-  use_module_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_wake_on_lan tinyint NOT NULL DEFAULT 0,
-  useragent varchar(255),
-  version varchar(255),
-  PRIMARY KEY (id),
-  UNIQUE KEY deviceid (deviceid),
-  KEY agenttypes_id (agenttypes_id),
-  KEY entities_id (entities_id),
-  KEY is_recursive (is_recursive),
-  KEY item (itemtype,items_id),
-  KEY name (name)
-)
+id int(10) unsigned NOT NULL,
+deviceid varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+entities_id int(10) unsigned NOT NULL DEFAULT 0,
+is_recursive tinyint(4) NOT NULL DEFAULT 0,
+name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+agenttypes_id int(10) unsigned NOT NULL,
+last_contact timestamp NULL DEFAULT NULL,
+version varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+locked tinyint(4) NOT NULL DEFAULT 0,
+itemtype varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
+items_id int(10) unsigned NOT NULL,
+useragent varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+tag varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+port varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+threads_networkdiscovery int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network discovery',
+threads_networkinventory int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network inventory',
+timeout_networkdiscovery int(11) NOT NULL DEFAULT 0 COMMENT 'Network Discovery task timeout (disabled by default)',
+timeout_networkinventory int(11) NOT NULL DEFAULT 0 COMMENT 'Network Inventory task timeout (disabled by default)',
+remote_addr varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+use_module_wake_on_lan tinyint(4) NOT NULL DEFAULT 0,
+use_module_computer_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_esx_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_discovery tinyint(4) NOT NULL DEFAULT 0,
+use_module_package_deployment tinyint(4) NOT NULL DEFAULT 0,
+use_module_collect_data tinyint(4) NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC

is there a way or command to auto fix the database schema?

thanks in advance.

cedric-anne commented 1 year ago

I ran a php bin/console glpi:database:check_schema_integrity and i got some differences for the glpi_agent table:

--- Schéma attendu de la base de données
+++ Schéma actuel de la base de données
@@ @@
 CREATE TABLE glpi_agents (
-  id int NOT NULL AUTO_INCREMENT,
-  agenttypes_id int NOT NULL,
-  deviceid varchar(255) NOT NULL,
-  entities_id int NOT NULL DEFAULT 0,
-  is_recursive tinyint NOT NULL DEFAULT 0,
-  items_id int NOT NULL,
-  itemtype varchar(100) NOT NULL,
-  last_contact datetime,
-  locked tinyint NOT NULL DEFAULT 0,
-  name varchar(255),
-  port varchar(6),
-  remote_addr varchar(255),
-  tag varchar(255),
-  threads_networkdiscovery int NOT NULL DEFAULT 1,
-  threads_networkinventory int NOT NULL DEFAULT 1,
-  timeout_networkdiscovery int NOT NULL DEFAULT 0,
-  timeout_networkinventory int NOT NULL DEFAULT 0,
-  use_module_collect_data tinyint NOT NULL DEFAULT 0,
-  use_module_computer_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_esx_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_network_discovery tinyint NOT NULL DEFAULT 0,
-  use_module_network_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_package_deployment tinyint NOT NULL DEFAULT 0,
-  use_module_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_wake_on_lan tinyint NOT NULL DEFAULT 0,
-  useragent varchar(255),
-  version varchar(255),
-  PRIMARY KEY (id),
-  UNIQUE KEY deviceid (deviceid),
-  KEY agenttypes_id (agenttypes_id),
-  KEY entities_id (entities_id),
-  KEY is_recursive (is_recursive),
-  KEY item (itemtype,items_id),
-  KEY name (name)
-)
+id int(10) unsigned NOT NULL,
+deviceid varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+entities_id int(10) unsigned NOT NULL DEFAULT 0,
+is_recursive tinyint(4) NOT NULL DEFAULT 0,
+name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+agenttypes_id int(10) unsigned NOT NULL,
+last_contact timestamp NULL DEFAULT NULL,
+version varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+locked tinyint(4) NOT NULL DEFAULT 0,
+itemtype varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
+items_id int(10) unsigned NOT NULL,
+useragent varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+tag varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+port varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+threads_networkdiscovery int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network discovery',
+threads_networkinventory int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network inventory',
+timeout_networkdiscovery int(11) NOT NULL DEFAULT 0 COMMENT 'Network Discovery task timeout (disabled by default)',
+timeout_networkinventory int(11) NOT NULL DEFAULT 0 COMMENT 'Network Inventory task timeout (disabled by default)',
+remote_addr varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+use_module_wake_on_lan tinyint(4) NOT NULL DEFAULT 0,
+use_module_computer_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_esx_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_discovery tinyint(4) NOT NULL DEFAULT 0,
+use_module_package_deployment tinyint(4) NOT NULL DEFAULT 0,
+use_module_collect_data tinyint(4) NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC

is there a way or command to auto fix the database schema?

thanks in advance.

In you case, you should probably launch bin/console migration:migrate_all command.

stonebuzz commented 1 year ago

Any PHP / SQL error log from GLPI during inventory ?

lexcyr commented 1 year ago

I ran a php bin/console glpi:database:check_schema_integrity and i got some differences for the glpi_agent table:

--- Schéma attendu de la base de données
+++ Schéma actuel de la base de données
@@ @@
 CREATE TABLE glpi_agents (
-  id int NOT NULL AUTO_INCREMENT,
-  agenttypes_id int NOT NULL,
-  deviceid varchar(255) NOT NULL,
-  entities_id int NOT NULL DEFAULT 0,
-  is_recursive tinyint NOT NULL DEFAULT 0,
-  items_id int NOT NULL,
-  itemtype varchar(100) NOT NULL,
-  last_contact datetime,
-  locked tinyint NOT NULL DEFAULT 0,
-  name varchar(255),
-  port varchar(6),
-  remote_addr varchar(255),
-  tag varchar(255),
-  threads_networkdiscovery int NOT NULL DEFAULT 1,
-  threads_networkinventory int NOT NULL DEFAULT 1,
-  timeout_networkdiscovery int NOT NULL DEFAULT 0,
-  timeout_networkinventory int NOT NULL DEFAULT 0,
-  use_module_collect_data tinyint NOT NULL DEFAULT 0,
-  use_module_computer_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_esx_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_network_discovery tinyint NOT NULL DEFAULT 0,
-  use_module_network_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_package_deployment tinyint NOT NULL DEFAULT 0,
-  use_module_remote_inventory tinyint NOT NULL DEFAULT 0,
-  use_module_wake_on_lan tinyint NOT NULL DEFAULT 0,
-  useragent varchar(255),
-  version varchar(255),
-  PRIMARY KEY (id),
-  UNIQUE KEY deviceid (deviceid),
-  KEY agenttypes_id (agenttypes_id),
-  KEY entities_id (entities_id),
-  KEY is_recursive (is_recursive),
-  KEY item (itemtype,items_id),
-  KEY name (name)
-)
+id int(10) unsigned NOT NULL,
+deviceid varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+entities_id int(10) unsigned NOT NULL DEFAULT 0,
+is_recursive tinyint(4) NOT NULL DEFAULT 0,
+name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+agenttypes_id int(10) unsigned NOT NULL,
+last_contact timestamp NULL DEFAULT NULL,
+version varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+locked tinyint(4) NOT NULL DEFAULT 0,
+itemtype varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
+items_id int(10) unsigned NOT NULL,
+useragent varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+tag varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+port varchar(6) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+threads_networkdiscovery int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network discovery',
+threads_networkinventory int(11) NOT NULL DEFAULT 1 COMMENT 'Number of threads for Network inventory',
+timeout_networkdiscovery int(11) NOT NULL DEFAULT 0 COMMENT 'Network Discovery task timeout (disabled by default)',
+timeout_networkinventory int(11) NOT NULL DEFAULT 0 COMMENT 'Network Inventory task timeout (disabled by default)',
+remote_addr varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+use_module_wake_on_lan tinyint(4) NOT NULL DEFAULT 0,
+use_module_computer_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_esx_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_remote_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_inventory tinyint(4) NOT NULL DEFAULT 0,
+use_module_network_discovery tinyint(4) NOT NULL DEFAULT 0,
+use_module_package_deployment tinyint(4) NOT NULL DEFAULT 0,
+use_module_collect_data tinyint(4) NOT NULL DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC

is there a way or command to auto fix the database schema? thanks in advance.

In you case, you should probably launch bin/console migration:migrate_all command.

After running the migration command it says there is no migration requiered image

cedric-anne commented 1 year ago

What is the result of php bin/console glpi:database:check_schema_integrity now ?

lexcyr commented 1 year ago

Any PHP / SQL error log from GLPI during inventory ?

no PHP error log from GLPI during inventory, but i have only one warning about that specific computer on the SQL log image

lexcyr commented 1 year ago

What is the result of php bin/console glpi:database:check_schema_integrity now ? no change in the result, exactly the same. i have tried to manually fix the collumn "id" directely from the database and the new result of php bin/console glpi:database:check_schema_integrity is the following: image

i don't know if it's safe to continue with manual changes in the database, or if it's possible to have a clean glpi_agent table, flush the actual one and just import it? As from what i can see it just contains the glpi_agent list, and my glpi agent are installed as a service on my computers they will register again when they will contact the server based on their next planned time.

lexcyr commented 1 year ago

So i have exported the gpli_agent table from my test environement where i had no error on the schema integrity checks and imported it on the problematic glpi server. It seems it had resolved the db schema issue. image

After flushing all the glpi agent recorded in the agent management list , it registers them back progressively based on their next planned server contact.

I am using this GLPI server only for asset management and i am not experiencing any other proglem. At least for the moment.

cedric-anne commented 1 year ago

Hi,

I close the issue as problem seems to have dissapear. Feel fre to reopen if problem comes back.