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.8 available

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

Windows Agent cannot connect to OCS Server

Hi all

I'm a very new OCS Inventory user. I have been tasked with setting up an OCS Inventory Server. I have installed the product on Centos 7 according to the steps outlined in the official NG Wiki for OCS (Chapter: Setting up an OCS Inventory server).

I have also installed the windows agent on my desktop PC. The agent inventories everything fine locally, but cannot communicate with the server. This is what the Agent log says:

Starting OCS Inventory NG Agent on Tuesday, March 17, 2020 12:33:59.

AGENT => Running OCS Inventory NG Agent Version 2.6.0.0

AGENT => Using OCS Inventory NG FrameWork Version 2.6.0.0

AGENT => Loading plug-in(s)

DLL PLUGIN => Searching for Plug-in DLL(s) in folder <C:\Program Files\OCS Inventory Agent\plugins>

DLL PLUGIN => 0 DLL Plug-in(s) successfully loaded on 0 DLL(s) found

AGENT => Using network connection with Communication Server

COM PROVIDER => Loading Communication Provider <C:\Program Files\OCS Inventory Agent\ComHTTP.dll>

AGENT => Using Communication Provider <OCS Inventory NG cURL Communication Provider> Version <2.6.0.0>

AGENT => Sending getLabel request

COM SERVER => Initializing cURL library for getFile

COM SERVER => Using cURL with server authentication

COM SERVER => Disabling cURL proxy support

COM SERVER => Disabling cURL SSL server validation support

COM SERVER => Sending fileGet request to URL <http://192.168.10.99/ocsinventory/deploy/label>

WARNING *** COM SERVER => Failed to send HTTP Get request <Couldn't connect to server>

COM SERVER => Cleaning cURL library

AGENT => Failed to retrieve Label <Couldn't connect to server>

AGENT => Sending Prolog

DID_CHECK => Read DeviceID <PC6266-2020-03-13-14-38-14> and MACs <D4:3D:7E:12:EF:B00A:00:27:00:00:04> in file <ocsinventory.dat>

COM SERVER => Initializing cURL library for sendRequest

COM SERVER => Using cURL with server authentication

COM SERVER => Disabling cURL proxy support

COM SERVER => Disabling cURL SSL server validation support

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

WARNING *** COM SERVER => Failed to send HTTP Post request <Couldn't connect to server>

COM SERVER => Cleaning cURL library

ERROR *** AGENT => Failed to send Prolog <Couldn't connect to server>

AGENT => Unloading communication provider

AGENT => Unloading plug-in(s)

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

I am also somewhat new in linux environments, so I ask for patience hehe. The conf files in the server all have the correct DB authentication information.

Thanks in advance.
EDIT:

This is the content of today's error log from httpd (apache):

[Tue Mar 17 09:59:58.675898 2020] [mpm_prefork:notice] [pid 9109] AH00170: caught SIGWINCH, shutting down gracefully

[Tue Mar 17 10:01:32.224606 2020] [suexec:notice] [pid 1323] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.

ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::7e53:282c:cbe3:5c8. Set the 'ServerName' directive globally to suppress this message

[Tue Mar 17 10:02:12.444529 2020] [lbmethod_heartbeat:notice] [pid 1323] AH02282: No slotmem from mod_heartmonitor

[Tue Mar 17 10:02:12.545008 2020] [mpm_prefork:notice] [pid 1323] AH00163: Apache/2.4.6 (CentOS) PHP/7.3.15 mod_perl/2.0.11 Perl/v5.16.3 configured -- resuming normal operations

[Tue Mar 17 10:02:12.545038 2020] [core:notice] [pid 1323] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

[Tue Mar 17 10:19:21.058862 2020] [php7:warn] [pid 2544] [client ::1:49848] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=visu_computers

[Tue Mar 17 10:19:21.058933 2020] [php7:warn] [pid 2544] [client ::1:49848] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=visu_computers

[Tue Mar 17 10:49:36.653540 2020] [php7:warn] [pid 2542] [client ::1:49866] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=visu_computers

[Tue Mar 17 10:49:36.653626 2020] [php7:warn] [pid 2542] [client ::1:49866] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=visu_computers

[Tue Mar 17 11:21:32.578531 2020] [php7:warn] [pid 3774] [client ::1:49876] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=admin_conf

[Tue Mar 17 11:21:32.578627 2020] [php7:warn] [pid 3774] [client ::1:49876] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=admin_conf

[Tue Mar 17 11:21:32.578790 2020] [php7:warn] [pid 3774] [client ::1:49876] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=admin_conf

[Tue Mar 17 11:24:44.724598 2020] [php7:warn] [pid 3776] [client ::1:49880] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=admin_conf

[Tue Mar 17 11:24:44.724694 2020] [php7:warn] [pid 3776] [client ::1:49880] PHP Warning:  Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /usr/share/ocsinventory-reports/ocsreports/require/function_config_generale.php on line 137, referer: http://localhost/ocsreports/?function=admin_conf

[Tue Mar 17 12:32:27.374251 2020] [mpm_prefork:notice] [pid 1323] AH00170: caught SIGWINCH, shutting down gracefully

[Tue Mar 17 12:33:08.650055 2020] [suexec:notice] [pid 6510] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.

ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::7e53:282c:cbe3:5c8. Set the 'ServerName' directive globally to suppress this message

[Tue Mar 17 12:33:48.859750 2020] [lbmethod_heartbeat:notice] [pid 6510] AH02282: No slotmem from mod_heartmonitor

[Tue Mar 17 12:33:48.896301 2020] [mpm_prefork:notice] [pid 6510] AH00163: Apache/2.4.6 (CentOS) PHP/7.3.15 mod_perl/2.0.11 Perl/v5.16.3 configured -- resuming normal operations

[Tue Mar 17 12:33:48.896345 2020] [core:notice] [pid 6510] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

[Tue Mar 17 12:36:00.085334 2020] [mpm_prefork:notice] [pid 6510] AH00170: caught SIGWINCH, shutting down gracefully

[Tue Mar 17 12:36:59.817803 2020] [suexec:notice] [pid 1310] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.

ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::7e53:282c:cbe3:5c8. Set the 'ServerName' directive globally to suppress this message

[Tue Mar 17 12:37:40.032577 2020] [lbmethod_heartbeat:notice] [pid 1310] AH02282: No slotmem from mod_heartmonitor

[Tue Mar 17 12:37:40.139091 2020] [mpm_prefork:notice] [pid 1310] AH00163: Apache/2.4.6 (CentOS) PHP/7.3.15 mod_perl/2.0.11 Perl/v5.16.3 configured -- resuming normal operations

[Tue Mar 17 12:37:40.139117 2020] [core:notice] [pid 1310] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

in OCS Inventory NG agent for Windows by (260 points)
edited by

5 Answers

0 votes

Is your web server configured to listen on port 80 on either the server's IP, 192.168.10.99 or * as opposed to localhost or 127.0.0.1?

On your web server run:

netstat -an | grep -i :80

...

tcp6       0      0 :::80                   :::*                    LISTEN
...

You should see a line similar to above. If you see 127.0.0.1:80 then your web server needs to be reconfigured to listen on the external IP.

More things to check;

Confirm you can even reach the server.

From your Desktop PC go to the address of your OCS Server in a web browser or test using curl if you have curl on your desktop PC., i.e.

curl http://192.168.10.99/ocsinventory

You should at least get a response even if it is an a "BAD REQUEST".

If you can't connect, are you running a firewall on your server? Turn it off for testing.

Is your Desktop PC on the same subnet/network?

Do you have the OCSReport web page working FROM your Desktop PC?

i.e. http://192.168.10.99/ocsreports

Are you seeing anything in your web server's log files showing your Desktop PC can connect?

Here is a copy of my typical windows OCS agent ini file.

I use SSL (https) on my web server so that is why SSL=1, you will want SSL=0 until you configure https on your web server.

# "c:\ProgramData\OCS Inventory NG\Agent\ocsinventory.ini"
[OCS Inventory Agent]
ComProvider=ComHTTP.dllDebug=1
Local=
NoSoftware=0
HKCU=0
NoTAG=0
IpDisc=
[HTTP]
Server=https://192.168.0.101/ocsinventory
SSL=1
CaBundle=cacert.pem
AuthRequired=0
User=
Pwd=
ProxyType=0
Proxy=
ProxyPort=0
ProxyAuthRequired=0
ProxyUser=
ProxyPwd=
[OCS Inventory Service]
TTO_WAIT=197220
INVENTORY_ON_STARTUP=1
PROLOG_FREQ=60
OLD_PROLOG_FREQ=60

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

John

by (870 points)
0 votes

Hello John

Thanks for your answer. Netstat shows:

tcp6       0      0 :::80                   :::*                    LISTEN

I cannot connect from my desktop (on a different subnet but with no network restrictions). 
When I browse serverIP/ocsreports I get ERR_CONNECTION_TIMED_OUT
I think I could have a misconfiguration on my apache site, but again I'm very new at this. Maybe my site is not published? I can only browse it locally on the OCS Server.
by (260 points)
0 votes
Hi,

The server is listen on tcp6 not tcp4. Comment the line "Listen 80" in httpd.conf and set Listen <ipv4>:<port>. Save and restart apache.

Regards

Frank
by (79.8k points)
0 votes

Hi Frank, thanks for your answer.

I corrected what you pointed out:

tcp        0      0 192.168.10.99:80        0.0.0.0:*               LISTEN

But the problem persists. I think I have not configured apache properly, but I followed the official documentation guide for installation. Or maybe my z-ocsinventory-server.conf is the one wrongly configured... this is the SOAP part that maybe I should enable, not sure though... 

# ===== WEB SERVICE (SOAP) SETTINGS =====

  PerlSetEnv OCS_OPT_WEB_SERVICE_ENABLED 0

  PerlSetEnv OCS_OPT_WEB_SERVICE_RESULTS_LIMIT 100

  # PerlSetEnv OCS_OPT_WEB_SERVICE_PRIV_MODS_CONF "WEBSERV_PRIV_MOD_CONF_FILE"

# Be careful: you must restart apache to make settings taking effects

  # Configure engine to use the settings from this file

  PerlSetEnv OCS_OPT_OPTIONS_NOT_OVERLOADED 0

  # Try to use other compress algorithm than raw zlib

  # GUNZIP and clear XML are supported

  PerlSetEnv OCS_OPT_COMPRESS_TRY_OTHERS 1

by (260 points)
edited by
0 votes
And this is my apache errorlog:

Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.

ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::7e53:282c:cbe3:5c8. Set the 'ServerName' directive globally to suppress this message

[Wed Apr 01 10:19:41.746003 2020] [lbmethod_heartbeat:notice] [pid 1320] AH02282: No slotmem from mod_heartmonitor

[Wed Apr 01 10:19:41.875060 2020] [mpm_prefork:notice] [pid 1320] AH00163: Apache/2.4.6 (CentOS) PHP/7.3.16 mod_perl/2.0.11 Perl/v5.16.3 configured -- resuming normal operations

[Wed Apr 01 10:19:41.875092 2020] [core:notice] [pid 1320] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

[Wed Apr 01 11:16:01.378522 2020] [mpm_prefork:notice] [pid 1320] AH00170: caught SIGWINCH, shutting down gracefully

[Wed Apr 01 11:16:42.656963 2020] [suexec:notice] [pid 12219] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
by (260 points)
 
Powered by Question2Answer
...