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

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

Windows Agent no connect to OCS Inventory Server

I use OCS Inventory Server and I installed OCS Inventory Agent on PC with Win7. From this PC I can open site http://192.168.20.20/ocsreports/ and default agent configuration with server address:  http://192.168.20.20/ocsinventory. In agent log Isee this Error 500:
==============================================================================

Starting OCS Inventory NG Agent on Tuesday, October 09, 2018 17:14:52.

AGENT => Running OCS Inventory NG Agent Version 2.4.0.0

AGENT => Using OCS Inventory NG FrameWork Version 2.4.0.0

AGENT => Loading plug-in(s)

AGENT => Using network connection with Communication Server

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

AGENT => Sending Prolog

AGENT => Prolog successfully sent

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 asked for Package Download

AGENT => Unloading communication provider

AGENT => Unloading plug-in(s)

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

On Server in Apache Error log I see this:

[perl:error] [pid 1752] [client 192.168.78.2:1765] Undefined subroutine &Apache::Ocsinventory::Server::Inventory::Update::set_saas called at /usr/local/share/perl/5.24.1/Apache/Ocsinventory/Server/Inventory/Update.pm line 50.\n

In OCS Server Activiny log is clear.

0Can yoy help me? What's check?
asked in OCS Inventory NG agent for Windows by (130 points)
edited by

4 Answers

0 votes

Hi @raze,

have you tried to temporarily remove the plugins scripts from the following folder and restart an inventory ? (do not remove the file "DO_NOT_REMOVE.txt" from this folder)

C:\Program Files (x86)\OCS Inventory Agent\Plugins\

Regards, St├ęphane

answered by (23.6k points)
0 votes

I have the same problem and I do not find the solution eithercrying

answered ago by (140 points)
+1 vote

I have a new installation OCS Inventory Server 2.5 in Ubuntu Server 18.04 with the same problem with 2.4 and 2.3.1.1 clients in Windows 10 PRO 64Bits , ERROR *** AGENT => Failed to send Inventory <HTTP Status Code #500>, the only temporary solution that I have found is to comment # line 50 of the file Update.pm

/usr/local/share/perl/5.26.1/Apache/Ocsinventory/Server/Inventory/Update.pm

Line 48:  set_category();

Line 49:  set_asset_category();

Line 50:  #set_saas();

But in doing that, I think the plugins stop working.

Please, it is important to solve it, if someone knows a permanent solution that explains it. Thank you.

answered ago by (200 points)
edited ago by
0 votes
Hello,

i tried to define the "missing subroutine" inside the Update.pm file:

sub set_saas{
    my $dbh = $Apache::Ocsinventory::CURRENT_CONTEXT{'DBI_HANDLE'};
    my @saas_exp = get_saas();
    my $saas_en = 0;
    my $sql;
    $sql = $dbh->prepare("SELECT ivalue FROM config WHERE config.name='INVENTORY_SAAS_ENABLED'");
    $sql->execute;
    while (my $row = $sql->fetchrow_hashref()){
        $saas_en = $row->{ivalue};
    }
    if ($saas_en == 1) {
        foreach my $saas (@{$Apache::Ocsinventory::CURRENT_CONTEXT{'XML_ENTRY'}->{CONTENT}->{SAAS}}){
            my $entry = $saas->{ENTRY};
            foreach my $exp (@saas_exp) {
                my $dnsExp = $exp->{DNS_EXP};
                $dnsExp =~ s/\?/\./g;
                $dnsExp =~ s/\*/\.\*/g;
                if ($entry =~ /$dnsExp/ || $dnsExp =~ /$entry/ ) {
                    $dbh->do("INSERT INTO saas (SAAS_EXP_ID, HARDWARE_ID, ENTRY, DATA, TTL) VALUES (?,?,?,?,?)", {},  $exp->{ID}, $Apache::Ocsinventory::CURRENT_CONTEXT{'DATABASE_ID'}, $entry, $saas->{DATA}, $saas->{TTL});
                }
            }
        }
    }
    return 1;
}

-------

Thats out of the saas.pm file from github contributions. Since i'm not a perl expert it was only a try - and seems not to work.

Apache Error Log is empty on that topic, the access_log shows a post command for the entry when testing with one host manually. OCS NG Gui shows no hosts at all.

Any ideas?

Regards, Stefan
answered ago by (140 points)
 
Powered by Question2Answer
...