Topic: Problème ocsinventory-agent --server=localhost

Bonjour,

J'arrive à cette étape du tutoriel pour installer GLPI sans embrouille avec ocsinventory et avec l'aide des rpm du dépôt de Rémi. (Merci beaucoup en passant).

Mais quand je tape dans le terminal :

ocsinvetory-agent --server=localhost

Je n'ai pas de remontée de données à mon serveur, du moins, je n'ai pas de mise a jour de l'interface Ocsinvetory dans "Toutes les machines".
Savez-vous d'où le problème peut venir s'il vous plait?

Re: Problème ocsinventory-agent --server=localhost

Essaie

ocsinventory-agent --server=localhost --debug

Et regarde le contenu de /var/log/ocsinventory-agent/ocsinventory-agent.log

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

Voici le contenu de mon fichier log. Bizarre.

[Mon May 30 03:45:28 2011][info] Accountinfo file doesn't exist. I create an empty one.
[Mon May 30 03:45:29 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 03:45:47 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 03:52:26 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 03:58:19 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 04:01:01 2011] Running ocsinventory-agent --wait 100
[Mon May 30 04:01:02 2011][info] Accountinfo file doesn't exist. I create an empty one.
[Mon May 30 04:01:02 2011][info] Going to sleep for 63 second(s)
[Mon May 30 04:01:06 2011][error] Cannot establish communication : 500 Internal Server Error
Using a hash as a reference is deprecated at /usr/share/perl5/Ocsinventory/Agent/Backend/OS/Linux/Storages/3ware.pm line 120.
[Mon May 30 04:02:14 2011][info] Inventory saved in /var/lib/ocsinventory-agent/localhost-2011-05-30-04-01-02.ocs
[Mon May 30 04:02:14 2011] End of cron job (/sbin:/bin:/usr/sbin:/usr/bin)
[Mon May 30 04:04:35 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 04:06:13 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 12:15:59 2011][error] Cannot establish communication : 500 Internal Server Error
/etc/sysconfig/ocsinventory-agent: line 10: cron: command not found
[Mon May 30 13:01:01 2011] End of cron job (/sbin:/bin:/usr/sbin:/usr/bin)
[Mon May 30 13:09:29 2011][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 1.1.2.1
[Mon May 30 13:09:29 2011][debug] Log system initialised (File)
[Mon May 30 13:09:29 2011][debug] --scan-homedirs missing. Don't scan user directories
[Mon May 30 13:09:29 2011][debug] the --server passed doesn't have a protocol, assume http as default
[Mon May 30 13:09:30 2011][debug] Accountinfo file: /var/lib/ocsinventory-agent/http:__localhost_ocsinventory/ocsinv.adm
[Mon May 30 13:09:30 2011][debug] Turns CompatibilityLayer on for /etc/ocsinventory/modules.conf
[Mon May 30 13:09:30 2011][debug] OCS Agent initialised
[Mon May 30 13:09:30 2011][debug] Calling handlers : `start_handler'
[Mon May 30 13:09:30 2011][debug] Compress::Zlib is available.
[Mon May 30 13:09:30 2011][debug] sending XML
[Mon May 30 13:09:30 2011][debug] Calling handlers : `prolog_writers'
[Mon May 30 13:09:30 2011][debug] sending: <?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <DEVICEID>localhost-2011-05-30-03-45-28</DEVICEID>
  <QUERY>PROLOG</QUERY>
</REQUEST>
[Mon May 30 13:09:30 2011][error] Cannot establish communication : 500 Internal Server Error
[Mon May 30 13:10:20 2011][debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 1.1.2.1
[Mon May 30 13:10:20 2011][debug] Log system initialised (File)
[Mon May 30 13:10:20 2011][debug] --scan-homedirs missing. Don't scan user directories
[Mon May 30 13:10:20 2011][debug] the --server passed doesn't have a protocol, assume http as default
[Mon May 30 13:10:20 2011][debug] Accountinfo file: /var/lib/ocsinventory-agent/http:__localhost_ocsinventory/ocsinv.adm
[Mon May 30 13:10:20 2011][debug] Turns CompatibilityLayer on for /etc/ocsinventory/modules.conf
[Mon May 30 13:10:20 2011][debug] OCS Agent initialised
[Mon May 30 13:10:20 2011][debug] Calling handlers : `start_handler'
[Mon May 30 13:10:20 2011][debug] Compress::Zlib is available.
[Mon May 30 13:10:20 2011][debug] sending XML
[Mon May 30 13:10:20 2011][debug] Calling handlers : `prolog_writers'
[Mon May 30 13:10:20 2011][debug] sending: <?xml version="1.0" encoding="UTF-8"?>
<REQUEST>
  <DEVICEID>localhost-2011-05-30-03-45-28</DEVICEID>
  <QUERY>PROLOG</QUERY>
</REQUEST>
[Mon May 30 13:10:21 2011][error] Cannot establish communication : 500 Internal Server Error 

Et la ligne de commande n'y a rien changé. yikes

Re: Problème ocsinventory-agent --server=localhost

> [Mon May 30 13:10:21 2011][error] Cannot establish communication : 500 Internal Server Error

Donc : voir le log du serveur.


P.S. merci de préciser les OS utilisés

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

Je suis sous fedora 14 i386 pour mon serveur, ainsi que pour mon client.

Ou puis-je vérifier le fichier log du serveur? Du moins, quel fichier dans le fichier log?

Re: Problème ocsinventory-agent --server=localhost

Pour commencer
/var/log/httpd/error_log

Et, en activant les traces dans la configuration du serveur
/var/log/ocsinventory-server/activity.log

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

Voici le fichier log de httpd

[Mon May 30 02:49:31 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon May 30 02:49:31 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 30 02:49:31 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 02:49:31 2011] [notice] Digest: done
[Mon May 30 02:49:31 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 02:49:31 2011] [notice] Apache/2.2.16 (Unix) DAV/2 configured -- resuming normal operations
[Mon May 30 02:57:13 2011] [notice] caught SIGTERM, shutting down
[Mon May 30 02:57:13 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon May 30 02:57:13 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 30 02:57:13 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 02:57:13 2011] [notice] Digest: done
[Mon May 30 02:57:13 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 02:57:13 2011] [notice] Apache/2.2.16 (Unix) DAV/2 configured -- resuming normal operations
[Mon May 30 03:01:20 2011] [notice] caught SIGTERM, shutting down
[Mon May 30 03:01:21 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon May 30 03:01:21 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 30 03:01:22 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 03:01:22 2011] [notice] Digest: done
[Mon May 30 03:01:22 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 03:01:22 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 03:02:08 2011] [error] [client 127.0.0.1] PHP Warning:  mysql_connect(): Access denied for user 'ocs'@'localhost' (using password: YES) in /usr/share/ocsinventory-reports/ocsreports/preferences.php on line 339
[Mon May 30 03:02:08 2011] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Mon May 30 03:02:11 2011] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
[Mon May 30 03:29:37 2011] [notice] SIGHUP received.  Attempting to restart
[Mon May 30 03:29:38 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 03:29:38 2011] [notice] Digest: done
[Mon May 30 03:29:38 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 03:29:38 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 03:45:29 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 03:45:47 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 03:52:26 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 03:58:19 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 04:01:06 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 04:04:35 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 04:06:13 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
SV = PV(0x2c32a00) at 0x2c2c6c0
  REFCNT = 2
  FLAGS = ()
  PV = 0
SV = PV(0x2c3cc80) at 0x2c36940
  REFCNT = 2
  FLAGS = ()
  PV = 0
SV = PV(0x2c464e0) at 0x2c34520
  REFCNT = 2
  FLAGS = ()
  PV = 0
SV = PV(0x2810bb8) at 0x280a878
  REFCNT = 2
  FLAGS = ()
  PV = 0
[Mon May 30 12:15:27 2011] [notice] SIGHUP received.  Attempting to restart
[Mon May 30 12:15:28 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 12:15:28 2011] [notice] Digest: done
[Mon May 30 12:15:29 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 12:15:29 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 12:15:36 2011] [notice] caught SIGTERM, shutting down
[Mon May 30 12:15:38 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon May 30 12:15:38 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 30 12:15:38 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 12:15:38 2011] [notice] Digest: done
[Mon May 30 12:15:38 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 12:15:39 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 12:15:59 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
SV = PV(0xb74f7420) at 0xb74e5858
  REFCNT = 2
  FLAGS = ()
  PV = 0
[Mon May 30 13:00:16 2011] [notice] caught SIGTERM, shutting down
[Mon May 30 13:00:27 2011] [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
[Mon May 30 13:00:27 2011] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon May 30 13:00:28 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 13:00:28 2011] [notice] Digest: done
[Mon May 30 13:00:29 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 13:00:30 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 13:03:03 2011] [notice] SIGHUP received.  Attempting to restart
[Mon May 30 13:03:04 2011] [notice] Digest: generating secret for digest authentication ...
[Mon May 30 13:03:04 2011] [notice] Digest: done
[Mon May 30 13:03:04 2011] [warn] ./mod_dnssd.c: No services found to register
[Mon May 30 13:03:04 2011] [notice] Apache/2.2.16 (Unix) DAV/2 PHP/5.3.6 mod_perl/2.0.4 Perl/v5.12.3 configured -- resuming normal operations
[Mon May 30 13:09:30 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n
[Mon May 30 13:10:20 2011] [error] [client 127.0.0.1] Can't call method "rollback" on an undefined value at /usr/share/perl5/Apache/Ocsinventory/Server/System.pm line 265.\n

Et voilà le fichier activity.log

Mon May 30 03:45:29 2011;31374;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 03:45:47 2011;31377;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 03:52:26 2011;31372;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 03:58:19 2011;31370;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 04:01:06 2011;31372;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 04:04:35 2011;31377;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 04:06:13 2011;31370;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 12:15:59 2011;32093;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 13:09:30 2011;32295;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection
Mon May 30 13:10:20 2011;32294;505;NA;127.0.0.1;OCS-NG_unified_unix_agent_v1.1.2.1;handler;Database connection

Re: Problème ocsinventory-agent --server=localhost

tu peux vérifier les identifiants de connexion à la DB
1/ dans /etc/ocsinventory/ocsinventory-reports/dbconfig.inc.php (COMPTE_BASE, PSWD_BASE)
2/ dans /etc/httpd/conf.d/ocsinventory-server.conf (OCS_DB_USER, OCS_DB_PWD)
3/ test de connexion en ligne de commande

mysql -uxxxx -pyyyy ocsweb -e "SELECT * FROM config WHERE NAME = 'GUI_VERSION'"
Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

à tester aussi, dans /etc/httpd/conf.d/ocsinventory-server.conf, modifier

PerlSetEnv OCS_OPT_DBI_PRINT_ERROR 1

et relancer apache, puis un inventaire

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

  
# Master Database settings
  
# Replace localhost by hostname or ip of MySQL server for WRITE
  PerlSetEnv OCS_DB_HOST localhost
  
# Replace 3306 by port where running MySQL server, generally 3306
  PerlSetEnv OCS_DB_PORT 3306
  
# Name of database
  PerlSetEnv OCS_DB_NAME ocsweb
  PerlSetEnv OCS_DB_LOCAL ocsweb
  
# User allowed to connect to database
  PerlSetEnv OCS_DB_USER ocs
  
# Password for user
  PerlSetVar OCS_DB_PWD ocs 
// Il faut que je mette les mêmes identifiants qu'en slave pour la connexion?

  

# Slave Database settings
  
# Replace localhost by hostname or ip of MySQL server for READ
  
# Useful if you handle mysql slave databases
  
# PerlSetEnv OCS_DB_SL_HOST localhost
  
# Replace 3306 by port where running MySQL server, generally 3306
  
# PerlSetEnv OCS_DB_SL_PORT_SLAVE 3306
  
# User allowed to connect to database
  
# PerlSetEnv OCS_DB_SL_USER ocs
  
# Name of the database
  
# PerlSetEnv OCS_DB_SL_NAME ocsweb
  
# Password for user
  # PerlSetVar OCS_DB_SL_PWD ocssecret
  

Voilà le fichier oscinventory-report



<?php 

$_SESSION["SERVEUR_SQL"]="localhost";

$_SESSION["COMPTE_BASE"]="ocs";

$_SESSION["PSWD_BASE"]="ocssecret";

?>

Je n'ai aucune réponse au test de connexion, est-ce normal?

Re: Problème ocsinventory-agent --server=localhost

Le mot de passe dans le fichier ocsinventory-server.conf n'est pas le bon, il faut le corriger.
(c'est d'ailleurs bien indiqué dans le tuto)

Le test de connexion "doit" fonctionner, avec le bon mot de passe:

mysql --user=ocs --password=ocssescret ocsweb -e "SELECT * FROM config WHERE NAME = 'GUI_VERSION'"

+

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Problème ocsinventory-agent --server=localhost

Voilà, j'ai réussi à configurer correctement mon serveur Glpi.

Merci beaucoup pour cette aide précieuse. Franchement merci.

A la prochaine pour de nouvelles aventures Fedora smile !

Cordialement.

Gérald.