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

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

OCS Agent Plugin doesn't send results to server

The short version:

The OCS Inventory Agent equipped with a plugin (C:\Program Files\OCS Inventory Agent\Plugins) to scan for java installations only sends the plugin result from time to time. Sometimes it works, sometimes it doesn't. I can't figure out a pattern.

The more detailed version:

We are currently trying to scan for Java installations on our clients that use windows and linux.

In order to do that we created an OCS Inventory Agent extension that is a powershell script for windows and a shell script for linux.

The scan results are written into the SOFTWARES table of the ocs inventory database.

The Agent Plugins seem to work in general. But here is my problem:

The majority of our agents do scan with the help of the plugins and send an inventory to the server. But it's not working continously. Meaning that on Monday the agent scans and sends the result to the server. On Tuesday the agent scans again and sends the general inventory, but lacking the result of the plugin.

We use OCS Inventory Server 2.12.0 on Ubuntu 22.04 and OCS Inventory Agents with various versions ranging from 2.6.0.0 to 2.10.1.0.

Any suggestions or help would be greatly appreciated.
in OCS Inventory NG agent for Windows by (200 points)

2 Answers

0 votes

This is the Powershell script for Windows:

OCS Plugin Java for windows

# Default UTF-8

$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8

$PSDefaultParameterValues['*:Encoding'] = 'utf8'

# $PSDefaultParameterValues = @{ '*:Encoding' = 'utf8' }

# search local volumes <10 TB

$vol = (Get-WmiObject -Class Win32_logicaldisk -Filter "DriveType =3" | where Size -lt "10000000000000").DeviceID

# write-host "Found Volumes: "$vol

# $ErrorActionPreference = "silentlycontinue"

foreach($path in $vol)

{

$path = $path + "\"

# write-host "Current Volume: "$path

$java = try { Get-ChildItem -Path $path -Include java.exe -Force -Recurse -ErrorAction Ignore  | select -ExpandProperty VersionInfo | select CompanyName,ProductName,FileName,ProductVersion}

catch {

write-host '<SOFTWARES>'

write-host '    <PUBLISHER>'Company Name'</PUBLISHER>'

write-host '    <NAME>'Acess Denied'</NAME>'

write-host '    <COMMENTS>'Company Name OCS Plugin Java'</COMMENTS>'

write-host '    <FOLDER />'

write-host '    <VERSION />'

Write-Host '</SOFTWARES>'

}

if ( $java -eq $null )

{

write-host '<SOFTWARES>'

write-host '    <PUBLISHER>'Company Name'</PUBLISHER>'

write-host '    <NAME>'No Java found'</NAME>'

write-host '    <COMMENTS>'Company Name OCS Plugin Java'</COMMENTS>'

write-host '    <FOLDER />'

write-host '    <VERSION />'

write-Host '</SOFTWARES>'

}

else

{

foreach($item in $java)

{

write-host '<SOFTWARES>'

write-host '    <PUBLISHER>'$item.CompanyName'</PUBLISHER>'

write-host '    <NAME>'$item.ProductName'</NAME>'

write-host '    <COMMENTS>'Company Name OCS Plugin Java'</COMMENTS>'

write-host '    <FOLDER>'$item.FileName'</FOLDER>'

write-host '    <VERSION>'$item.ProductVersion'</VERSION>'

write-Host '</SOFTWARES>'

}

}

}

exit

by (200 points)
0 votes

This is a debug log of an agent that sent its inventory to the server, but not the agent plugin result.

Starting OCS Inventory NG Agent on Tuesday, January 23, 2024 13:56:56.

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 Prolog

DID_CHECK => Read DeviceID <example-server-2020-01-16-03-45-58> and MACs <xxx> in file <ocsinventory.dat>

COM SERVER => Initializing cURL library for sendRequest

COM SERVER => Using cURL without server authentication

COM SERVER => Disabling cURL proxy support

COM SERVER => Enabling cURL SSL server validation support using CA Bundle <C:\ProgramData\OCS Inventory NG\Agent\root-ca.crt>

COM SERVER => Sending HTTP Post request to URL <https://ocsinv.example.de/ocsinventory>

COM SERVER => HTTP Post response received <HTTP Status Code #200>

COM SERVER => Cleaning cURL library

AGENT => Prolog successfully sent

ERROR *** AGENT => Failed to write Prolog Frequency <Error code 32 = Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.  >

ERROR *** AGENT => Failed to write inventory on startup value <Error code 32 = Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.  >

AGENT => Inventory required

AGENT => Launching hardware and software checks

INVENTORY => Loading Download history

INVENTORY => Logged on user ID is <user-example>

INVENTORY => Operating System is <Microsoft Windows Server 2016 Standard 10.0.14393 >, description <>

INVENTORY => Operating System uses 64 bits memory address width

INVENTORY => Computer domain or workgroup is <example-server.de>

INVENTORY => User domain is <>

INVENTORY => System Manufacturer <VMware, Inc.>, System Model <VMware Virtual Platform>, System S/N <VMware-42 >, Bios Manufacturer <Phoenix Technologies LTD>, Bios Date <11/12/2020>, Bios Version <6.00>, Motherboard Manufacturer <Intel Corporation>, Motherboard Model <440BX Desktop Reference Platform>, Motherboard S/N <None>

INVENTORY => 2 processor(s) Intel(R) Xeon(R) Gold 6154 CPU @ 3.00GHz [2 core(s) x86_64] at 2993 MHz

INVENTORY => OS Memory 65536 MB, OS Swap size 75264 MB

INVENTORY => 128 memory slot(s) found

INVENTORY => 4 input device(s) found

INVENTORY => 4 system port(s) found

INVENTORY => 7 system slot(s) found

INVENTORY => 7 system controller(s) found

INVENTORY => 2 storage peripheral(s) found

WARNING *** INVENTORY => Failed to retrieve sound devices

WARNING *** INVENTORY => Failed to retrieve modems

INVENTORY => 2 network adapter(s) found

INVENTORY => 348 system printer(s) found

INVENTORY => 1 video adapter(s) found

INVENTORY => 1 system monitor(s) found

INVENTORY => Default IPv4 address is <example>

INVENTORY => Registered company <example-company>, registered owner <Mitarbeiter>, Product ID <-60...>

INVENTORY => Product key <WC2BQ-8N...>

INVENTORY => 90 software found

INVENTORY => Computer/VM UUID is <7B37-268A-C519->

INVENTORY => Computer seems to be VMware virtual host

INVENTORY => System Memory set to 65536 (instead of 65536)

INVENTORY => Reading last inventory state

AGENT =>  Communication Server asks for Registry Query

REGISTRY => Executing query asked by server

REGISTRY => 17 query successfully executed

EXECUTABLE PLUGIN => Searching for VBS script(s) in folder <C:\Program Files\OCS Inventory Agent\plugins>

EXECUTABLE PLUGIN => Searching for PS1 script(s) in folder <C:\Program Files\OCS Inventory Agent\plugins>

EXECUTABLE PLUGIN => Found executable plugin <java.ps1>

WARNING *** EXECUTABLE PLUGIN => Executable plugin <C:\Program Files\OCS Inventory Agent\plugins\java.ps1> output is not UTF-8 encoded or an XML document, trying to UTF-8 encode

ERROR *** EXECUTABLE PLUGIN => Failed to UTF-8 encode executable plugin <C:\Program Files\OCS Inventory Agent\plugins\java.ps1> output

AGENT => Sending Inventory

INVENTORY => Checking last inventory state

INVENTORY => System controllers inventory state changed

INVENTORY => Monitors inventory state changed

INVENTORY => Storage peripherals inventory state changed

INVENTORY => Logical drives inventory state changed

INVENTORY => Input peripherals inventory state changed

INVENTORY => Printers inventory state changed

INVENTORY => Inventory changed since last run

INVENTORY => Generating XML document with Device properties

INVENTORY => XML Update BIOS

INVENTORY => XML Update 2 CPU(s)

INVENTORY => XML Update 128 Memory Slot(s)

INVENTORY => XML Update 4 Input Device(s)

INVENTORY => XML Update 4 System Port(s)

INVENTORY => XML Update 7 System Controller(s)

INVENTORY => XML Update 7 System Slot(s)

INVENTORY => XML Update 0 Sound Device(s)

INVENTORY => XML Update 2 Storage Peripheral(s)

INVENTORY => XML Update 2 Logical Drive(s)

INVENTORY => XML Update 0 Modem(s)

INVENTORY => XML Update 2 Network Adapter(s)

INVENTORY => XML Update 1 Video Adapter(s)

INVENTORY => XML Update 1 Monitor(s)

INVENTORY => XML Update 348 Printer(s)

INVENTORY => XML Update 91 Software

INVENTORY => XML Update 1 Registry Value(s)

INVENTORY => XML Update Administrative Information(s)

INVENTORY => XML Update common Device properties

COM SERVER => Initializing cURL library for sendRequest

COM SERVER => Using cURL without server authentication

COM SERVER => Disabling cURL proxy support

COM SERVER => Enabling cURL SSL server validation support using CA Bundle <C:\ProgramData\OCS Inventory NG\Agent\root-ca.crt>

COM SERVER => Sending HTTP Post request to URL <https://ocsinv.example.de/ocsinventory>

COM SERVER => HTTP Post response received <HTTP Status Code #200>

COM SERVER => Cleaning cURL library

AGENT => Inventory successfully sent

INVENTORY => Writing new inventory state

WARNING *** INVENTORY => Failed to write new inventory state to file <C:\ProgramData\OCS Inventory NG\Agent\last_state>

AGENT =>  Communication Server asked for Package Download

DOWNLOAD => Package history file successfully cleaned for duplicate IDs

DOWNLOAD => Download disabled by server

AGENT => Unloading communication provider

AGENT => Unloading plug-in(s)

AGENT => Execution duration: 00:02:51.

by (200 points)
 
Powered by Question2Answer
...