Ocs inventory 500 error

It's hard to solve a problem when important details are missing, that why we added this template, to help you and us. General informations Operating system : Red Hat Enterprise Linux Server rel...

It’s hard to solve a problem when important details are missing, that why we added this template, to help you and us.

General informations

Operating system : Red Hat Enterprise Linux Server release 7.2 (Maipo)

Server informations

Perl version : v5.16.3
Mysql / Mariadb / Percona version : MariaDB Server version 5.5.44-MariaDB 2.3.1

Server installation method ( Only one choice )

  • RPM Package
  • Install SH
  • [X ] Manual installation

OCS Inventory informations

Ocs server version : OCSNG_UNIX_SERVER-2.4

Problem’s description

Hi,

I have a problem when I update from version 2.3.1 to 2.4.

The agents can’t communicate with the server, when I force this communication with the command:

ocsinventory-agent —force —debug —server=
…..
[error] Cannot establish communication : 500 Internal Server Error

In apache log appear:

[Wed Feb 07 12:47:27.547668 2018] [perl:error] [pid 29572] [client XX.XXX.XXX.XX:3910] Can’t call method «do» on an undefined value at /usr/share/perl5/vendor_perl/Apache/Ocsinventory/Server/System.pm line 189.n

This line in the file containe:

my $dbh = DBI->connect(«DBI:mysql:database=$database;host=$host;port=$port», $user, $password, %params);
$dbh->do(«SET NAMES ‘utf8′») if($dbh && $ENV{‘OCS_OPT_UNICODE_SUPPORT’});
$dbh->do(«SET sql_mode=’NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'»);
return $dbh;

My ocs database haven’t the defaults values.

I have correctly change from the file /etc/httpd/conf.d/z-ocsinventory-server.conf the value of the next variables:

PerlSetEnv OCS_DB_NAME XXXX
PerlSetEnv OCS_DB_LOCAL XXXX
PerlSetEnv OCS_DB_USER XXXX
PerlSetVar OCS_DB_PWD XXXX

I have correctly change from the file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php the value of the next variables:

define(«DB_NAME», «XXXX»);
define(«COMPTE_BASE»,»XXXX»);
define(«PSWD_BASE»,»XXXX»);

I have updated many time and I never have problem with this.

I do some test and I see that the communication works if I use the default values:

PerlSetEnv OCS_DB_USER ocs
PerlSetVar OCS_DB_PWD ocs

and

define(«COMPTE_BASE»,»ocs»);
define(«PSWD_BASE»,»ocs»);

Thank so much.

Regards,

Víctor.

Сегодня коллеги попросили помочь разобраться с проблемой: при отправке данных в OCS агент получал в ответ ошибку с кодом 500. После включения логирования ошибок (нужно в конфиге выставить OCS_OPT_DBI_PRINT_ERROR в 1) в логах появились следующие ошибки:

DBD::mysql::db do failed: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' at /usr/local/share/perl/5.10.1/Apache/Ocsinventory/Server/Inventory/Cache.pm line 34.

Вот на этом месте OCS спотыкается:

# sed '260,265p;d' /usr/local/share/perl/5.10.1/Apache/Ocsinventory.pm
  # Retrieve Device if exists
  $request = $CURRENT_CONTEXT{'DBI_HANDLE'}->prepare('
    SELECT DEVICEID,ID,UNIX_TIMESTAMP(LASTCOME) AS LCOME,UNIX_TIMESTAMP(LASTDATE) AS LDATE,QUALITY,FIDELITY 
    FROM hardware WHERE DEVICEID=?'
  );
  unless($request->execute($CURRENT_CONTEXT{'DEVICEID'})){

Ну тут всё понятно — имя в кириллице, меняем на латиницу — всё работает. Проблема локализована. А чтобы OCS могла импортировать имена в кириллице нужно немного поправить БД:

ALTER TABLE `ocs`.`hardware` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `ocs`.`hardware` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Ну а лучше не полениться и конвертировать всю БД простым скриптом на PHP:

<?php
$connection = mysql_connect('localhost', 'debian-sys-maint', '**************') or die ('Could not connect to server');
mysql_select_db('ocs', $connection) or die ('Could not select DB');
mysql_query("alter database `ocs` default character set 'utf8' collate 'utf8_general_ci'", $connection);
$result = mysql_query("show tables", $connection);
while($row = mysql_fetch_row($result)) {
   mysql_query("alter table `$row[0]` convert to character set 'utf8' collate 'utf8_general_ci'", $connection);
   mysql_query("alter table `$row[0]` default character set 'utf8' collate 'utf8_general_ci'", $connection);
}

Те, кто заранее позаботился о настройке сервера с этой проблемой не столкнутся, достаточно двух строчек в /etc/my.cnf:

default-character-set   = utf8  
default-collation       = utf8_general_ci

Естественно настраивать надо было до установки OCS

Hey there!

I finally managed to install the OCSI on Ubuntu 20.04LTS
There are so many «HowTo» s but everyone is missing some parts. How ever.. the server is running right now. So far so good.
In my Test-environment I have 2 Clients (Both Windows 10 1909)
One Client does have a Sophos Home AV the other one just the windows Defender.

The one with the Sophos Protection won’t talk fully to the OCSI Server. the Prolog conversation is starting but then only Code 515 with the …;end;error at the end of the line.

The other System is getting 511 …,deploy;no_file / 515 …;end;bad_request / and 515 …;end;error

Now I’m not sure what to do. I’m totally new to this Software and I want to bring it live.
Can someone help me?

btw. I already tried to install the whole system before on a 18.04 with a mariadb.. this did result in several SQL errors and even didn’t work, as I inserted all correct credentials to all needed files.

[EDIT]

Now, sometimes, the Prolog works, the client sends it’s Inventory Data. But, then at the end, it fails by «Download disabled by Server»
where can I enable this?

[/EDIT]



asked

May 7, 2020


in OCS Inventory NG agent for Windows


by


(380 points)



edited

May 13, 2020


by Suldorian


7 Answers

well.. maybe the 515 Error is an SQL error. That means, the Script is trying to insert a NULL Value into the database for some reason..

I also tried now the 2.4 client on my Win 10 Pro (v1909) 64 Bit. But with the same result.

No Data has been stored at the server.
While there is (obviously) the SQL Error 515, there are no fails with the credentials. But definitely something different went wrong.
Anyone any idea?

[EDIT]

I figured out, that the initial Run of the client (if there’s no entry in the DB yet) will send the «Prolog» and the client is fetching Data. But then, 

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

and the activity Log shows up with: 

Wed May 13 22:09:15 2020;4075;515;TVPC-2020-05-13-22-04-10;[IP-ADDRESS];OCS-NG_WINDOWS_AGENT_v2.4.0.0;end;error

What am i doing wrong?

There are Entries in the database for both of my Computers.

But just with DeviceID and NULL entries 

I really don’t know what I need to change/configure/add/remove to bring this thing to work…

Please help.

[Addition]

There is another row in the debug-log from the client…

WARNING *** EXECUTABLE PLUGIN => Plugin <C:Program FilesOCS Inventory AgentpluginsSaas.ps1> does not produce any output

I think, that might be a problem though, right?

Well, as far as I can see, this ps1 script reads out the dns-cache of the client. For what ever this is necessary. and it sets the language to french. Wouldn’t it be more efficient if it is english?

[/Addition]

[/EDIT]



answered

May 13, 2020


by
Suldorian

(380 points)



edited

May 13, 2020


by Suldorian


Hi,

Any errors in /var/log/apache2/error.log file ?

Regards

Frank






answered

May 14, 2020


by
frankb

(88k points)



there was an issue in the first place, which prevented me to run the install.php.

There was a try to set the «sqlmode» with «NO_AUTO_CREATE_USER» option.

The Installation process revoked to proceed while these lines were active. So I deleted all the «NO_AUTO_CREATE_USER» part out of three php files

These files:

/usr/share/ocsinventory-reports/ocsreports/backend/require/connexion.php

/usr/share/ocsinventory-reports/ocsreports/require/function_commun.php

/usr/share/ocsinventory-reports/ocsreports/install.php

. Then the installation process was able to be finished.
Is this a mariaDB thing? Because I installed the standard MySQL Server?



answered

May 14, 2020


by
Suldorian

(380 points)



edited

May 14, 2020


by Suldorian


Аватар пользователя maximum

Столкнулся с проблемой запуска ocsinventory-agent и ocsinventory-server. Архивы брал с официального сайта: http://www.ocsinventory-ng.org/en/download/
Краткая суть проблемы:
1. Ставим server (sh setup.sh)
2. Запускаем инсталляцию ocs-server (http://localhost/ocsreports)
3. Ставим agent (perl Makefile.PL && make && make install)
Получаем:

Activating modules if needed...
Launching OCS Inventory NG Unix Unified agent...
   -> Failed!
You may want to launch the agent with the --verbose or --debug flag.
New settings written! Thank you for using OCS Inventory

В логах apache:

[Tue Jun 04 12:15:22 2013] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze15 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Jun 04 12:18:37 2013] [error] [client 127.0.0.1] Can't call method "do" on an undefined value at /usr/local/share/perl/5.10.1/Apache/Ocsinventory/Server/System.pm line 177.n

В логах ocs-server:
[error] Cannot establish communication : 500 Internal Server Error
В чем проблема:
При инсталляции ocs-server создается конфигурационный файл /etc/apache2/conf.d/z-ocsinventory-server.conf в котором хранятся данные для подключения к базе данных ocsweb, собственно эти данные должны сохраняться во время инсталляции через web-интерфейс, но почему-то не сохраняются.
Решение:
открываем /etc/apache2/conf.d/z-ocsinventory-server.conf, ищем блок и приводим его в нужный нам вид:

 # Master Database settings
  # Replace localhost by hostname or ip of MySQL server for WRITE
  PerlSetEnv OCS_DB_HOST localhost
  # 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 -- заменяем на нашего пользователя базы данных, которого указывали при инсталляции ocs-server 
  # Password for user
  PerlSetVar OCS_DB_PWD ocs -- заменяем на пароль пользователя базы данных.

Перезапускаем apache
Запускаем ocsinventory-agent

  •      
  • Версия для печати

Удивительно, но решение проблемы нашел только в архивной копии гугла. На офф.сайте ничего такого не нашлось.

Столкнулся с проблемой запуска ocsinventory-agent и ocsinventory-server. Архивы брал с официального сайта: http://www.ocsinventory-ng.org/en/download/
Краткая суть проблемы:
1. Ставим server (sh setup.sh)
2. Запускаем инсталляцию ocs-server (http://localhost/ocsreports)
3. Ставим agent (perl Makefile.PL && make && make install)
Получаем:

Activating modules if needed...
Launching OCS Inventory NG Unix Unified agent...
   -> Failed!
You may want to launch the agent with the --verbose or --debug flag.
New settings written! Thank you for using OCS Inventory

В логах apache:

[Tue Jun 04 12:15:22 2013] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze15 with Suhosin-Patch 
mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Jun 04 12:18:37 2013] [error] [client 127.0.0.1] Can't call method "do" on an undefined 
value at /usr/local/share/perl/5.10.1/Apache/Ocsinventory/Server/System.pm line 177.n

В логах ocs-server:
[error] Cannot establish communication : 500 Internal Server Error
В чем проблема:
При инсталляции ocs-server создается конфигурационный файл /etc/apache2/conf.d/z-ocsinventory-server.conf в котором хранятся данные для подключения к базе данных ocsweb, собственно эти данные должны сохраняться во время инсталляции через web-интерфейс, но почему-то не сохраняются.
Решение:
открываем /etc/apache2/conf.d/z-ocsinventory-server.conf, ищем блок и приводим его в нужный нам вид:

 # Master Database settings
  # Replace localhost by hostname or ip of MySQL server for WRITE
  PerlSetEnv OCS_DB_HOST localhost
  # 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 -- заменяем на нашего пользователя базы данных, которого указывали при инсталляции ocs-server 
  # Password for user
  PerlSetVar OCS_DB_PWD ocs -- заменяем на пароль пользователя базы данных.

Перезапускаем apache
Запускаем ocsinventory-agent

Bug #773132 reported by
iyke
on 2011-04-29

This bug affects 3 people

Affects Status Importance Assigned to Milestone


ocsinventory-agent (Ubuntu)

Confirmed

Undecided


Unassigned

Bug Description

Binary package hint: ocsinventory-agent

root@ubuntu:/etc/ocsinventory# /usr/bin/ocsinventory-agent —debug —server 127.0.0.1
[debug] Ocsinventory unified agent for UNIX, Linux and MacOSX 1.1.2
[debug] Log system initialised (Stderr)
[debug] —scan-homedirs missing. Don’t scan user directories
[debug] the —server passed doesn’t have a protocol, assume http as default
[debug] Accountinfo file: /var/lib/ocsinventory-agent/http:__127.0.0.1_ocsinventory/ocsinv.adm
[debug] A TAG seems to already exist in the server for this machine. The -t paramter may be ignored by the server unless it has OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT=1.
[debug] Account info updated successfully
[debug] Turns CompatibilityLayer on for /etc/ocsinventory/modules.conf
[debug] OCS Agent initialised
[debug] Calling handlers : `start_handler’
[debug] Compress::Zlib is available.
[debug] sending XML
[debug] Calling handlers : `prolog_writers’
[debug] sending: <?xml version=»1.0″ encoding=»UTF-8″?>
<REQUEST>
  <CONTENT>
    <ACCOUNTINFO>
      <KEYNAME>TAG</KEYNAME>
      <KEYVALUE>test</KEYVALUE>
    </ACCOUNTINFO>
  </CONTENT>
  <DEVICEID>ubuntu-2011-04-21-00-09-34</DEVICEID>
  <QUERY>PROLOG</QUERY>
</REQUEST>
[error] Cannot establish communication : 500 Internal Server Error

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: ocsinventory-agent 2:1.1.1-2
ProcVersionSignature: Ubuntu 2.6.32-31.61-generic 2.6.32.32+drm33.14
Uname: Linux 2.6.32-31-generic i686
Architecture: i386
Date: Fri Apr 29 03:50:46 2011
InstallationMedia: Ubuntu 10.04.2 LTS «Lucid Lynx» — Release i386 (20110211.1)
PackageArchitecture: all
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: ocsinventory-agent

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Ocker errors dockerexception error while fetching server api version
  • Ocienvcreate failed with return code 1 but error message text was not available
  • Oci execute error
  • Oci error php
  • Oci 22053 overflow error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии