Skip to content

Massive import Expert Mode

Xavier CAILLAUD edited this page Mar 18, 2022 · 4 revisions

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.

Installation

  • On Linux, the package "php-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
  • on each OCS server, the "sync method" option allow switch from the standard mode and this expert mode.

Setup

The extension has several configuration options:

  • Show processes where nothing has been changed : yes even if the process did not change are displayed in the list.
  • Authorize the OCSNG update : if plugin Item uninstall (uninstall) is installed, we can delete the computer form the list Computers not imported by automatic actions (massive action).
  • 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 disable the synchronization process, for a system of GLPI Update, for example.

Use

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

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

or:

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

bat

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:\OCSNG\xampp\php'

SET plugin_glpi = 'C:\OCSNG\xampp\htdocs\glpi\plugins\ocsinventoryng\scripts'

It is possible to track the execution of scripts. The interface is accessible from the menu Tools > OCS Inventory Ng.

Launch via cron

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

* / 5 * * * * /var/www/glpi/plugins/ocsinventoryng/scripts/ocsng_fullsync.sh -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/ocsinventoryng/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.