hi,
i tried to set up OCS and solved some problems, but i dont get it finaly working.
Now the problem is, that the Agent cannot connect to the Server. I get an error from the Agent:
2020][error] Cannot establish communication : 500 Internal Server Error
My ocs Server Veriosn is 2.4 (from the repository for CentOs7)
Agent Version is:
ocsinventory-agent --version
Ocsinventory unified agent for UNIX, Linux and MacOSX (2.6.1)
[root@myserver ~]#
Erlier i tried the latest version from the GitHub Repo, but don't get it working.
the ocsimport-reports configuration looks like the following. I made an new VHost for ocd, because when i leave the standard configuration like mydomain.de/ocsiventory i get an 400 (bad request) error.
<VirtualHost *:80>
ServerName ocs.mydomain.de
ServerAlias www.ocs.mydomain.de
ServerAlias ocs.mydomain.de *.ocs.mydomain.de
Alias /ocsreports /usr/share/ocsinventory-reports/ocsreports
DocumentRoot /usr/share/ocsinventory-reports/ocsreports
<Directory /usr/share/ocsinventory-reports/ocsreports>
# By default, users can use console from everywhere
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
Options Indexes FollowSymLinks
DirectoryIndex index.php
AllowOverride Options
# Uncomment following to force use of HTTPS in Administration Server
#SSLRequireSSL
# PHP tuning (not working on all distribution, use php.ini instead)
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag file_uploads on
# Some PHP tuning for deployment feature up to 8 MB
# post_max_size must be greater than upload_max_filesize
# because of HTTP headers
php_value post_max_size 101m
php_value upload_max_filesize 100m
# You may have to uncomment following on errors
#php_value max_execution_time -1
#php_value max_input_time -1
# Uncomment following if you need to specify a mysql socket
#php_value mysql.default_socket "path/to/mysql/unix/socket"
#!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly)
php_flag magic_quotes_gpc off
</IfModule>
# Duplicate for php7 compatibility
<IfModule mod_php7.c>
AddType application/x-httpd-php .php
php_flag file_uploads on
# Some PHP tuning for deployment feature up to 8 MB
# post_max_size must be greater than upload_max_filesize
# because of HTTP headers
php_value post_max_size 101m
php_value upload_max_filesize 100m
# You may have to uncomment following on errors
#php_value max_execution_time -1
#php_value max_input_time -1
# Uncomment following if you need to specify a mysql socket
#php_value mysql.default_socket "path/to/mysql/unix/socket"
#!! Mandatory !! : set magic_quotes_gpc to off (to make ocsreports works correctly)
php_flag magic_quotes_gpc off
</IfModule>
# Uncomment following to allow HTTP body request up to 4 MB
# instead default 512 KB
#LimitRequestBody 4194304
</Directory>
################################################################################
# Deployment packages download area
#
# Alias to put Deployment package files outside Apache document root directory
#
<Directory /var/lib/ocsinventory-reports/download>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias /download /var/lib/ocsinventory-reports/download
################################################################################
# Snmp communities area
#
# Alias to put Snmp custom Mibs files outside Apache document root directory
#
<Directory /var/lib/ocsinventory-reports/snmp>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias /snmp /var/lib/ocsinventory-reports/snmp
# Patch from RPM : allow apache to serv plugins directory
<Directory /var/lib/ocsinventory-reports/plugins>
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
</Directory>
Alias /plugins /var/lib/ocsinventory-reports/plugins
</VirtualHost>
All my Domains have there own vhost. So that seeems to be the best Solution for me.
I tried to find a solution for the error, but found nothing.
- From the apache access.log (debug level):
xxx.xxx.xxx.xxx - - [21/Sep/2020:07:48:55 +0200] "POST /ocsinventory HTTP/1.1" 200 234 "-" "OCS-NG_unified_unix_agent_v2.6.1"
- I enabled the mysql Query Logs. When i run ocsreports-agent i see many SELECT Querys there. DB Connection seems to work.
- I also checked the Mysql-Credentials in the config files in /etc/httpd/conf.d/
- the Server Version 2.4 semms to be unable to write logs. Permissions for the Log-Dir are set to 777. so i am unable to see if something on the Server Side wents wrong. See also: https://github.com/OCSInventory-NG/OCSInventory-Server/issues/100
The error.log from apache sais nothing to this error.
I tried to connect from an Agent on the same machine and from a different machine and got the same error
The config is:
cat /etc/ocsinventory/ocsinventory-agent.cfg
#
# OCS Inventory "Unix Unified Agent" Configuration File
#
# options used by cron job overides this (see /etc/sysconfig/ocsinventory-agent)
#
# Server URL, unconmment if needed
server = ocs.mydomain.de:80
#local = /var/lib/ocsinventory-agent
# Administrative TAG (optional, must be filed before first inventory)
# tag = your_tag
# How to log, can be File,Stderr,Syslog
logger = Stderr
logfile = /var/log/ocsinventory-agent/ocsinventory-agent.log
ocsinventory-agent --server ocs.mydomain.de and ocsinventory-agent --server http://ocs.mydomain.de are also not working
When i trie ocsinventory-agent --server ocs.mydomain.de/ocsreports/ i get an 404 error, but
curl -IL ocs.mydomain.de/ocsreports/
HTTP/1.1 200 OK
Date: Mon, 21 Sep 2020 06:12:51 GMT
Server: Apache
Set-Cookie: PHPSESSID=u45lbqqn1qasldk525bhhuksu8; path=/
Expires: -1
Cache-Control: must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: VERS=7011; expires=Tue, 21-Sep-2021 06:12:51 GMT; Max-Age=31536000
Cache-control: private
Content-Type: text/html; charset=utf-8
Do you have any Idea?
Thanks from Dresden - Germany
Marcus