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.

How to customize the unix agent or send data to the OCS server

How to customize the unix agent or send data to the OCS server
Hey guys, help me please.

I'm using OCS server on RedHat and Agent's for unix / linux, almost everything is working perfectly, but the agent does not find all software on linux, example software installed via tarball, compliados hand, etc. I realized that it takes / is only software installed via rpm.
  I have my list of software and its directories, I have shell scripts that check if indeed are installed (meet the need of the ocs Agent), wanted to include somehow this information together with the collected by the Agent, I noticed that it writes data from machines in XML, but do not know where nor the file, like a light.
  Objective: Make the agent does not, find and inputar software that the agent not find.
in OCS Inventory NG agent for Unix by (320 points)

7 Answers

0 votes
Hi,

Write a plugin which scans the directory where your applications are installed.

Regards

Frank
by (79.6k points)
0 votes
by (320 points)
0 votes
Hi,

Yes the plugin must be in perl.

See the examples here => http://wiki.ocsinventory-ng.org/index.php?title=Plugins:Crontab

Regards

Frank
by (79.6k points)
0 votes
The problem is I need to change the machine's software list that the agent is doing the inventory, and not create a new table as in the example of Crontab
by (320 points)
0 votes
by (320 points)
0 votes
Hi,

Crontab plugin is just an example. You are right plugin CustomExe is better for you. So you have to develop a plugin in perl for doing the same things. Here at OCS Team we don't have the time to do that.

Regards

Frank
by (79.6k points)
0 votes

Hi,

To add softwares, you should only write a plugin that prints :

<SOFTWARES>
<PUBLISHER>MyPublisher</PUBLISHER>
<NAME>MySoftware</NAME>
<VERSION>15</VERSION>
<COMMENTS>Some comments</COMMENTS>
</SOFTWARES>

For example, this plugin lists thr ODBC drivers on Windows :

const HKEY_LOCAL_MACHINE = &H80000002

'
'
'
Sub ListDrivers(archbits, regtype)
    Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
        oCtx.Add "__ProviderArchitecture", regtype

    strComputer = "."
    set objFSO = CreateObject("Scripting.FileSystemObject")
    
    'set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
        set oLocator = CreateObject("Wbemscripting.SWbemLocator")
        set objReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")

    'WScript.Echo "Architecture : " & regtype & " sur " & archbits
    strKeyPath = "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers"
    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
    
    objReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames
    for i=0 to UBound(arrValueNames)
        driver = arrValueNames(i)        
        key = "SOFTWARE\ODBC\ODBCINST.INI\" & driver
        objReg.GetStringValue HKEY_LOCAL_MACHINE, key, "Driver", dll
        if dll<>"" then
            if archbits=64 and regtype=32 then
                dll = Replace(dll, "system32", "SysWOW64")
            end if
            dllname = objFSO.GetFileName(dll)
            if dllname<>"odbcjt32.dll" and dllname<>"msorcl32.dll" and dllname<>"vfpodbc.dll" and objFSO.FileExists(dll) then
                dllVer =  objFSO.GetFileVersion(dll)
                wscript.echo "<SOFTWARES>"
                wscript.echo "<PUBLISHER>Driver ODBC " & regtype & " bits</PUBLISHER>"
                wscript.echo "<NAME>" & driver & "</NAME>"
                wscript.echo "<VERSION>" & dllver & "</VERSION>"
                wscript.echo "<COMMENTS>" & dll & "</COMMENTS>"
                wscript.echo "</SOFTWARES>"
            end if
        end if
    next
End Sub

'
' Windows 32 ou 64 bits ?
'
Set wshShell = CreateObject( "WScript.Shell" )
arch6432 = wshShell.ExpandEnvironmentStrings( "%PROCESSOR_ARCHITEW6432%" )
arch = wshShell.ExpandEnvironmentStrings( "%PROCESSOR_ARCHITECTURE%" )
if arch="AMD64" or arch6432="AMD64" then
    'archbits = 64
    ListDrivers 64, 32
    ListDrivers 64, 64
else
    'archbits = 32
    ListDrivers 32, 32
end if
Set wshShell = Nothing

Regards

by (6.2k points)
 
Powered by Question2Answer
...