skunkie / glpi_sync

Check_MK extension to synchronize information from GLPI
GNU General Public License v2.0
2 stars 1 forks source link

Update for glpi 9.2? #7

Open dwtz opened 6 years ago

dwtz commented 6 years ago

Hi,

since the database structure has been changed in glpi 9.2 is there an update?

skunkie commented 6 years ago

Hi @dwtz, Are there errors while running the plugin?

dwtz commented 6 years ago

Hi @skunkie (1054, "Unknown column 'c.operatingsystems_id' in 'on clause'") The database fields have changed, I think.

dwtz commented 6 years ago

changed c.operatingsystems_id to c.id and the query is running But now the assignment no longer agrees...

dwtz commented 6 years ago
query = """
SELECT c.id host_id,
LOWER(c.name) hostname,
LOWER(s.name) state,
ct.name type,
os.name osname
FROM glpi_computers c
LEFT JOIN glpi_states s
ON c.states_id = s.id
LEFT JOIN glpi_computertypes ct
ON c.computertypes_id = ct.id
LEFT JOIN glpi_items_operatingsystems ios
ON c.id = ios.items_id
LEFT JOIN glpi_operatingsystems os
ON ios.operatingsystems_id = os.id
WHERE c.is_deleted = 0
AND c.is_template = 0
AND LOWER(s.name) IN (%s)
ORDER BY hostname
""" % ', '.join(map(lambda x: '%s', glpi_config['states']))
skunkie commented 6 years ago

good job, @dwtz. Could you make a PR? We need to find the version of GLPI. to make different queries.