You are not logged in.
Pages: 1
Topic closed
Bonjour,
je rencontre à l'heure actuelle à un petit soucis de synchronisation OCS / GLPI, je m'explique :
Installation du plugin OCS_MASS_IMPORT --> OK
Configuration du plugin OCS_MASS_IMPORT --> OK
Modification des PATH dans script OCS_MASS_IMPORT --> OK
Ajout variable d'environnement Windows --> OK
Nombre d'éléments à synchroniser via le cron = 0 --> OK
Lorsque j'exécute le script, aucune erreur mais aucun import dans GLPI (la synchronisation manuelle fonctionne elle par contre).
Pour exemple, une nouvelle machine est arrivée dans OCS mais impossible de la rappatrier dans GLPI automatiquement, de plus et pour les machines existantes, dans Inventaire / Ordinateur, je vois :
Date dernier inventaire OCS: 24-12-2008 01:07
Date d'import dans GLPI: 24-12-2008 08:58
Serveur localhost , Agent : OCS-NG_windows_client_v4032
Alors que le dernier inventaire date de ce jour 11:07...
J'ai lu un maximum de post, le wiki... mais je passe à côté de quelque chose...
Merci d'avance.
Pour information :
Windows XP / XAMPP 1.5.5
GLPI 0.71.2
OCSNG 1.01
Offline
et dans les logs ? en mode debug ?
qu'est ce qui se passe ?
Offline
J'ai exactement le même problème que nmx. Si je lance la synchro manuellement :
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.sh --thread_nbr=2 --server_id=1
il n'y a aucune imporattion ni mise à jour.
Les logs donne :
mardi 30 décembre 2008, 10:14:45 (UTC+0100) /var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.sh started
Clean old Not Imported machine list (0)
Manage delete items in OCS server #1: "ashglpi.groupe.loc"
Thread #1 : starting (1/2)
thread #1 : import computers from server: 'ashglpi.groupe.loc'
thread #1 : computer(s)
^MThread #1 : done ..
Thread #2 : starting (2/2)
thread #2 : import computers from server: 'ashglpi.groupe.loc'
thread #2 : computer(s)
^MThread #2 : done ..
cleaning up.
mardi 30 décembre 2008, 10:14:51 (UTC+0100) ended
En mode debug du script, ça donne :
++ dirname /var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.sh
+ cd /var/www/glpirms07/plugins/mass_ocs_import/scripts
++ cat
++ php -q
+ eval GLPI_LOG_DIR=../../../files/_log GLPI_LOCK_DIR=../../../files/_lock
++ GLPI_LOG_DIR=../../../files/_log
++ GLPI_LOCK_DIR=../../../files/_lock
++ date +%j%H%M
+ PROCESS_ID=3651005
+ pid_dir=/tmp
+ pidfile=/tmp/ocsng_fullsync.pid
+ runningpid=
+ scriptname=ocsng_fullsync.sh
+ logfilename=ocsng_fullsync.log
+ thread_nbr=2
+ server_id=
+ trap cleanup 1 2 3 6
+ '[' '!' -w ../../../files/_lock ']'
+ read_argv --server_id=1 --thread_nbr=2 --server_id=1
+ for i in '$@'
++ echo --server_id=1
++ sed 's/--\(.*\)=.*/\1/'
+ valname=server_id
++ echo --server_id=1
++ sed 's/--.*=\(.*\)/\1/'
+ valcontent=1
+ '[' -z server_id ']'
+ case "$valname" in
+ server_id=1
+ for i in '$@'
++ echo --thread_nbr=2
++ sed 's/--\(.*\)=.*/\1/'
+ valname=thread_nbr
++ echo --thread_nbr=2
++ sed 's/--.*=\(.*\)/\1/'
+ valcontent=2
+ '[' -z thread_nbr ']'
+ case "$valname" in
+ thread_nbr=2
+ for i in '$@'
++ echo --server_id=1
++ sed 's/--\(.*\)=.*/\1/'
+ valname=server_id
++ echo --server_id=1
++ sed 's/--.*=\(.*\)/\1/'
+ valcontent=1
+ '[' -z server_id ']'
+ case "$valname" in
+ server_id=1
+ '[' -n ocsng_fullsync.log ']'
+ exec
L'interface du plugin confirme qu'il n'y a eu aucune importation ni mise a jour de machine.
L'importation et la mise à jour manuelle par l'interface GLPI fonctionnent parfaitement. C'est ce que je fais régulièrement, en attendant que ce plugin fonctionne.
GLPI 10.0.6 with GLPI Inventory 1.1.0 on Debian bullseye
Offline
C'est pas le mode debug du script qui nous intéresse, mais le mode debug de GLPI (voir documentation).
Et aussi la version de MySQL
++
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Autant pour moi.
MySQL :
mysql -V
mysql Ver 14.12 Distrib 5.0.51, for debian-linux-gnu (i486) using readline 5.2
Information de debug de la page du plugin, si c'est bien ce à quoi vous faites allusion :
N° Queries Time Errors
1 SELECT *
FROM glpi_plugin_mass_ocs_import_config
WHERE (ID = 1) 0.003
2 SELECT ID, process_id, SUM(total_number_machines) AS total_machines,ocs_server_id, status, COUNT(*) AS threads_number, MIN(start_time) AS starting_date, MAX(end_time) AS ending_date, TIME_TO_SEC(MAX(end_time))-TIME_TO_SEC(MIN(start_time)) AS duree, SUM(imported_machines_number) AS imported_machines, SUM(synchronized_machines_number) AS synchronized_machines, SUM(linked_machines_number) AS linked_machines, SUM(failed_rules_machines_number) AS failed_rules_machines, end_time >= DATE_ADD(NOW(), INTERVAL -2 HOUR) AS DoStat
FROM glpi_plugin_mass_ocs_import GROUP BY process_id
ORDER BY ID DESC 0.004
3 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651300 0.002
4 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
5 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651200 0.005
6 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
7 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651100 0.003
8 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
9 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651014 0.002
10 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
11 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3641006 0.003
12 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
13 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651005 0.000
14 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.002
15 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3651000 0.000
16 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
17 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3650908 0.001
18 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.002
19 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531721 0.000
20 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.003
21 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531720 0.001
22 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.002
23 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531718 0.005
24 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
25 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531717 0.001
26 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.000
27 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531715 0.003
28 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
29 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531701 0.002
30 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
31 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531659 0.000
32 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.001
33 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3531657 0.001
34 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.003
35 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3511524 0.001
36 SELECT *
FROM glpi_ocs_config
WHERE ID='1' 0.002
37 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171437 0.001
38 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171434 0.004
39 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171432 0.000
40 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3161430 0.002
41 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171428 0.002
42 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171426 0.001
43 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171425 0.003
44 SELECT status
FROM glpi_plugin_mass_ocs_import
WHERE process_id=3171423 0.001
POST VARIABLE
GET VARIABLE
SESSION VARIABLE
KEY => VALUE
glpi_currenttime => 2008-12-30 13:20:38
glpiID => 100
glpiname => fledorze
glpirealname => Fabrice FLD. Le Dorze
glpifirstname => Fabrice
glpilanguage => fr_FR
glpidefault_entity => 0
glpitracking_order => 0
glpiauthorisation => 1
glpiextauth => 1
glpiauth_method => 3
glpisearchcount =>
KEY => VALUE
1 => 1
4 => 1
6 => 1
2 => 1
5 => 1
3 => 1
23 => 1
glpisearchcount2 =>
KEY => VALUE
1 => 0
4 => 0
6 => 0
2 => 0
5 => 0
3 => 0
23 => 0
glpiroot =>
glpilist_limit => 200
glpicrontimer => 1230639590
glpi_plugin_archires_profile =>
KEY => VALUE
ID => 4
name => super-admin
interface => archires
is_default => 0
archires => w
glpi_plugin_archires_installed => 1
glpi_plugin_applicatifs_profile =>
KEY => VALUE
ID => 4
name => super-admin
interface => applicatifs
is_default => 0
applicatifs => w
glpi_plugin_applicatifs_installed => 1
glpi_plugin_mass_ocs_import_installed => 1
glpi_plugin_addressing_profile =>
KEY => VALUE
ID => 4
name => super-admin
interface => addressing
is_default => 0
addressing => w
glpi_plugin_addressing_installed => 1
glpiprofiles =>
KEY => VALUE
4 =>
KEY => VALUE
ID => 4
name => super-admin
interface => central
is_default => 0
computer => w
monitor => w
software => w
networking => w
printer => w
peripheral => w
cartridge => w
consumable => w
phone => w
notes => w
contact_enterprise => w
document => w
contract_infocom => w
knowbase => w
faq => r
reservation_helpdesk => 1
reservation_central => w
reports => r
ocsng => w
view_ocsng => r
sync_ocsng => w
dropdown => w
entity_dropdown => w
device => w
typedoc => w
link => w
config => w
rule_tracking => w
rule_ocs => w
rule_ldap => w
rule_softwarecategories => w
search_config => w
search_config_global => w
check_update => r
profile => w
user => w
user_auth_method => w
group => w
entity => w
transfer => w
logs => r
reminder_public => w
bookmark_public => w
backup => w
create_ticket => 1
delete_ticket => 1
comment_ticket => 1
comment_all_ticket => 1
update_ticket => 1
own_ticket => 1
steal_ticket => 1
assign_ticket => 1
show_all_ticket => 1
show_assign_ticket => 1
show_full_ticket => 1
observe_ticket => 1
update_followups => 1
show_planning => 1
show_group_planning => 1
show_all_planning => 1
statistic => 1
password_update => 1
helpdesk_hardware => 2
helpdesk_hardware_type => 8388674
show_group_ticket => 1
show_group_hardware => 1
rule_dictionnary_software => w
rule_dictionnary_dropdown => w
entities =>
KEY => VALUE
105 =>
KEY => VALUE
ID => 0
name =>
completename =>
recursive => 0
glpiactiveprofile =>
KEY => VALUE
ID => 4
name => super-admin
interface => central
is_default => 0
computer => w
monitor => w
software => w
networking => w
printer => w
peripheral => w
cartridge => w
consumable => w
phone => w
notes => w
contact_enterprise => w
document => w
contract_infocom => w
knowbase => w
faq => r
reservation_helpdesk => 1
reservation_central => w
reports => r
ocsng => w
view_ocsng => r
sync_ocsng => w
dropdown => w
entity_dropdown => w
device => w
typedoc => w
link => w
config => w
rule_tracking => w
rule_ocs => w
rule_ldap => w
rule_softwarecategories => w
search_config => w
search_config_global => w
check_update => r
profile => w
user => w
user_auth_method => w
group => w
entity => w
transfer => w
logs => r
reminder_public => w
bookmark_public => w
backup => w
create_ticket => 1
delete_ticket => 1
comment_ticket => 1
comment_all_ticket => 1
update_ticket => 1
own_ticket => 1
steal_ticket => 1
assign_ticket => 1
show_all_ticket => 1
show_assign_ticket => 1
show_full_ticket => 1
observe_ticket => 1
update_followups => 1
show_planning => 1
show_group_planning => 1
show_all_planning => 1
statistic => 1
password_update => 1
helpdesk_hardware => 2
helpdesk_hardware_type => 8388674
show_group_ticket => 1
show_group_hardware => 1
rule_dictionnary_software => w
rule_dictionnary_dropdown => w
entities =>
KEY => VALUE
105 =>
KEY => VALUE
ID => 0
name =>
completename =>
recursive => 0
glpi_entities_tree =>
KEY => VALUE
0 =>
KEY => VALUE
0 =>
KEY => VALUE
tree =>
name => Entité Racine
glpiactiveentities =>
KEY => VALUE
0 => 0
glpi_entities_ancestors =>
KEY => VALUE
0 =>
glpiactive_entity => 0
glpiactive_entity_name => Entité Racine (arborescence)
glpiactive_entity_shortname => Entité Racine (arborescence)
glpishowallentities => 1
glpigroups =>
glpi_plugins =>
KEY => VALUE
0 => service
1 => utilitaires
2 => archires
3 => applicatifs
4 => mass_ocs_import
5 => parametre
6 => �~
7 => addressing
glpiprofile =>
KEY => VALUE
Glpiu => w
MESSAGE_AFTER_REDIRECT =>
glpi_multientitiesmode => 0
glpi_viewcentral => my
glpisearch =>
KEY => VALUE
1 =>
KEY => VALUE
start => 0
order => ASC
deleted => 0
distinct => N
link =>
field =>
KEY => VALUE
0 => view
contains =>
KEY => VALUE
0 =>
link2 =>
field2 =>
KEY => VALUE
0 => view
contains2 =>
KEY => VALUE
0 =>
type2 =>
sort => 1
glpimassiveactionselected =>
glpi_configgen => 1
GLPI 10.0.6 with GLPI Inventory 1.1.0 on Debian bullseye
Offline
Non, c'est plutot le contenu des journaux (php-error et sql-error) après le passage du script.
++
P.S. pour mémoire l'import manuel d'ordinateurs bloque la synchro sur les inventaires postérieurs à l'import manuel.
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Voici :
php-errors.log
2008-12-30 21:46:06
Warning(2): mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Backtrace :
/var/www/glpirms07/inc/dbmysql.class.php:172 mysql_fetch_array()
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:286 DBmysql->fetch_array()
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:244 importFromOcsServer()
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:144 SecondPass()
sql-errors.log
2008-12-30 21:46:06
*** MySQL query error :
***
SQL: SELECT ID FROM hardware INNER JOIN accountinfo ON (hardware.ID = accountinfo.HARDWARE_ID) WHERE ((CHECKSUM&122311)>0 OR LASTDATE > \'2008-12-30 03:47:02\') AND LASTDATE < TIMESTAMPADD(MINUTE,-3,now()) AND ID<=7675 AND ID % 2 = 1 AND accountinfo.TAG IN (\'rms-gre\',\'ms-gre\',\'as-gre\',\'apx-gre\')
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(MINUTE,-3,now()) AND ID<=7675 AND ID % 2 = 1 AND accountinfo.TAG IN ('rms-gre' at line 1
Backtrace :
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:280 DBmysql->query()
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:244 importFromOcsServer()
/var/www/glpirms07/plugins/mass_ocs_import/scripts/ocsng_fullsync.php:144 SecondPass()
ocsng_fullsync.php
Bingo. C'est un problème avec la requête SQL. C'est le "LASTDATE < TIMESTAMPADD(MINUTE,-3,now())" qui ne passe chez moi.
En fait, le serveur OCS est géré par une autre administrateur. Nous en importons que les machines de notre division.
Et le serveur MySQL est une version 4, qui, si je comprend bien, ne connaît pas cette fonction TIMESTAMPADD.
La solution est donc chez nous (inciter l'admin a mettre à jour sa version de MySQL ou ne pas utiliser le plugin).
Merci de votre aide.
GLPI 10.0.6 with GLPI Inventory 1.1.0 on Debian bullseye
Offline
Ben voila ce que je voulais savoir : la version MySQL.
Il faut donc appliquer le correctif : https://dev.indepnet.net/plugins/changeset/7301
++
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Cela fonctionne.
Désolé pour ma méprise entre la version du client MySQL et celle du serveur MySQL.
Je suppose que ce correctif sera appliqué dans la version 1.2.1.
Merci encore.
GLPI 10.0.6 with GLPI Inventory 1.1.0 on Debian bullseye
Offline
ok, je clos donc.
Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/
Offline
Pages: 1
Topic closed