Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Communication database in the configuration files.

I am having problems with the communication between OCSInventory-Server and MariaDB, the problem lies in some configuration in OCSInventory.

I explain, my database server MariaDB (192.168.0.128) is separate from OSCInventory-Server (192.168.0.127), in MariaDB is configured the user ocs and the password ocs to access ocsweb correctly remotely. But still the agents do not send the inventory correctly:

"C: \ ProgramData \ OCS Inventory NG \ Agent \ OCSInventory.log"

=====================================================================================

Starting OCS Inventory NG Agent on Thursday, March 22, 2018 16:32:48.

AGENT => Running OCS Inventory NG Agent Version 2.3.1.1

COM SERVER => Sending HTTP Post request to URL <http://192.168.0.127/ocsinventory>

COM SERVER => HTTP Post response received <HTTP Status Code # 500>

ERROR *** AGENT => Failed to send Prolog <HTTP Status Code # 500>

AGENT => Execution duration: 00:00:00.

=====================================================================================

When I check the httpd logs I find the following:

====================================================================================

DBI connect ('database=ocsweb; host=localhost; port=3306', 'ocs', ...) failed: Can not connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' ( 2) at /usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm line 187

====================================================================================

There should not be localhost but the IP of the database (192.168.0.128). However the configurations in the files: z-ocsinventory-server.conf (/etc/httpd/conf.d/z-ocsinventory-server.conf) and dbconfig.inc.php (/usr/ share/ocsinventory-reports/ocsreports/dbconfig.inc.php), I think they are correct:

z-ocsinventory-server.conf

=====================================================================================

PerlSetEnv OCS_DB_HOST 192.168.0.128

  # 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

=====================================================================================

dbconfig.inc.php

=====================================================================================

define ("DB_NAME", "ocsweb");

define ("SERVER_READ", "192.168.0.128");

define ("SERVER_WRITE", "192.168.0.128");

define ("COMPTE_BASE", "ocs");

define ("PSWD_BASE", "ocs");

=====================================================================================

On the other hand, if I directly modify the variable $host of the System.pm file (/usr/local/share/perl5/Apache/Ocsinventory/Server/System.pm), in all options it appears $ENV {'OCS_DB_HOST'} by '192.168.0.128' connects correctly.

But obviously burning the code is not the right thing.

What can be?

PS: SElinux is enabled on the MariaDB server but disabled on OCSInventory. The firewall has the corresponding ports open on each server 80 and 3306.

in OCS Inventory NG server for Unix by (280 points)

3 Answers

0 votes
Can you connect to mariadb from the OCS Server with this command :

mysql -u ocs -h 192.168.0.128 -p

if not : so your database don't listen on the network or ocs account is not configure to be used on the network.
by (22k points)
0 votes

@kapouik... thanks for answering, I can actually log remotely just like you suggest. 

But look what I'm saying when in the file System.pm the variable $host is set by default $ENV {'OCS_DB_HOST'} the result that is bringing back is localhost, but the other configuration files are configured correctly, for example in z-ocsinventory-server.conf is set PerlSetEnv OCS_DB_HOST 192.168.0.128

I don't know if it's a bug or if I'm missing some more configuration.

by (280 points)
0 votes
hi friend,

try to modify ocsinventory.ini too.

Regards
by (650 points)
 
Powered by Question2Answer
...