The Mass_ocs_import plugin

This extension works from version 0.70 of GLPI or greater. Its purpose is to allow the addition and synchronization machines for OCS Inventory.

The extension is composed of:

  • a script for Linux that allows to run the script from the command line or via cron. It gives the ability to run several processes to complete the treatment.
  • a script for Windows to run from the command line or put in a scheduled task. On this platform, the script can not run a single process for treatment.
  • a graphical interface that allows the execution of all scripts. It provides information on imported machines, synchronized, linked and not imported.


  • On Linux, the package "php-cli or php5-cli" must be installed
  • Copy the files in the plugins directory of GLPI.
  • Changing the owner of all files and directories to the apache user
  • Make executable scripts in the scripts directory
  • Log into GLPI
  • In the Setup menu "Plugins click Import mass OCS
  • Click Install the plugin
  • Configuration Mode OCSNG "OCS Server '" Number of items to synchronize via cron to "0"

Configuring the plugin

The extension has several configuration options:

  • OCS server by default shows the OCS server on which the script will synchronize.
  • Show processes where nothing has been changed: yes even if the process did not change are displayed in the list.
  • Clear process after xx hours: indicates the number of hours during which data from a script are stored in base. (default 24)
  • Number of seconds to refresh the page (not refreshrate 0): indicates the frequency in seconds to refresh the detail page of a script is refreshed. If the value is 0, the page is not redisplayed.

You can manually disable synchronization by clicking the button "Enable lock. In this case, a file lock is placed on the file system. This prevents the script to start synchronization. This option allows you to temporarily stop the synchronization process for a SCO Update GLPI for example.


The synchronization script adapted to the platform, is launched by hand and / or via a scheduled task or a crontab

Scripts are available in the GLPI/scripts directory.
  • On * Linux * the script is run with one of the commands:

sh - thread_nbr = [number of threads to run] - server_id = [ID server OCS]

php run.php - thread_nbr = [number of threads to run] - server_id = [ID server OCS]

  • Under * Windows * the script is run with the command
    php run.php - thread_nbr = [number of threads to run] - server_id = [ID server OCS]

If the command * php * is not in a folder in your PATH, edit and use the run.bat file''informing''the correct paths:

@SET path_php = 'C: OCSNGxamppphp'

SET plugin_glpi = 'C: OCSNGxampphtdocsglpipluginsmass_ocs_importscripts'@

It is possible to track the execution of scripts.
The interface is accessible from the menu Plugins>> Import mass OCS.

Launch via cron

Add the script in the crontab of your apache user (www-data for debian):

* / 5 * * * * / var / www / glpi / plugins / mass_ocs_import / scripts / - thread_nbr = 2 - server_id = 1

for example, to run the script every 5 minutes

For Debian / Ubuntu, if the cron job above does not work, try:
* / 5 * * * * php / var / www / glpi / plugins / mass_ocs_import / scripts / run.php - thread_nbr = 2 - server_id = 1

Interface tracking script executions

The first tab shows a list of all the scripts launched. For each of them, a summary of actions is presented. By clicking on the login script opens a 3rd tab that displays the details of all transactions, thread by thread.
Visualization interface machines not imported

The second tab displays the list of machines that have been imported from OCS. Some information from the OCS inventory are displayed to help identify problems. For machines in this tab, you can perform a manual import. It suffices for this, select the computers and the destination entity. Then press "Import" and import occurs.

If the 'uninstall' plugin is installed, you get a new option to delete computers not imported directly into OCS database.