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

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

Agent cannot update to server

Hi all,
Here my case
ocs server 2.6 on Centos 7 Apache PHP 5.4 mariadb 5.5
ocs agent 2.1.1.1 on windows 10
They worked fine before, suddenly, on 18 Jan 2022, agents on our windows workstations cannot update to server anymore, here error in C:\ProgramData\OCS Inventory NG\Agent\
Starting OCS Inventory NG Agent on Wednesday, February 23, 2022 09:47:09.
AGENT => Running OCS Inventory NG Agent Version 2.1.1.1
AGENT => Using OCS Inventory NG FrameWork Version 2.1.1.1
AGENT => Loading plug-in(s)
AGENT => Using network connection with Communication Server
AGENT => Using Communication Provider <OCS Inventory NG cURL Communication Provider> Version <2.1.1.1>
AGENT => Sending Prolog
AGENT => Prolog successfully sent
SUPPORT => No support detected, Registration key : N/A
AGENT => Inventory required
AGENT => Launching hardware and software checks
AGENT => Sending Inventory
INVENTORY => Inventory changed since last run
ERROR *** AGENT => Failed to send Inventory <HTTP Status Code #500>
AGENT =>  Communication Server ask for Package Download
DOWNLOAD => Download and setup tool successfully started
AGENT => Unloading communication provider
AGENT => Unloading plug-in(s)
AGENT => Execution duration: 00:00:11.

I have checked z-ocsinventory-server.conf , mysql username and password are correct
I changed PerlSetEnv OCS_OPT_DBI_PRINT_ERROR to 1 , then view Apache error log and see many of:
DBD::mysql::st execute failed: Table 'ocsweb.software' doesn't exist at /usr/local/share/perl5/Apache/Ocsinventory/Server/Inventory/Software.pm line 59.
DBD::mysql::st execute failed: Table 'ocsweb.software' doesn't exist at /usr/local/share/perl5/Apache/Ocsinventory/Server/Inventory/Software.pm line 59.

I test z-ocsinventory-server.conf syntax and it return
apachectl -t
ocsinventory-server: Bad setting. `IPDISCOVER_LINK_TAG_NETWORK` is not set. Default: `0`
ocsinventory-server: Can't load SOAP::Transport::HTTP* - Web service will be unavailable

Please give me some advice, thank you very much.
in OCS Inventory NG agent for Windows by (270 points)

6 Answers

+1 vote
 
Best answer
As you can see on this forum, there is some problems with upgrade to 2.9. IMHO I suggest upgrade to 2.8.1 (december 2020) and wait a little for 2.9.

OCS Server is AND ocsinventory with perl scripts in .../Apache/Ocsinventory AND ocsreports with php scripts in .../ocsreports. So for backup or restore, you need to look these 2 folders.

Probably, you need upgrade PHP before : PHP 5.4 is quite old (lot of software were old on Centos 7 !), I'm not sure of requesite for ocsreports about PHP but I suppose PHP 7 is needed ... (since OCS 2.8, PHP 8 is supported !)

My own procedure to upgrade

- download from github OCS source

- backup database, folders .../ocsreports + .../Apache/Ocsinventory, apache conf files

- stop Apache2

-  vi setup.sh : for adjust path if not standard

- cd ../ocsreports/files/update; execute all 7xxx.sql after 7022; and update GUI_VERSION from table 'config' (look 'update.php' for understand how upgrade database)
- start Apache2

- http://server/ocsreports + enter (same) credentials : the database is already upgraded

Usually each step of database upgrade (= each 7xxx.sql) is fast, except 7037.sql (for 2.8.0) where table 'softwares' became 'software' (for me with ~14000 hardware, there is ~10 M rows for 'softwares' !)

(I stop Apache before upgrading OCS for avoid inconstancy : it's better to have AND the ocsinventory AND the database at same level : using directly files/update/7xxx.sql, it's easy)

About Apache conf files, setup.sh create some conf files. So after upgrade, you'll need to check new config files and enter credentials into z-ocsinventory....conf. I note with 2.8 there is some difference between files generated, so I never do the last chapter of the link 'Restore backup configuration and start'
by (10.5k points)
selected by
+1 vote
Starting from OCS 2.2, update of database use files from /ocsreports/files/update/xxxx.sql with xxxx= GUI_VERSION. For exemple OCS 2.6 => GUI_VERSION=7022 means all scripts up to 7022.sql need to be executed (and change the value on GUI_VERSION in table 'config').

The change between table 'softwares' and 'software' (replacement)  is made by 7037.sql means OCS Server 2.8.0 !

So if your server try to update table 'software', that means perl script for OCS Server are in version 2.8, and if you have a table 'softwares' that means your database is not at same level.

First, look at table 'config' search for 'name=GUI_VERSION'

Second, look at file /usr/local/share/perl/5.xx.x/Apache/Ocsinventory.pm ligne $Apache::Ocsinventory::VERSION

You NEED to have correspondance :

OCS 2.6 = GUI_VERSION 7022

OCS 2.7 = GUI_VERSION 7028

OCS 2.8.0 = GUI_VERSION 7037

OCS 2.8.1 = GUI_VERSION 7039

....

IMHO you start upgrade of your server without upgrade your database : may be execute sql scripts or update.php
by (10.5k points)
edited by
0 votes
Hi jacquesh, thanks for your reply.
I have checked :
In /usr/share/ocsinventory-reports/ocsreports/files/update I found there are 7015 - 7022.sql created on 18 Jan 2021

I looked at table 'config' search for 'name=GUI_VERSION'
GUI_VERSION   7022    Version of the installed GUI and database

I looked at /usr/local/share/perl5/Apache/Ocsinventory.pm
$Apache::Ocsinventory::VERSION = '2.9.2';

Updated: On 18 Jan 2022 I tried to upgrade ocs server from 2.6 to 2.9.2 (I'm sorry , my fault) , I follow instruction at : https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server/
I backup /usr/share/ocsinventory-reports/ocsreports , Apache configs,  and ocsweb database , then
I download OCSNG_UNIX_SERVER-2.9.2.tar.gz , unzip , and run setup.sh
But it failed, I cannot access to ocs report page (blank page), so I restore back 2.6 source but I forgot about perl script version.
I haven't checked agent working until now.
So I fixed it by downgrade ocs server perl script back to 2.6 (reinstall ocs 2.6)
Can you give me some hint about upgrade ocs server to 2.9.2 lead to blank page case ?
Maybe because ocs server 2.9.2 require PHP 7 ?
by (270 points)
edited by
0 votes
I have tried to upgrade to 2.8.1 , still blank page. I upgraded by downloading source code.
The wiki page should add more steps about executing sql files manually, and also note about some difference between files generated since 2.8.
I have tried install ocs 2.9.2 from rpm repository and it required PHP7 so I will stay with 2.6 for now, thank you very much.
by (270 points)
0 votes
I've used this procedure, with a Debian 10 server, from 2.2 to 2.4, to 2.6, to 2.8.1, with success. But it's a Debian 10 server with MariaDB 10.3.27, Apache2 2.4.38 and PHP 7.3.

I start, with this new server, getting database backup, download and certificate from (very) old server. I substitue name and ip address. And I upgrade 2 times the new server (2.6, 2.8).
by (10.5k points)
0 votes
It's an idea to look from repository standard to have information on requesites !

Using Debian Packages : https://packages.debian.org/search?keywords=ocsinventory&searchon=names&suite=all&section=all

you can see there is 2 packages for the server : ocsinventory-server (for inventory and Perl scripts) and ocsinventory-reports (for ocsreports and Php scripts).

For 2.8.1, the packages are available on Bullseye (=Debian 11, starting in 2021) : ocsreports need Php 7.4 (but I install 2.8.1 from sources on Debian Buster with Php 7.3).

So maybe your centos has not enough requesites for OCS 2.8. I suppose you can upgrade Apache and Php on your Centos : exemple https://linuxize.com/post/install-php-7-on-centos-7/ for Php 7.3, and https://codeit.guru/en_US/ for Apache2 from 2.4.41 up to 2.4.51. (That's the reason I prefer Debian over Centos : each 2 years we have a new 'stable' edition with updated softwares.)
by (10.5k points)
edited by
 
Powered by Question2Answer
...