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.