GLPI: automatic actions configuration

Presentation of automatic actions

The automatic actions in GLPI is a brick essential to the proper functioning of it.

They perform back-to-back tasks for software optimization and also inventory actions, helpdesk ….

Some examples :

  • Automatic closing of incidents
  • Send email
  • Collecting emails
  • Discovery Management and Inventory in FusionInventory
  • Log rotation

Automatic actions can be performed in two ways:

  • GLPI : the action is triggered by the user surf
  • CLI : the action is triggered by a scheduled task running on the web server (recommended).

Implementation

Configuring GLPI

1. Go on your GLPI.

2. From the navigation menu go to Configuration 1 > Automatic Actions 2 .

Menu : Actions automatiques


3. The list of automatic tasks is displayed with their execution mode, their status and the last execution date.

4. Click on an action to get the details. On the main tab we find the task planning, the execution mode and the status.

Détail d'une action

5. The Statistics 1 tab provides information on the execution of the task.

Statistique d'une action dans GLPI

6. The Logs 1 tab allows the visualization of the logs of the task.

Tâche logs

Skip all actions in CLI mode

1. Go to the list of actions.

2. Check box 1 to select the entire list and click Actions 2.

Sélectionner toutes les tâche

3. Action choose Edit 1, select Features – Execution Mode 2, choose CLI 3 and click Send 4.

Edition en lot

Set the number of actions per scheduled task

1. From the navigation menu go to Setup 1 > General 2.

Configuration générale


2. Go to the System 1 tab and change the Maximum number of simultaneous automatic actions (CLI execution) 2 and Save.

Option de configuration des tâches

Configuring a scheduled task (cron)

Windows

1. Create a file on your web server in the format xxxx.bat in the directory of your choice.

2. Open the file with the editor of your choice.

3. Enter the code below for your installation.

"chemin_installation_de_phpphp.exe" "chemin_installation_de_glpifrontcron.php"

Example:

"C:Program Files (x86)PHPv5.5php.exe" "D:wwwglpifrontcron.php"

4. Save your file.

5. Open Task Scheduler 1.

Ouvrir le planificateur

6. Click Create Task … 1.

Création tâche sous Windows

7. Give a name to task 1, check the Execute box even if the user is not logged in 2 and Execute with the maximum permissions 3. Then go to the Triggers tab 4.

Configuration générale de la tache

8. Click the New … button 1.

Ajouter un déclencheur

9. Select the execution frequency every day 1, check the box Repeat task every: 2, indicate frequency 3 and duration 4. Check that the trigger is activated 5 and finally click on the OK button 6.

Configuration du déclencheur

10. The trigger is added 1, go to the Actions tab 2.

Déclencheur ajouté

11. Click New … 1.

Ajouter une action

12. Click the Browse button … 1.

Aller chercher le .bat

13. Select your script 1 and click Open 2.

Sélectionner le fichier

14. Click OK 1.

Ajouter l'action

15. Check that action 1  has been taken into account and click OK 2 to validate the creation of the task.

Action ajoutée

16. The scheduled task has been added to list 1.

Tâche dans le gestionnaire

On Linux (Ubuntu)

1. Open an SSH session on your WEB server.

2. Enter the following command to edit the scheduled tasks.

sudo crontab -e

3. Create the task by entering the following line to execute the action every minute:

1 * * * * php /chemin_installation_glpi/front/cron.php &>/dev/null

4. Save the changes.

5. Restart the cron service.

sudo service cron restart

6. Check in GLPI the execution of automatic actions.

If the cron does not work, the following article should help you solve the problem: CRON scheduled task that does not run.

If you are using webmin, the cron job should be configured as below:

Webmin cron





Leave a Comment