GLPI

Plugin for integrating the glpi alert service into PandoraFMS.

Introduction

The purpose of this plugin is to be able to manage the GLPI ticket system in PandoraFMS, through alerts that will create calls for the creation of tickets and their follow-up.

The plugin performs all these actions through the glpi REST API.

Compatibility matrix

Systems where it has been tested Rocky Linux, Fedora 34
Systems where it works Any Linux system

Prerequisites

Parameters

Parameters GLPI

-u,--user GLPI user. Example: glpi. Required.
-x,--password GLPI password, Example: glpi. Required
-i, --url GLPI URL (with port), Example: http://localhost:8200. Required
-a, --app_token Application token, Example: xZvyKomCYHSSva5oTXTNmMiy4SWzfi7O1FF. Required

Ticket Parameters

-t,--ticket_name
Title or name for the ticket. Example: Module 8025 incident. Required
-d,--ticket_description

Message or description for the ticket. Example:

 "
2023-11-30 11:49:03
Free RAM
172.34.56.1
"
. Required

-p,--ticket_priority
Ticket priority. Example: 4. Required *
-c,--ticket_category
Category for the ticket. Example: Category1. Required
-g,--ticket_group
Group for the ticket. Example: Group1. Required
-j,--ticket_request_type
Type of request to add to the ticket (field 
requesttypes_id),
 default: 8.
-k,--ticket_name_error
Title of the ticket that will be added to tickets created when no computer is found.

Macros for ticket_name and ticket_description

%ticketID% Add the GLPI ticket number to the ticket description/title.

Example of use:

./pandora_glpi --user "glpi" --password "glpi" --url "http://127.0.0.1:8090/" --app_token "IwSQ9070LzaAQyg3vJKuRQZxPSfXuD16cOKOK7EA" --alias_agent "Rocky Linux 8" --id_module "1" --ticket_name "Incidencia modulo %ticketID%" --ticket_priority 4 --ticket_category 1 --ticket_group 1 --log_file "/tmp/glpi_logfile.txt" --recovery 0 --ticket_description "2023-11-30 11:49:03 Free RAM 172.34.56.1 ID ticket %ticketID%" --ticket_name_error "Error: No se encontró el equipo %ticketID%"

image.png

Pandora Parameters

-n,--alias_agent
Agent alias. Example: RockyLinux8. Required.
-m,--id_module
Module ID. Example: 8025. Required

Pandora API parameters

--api_url
Pandora API URL. Example: http://172.42.42.101
Default: http://localhost
--api_user
Pandora API user. Example: admin. Default: admin
--api_pass
Pandora API user password. Example: pandora. Default: pandora
--api_user_pass
Pandora API user password. Example: 1234. Default: 1234

Additional parameters

-l,--logfile
Path where the log file will be added. Example: /tmp/glpi_logfile.txt. Default: /tmp/glpi_logfile.txt
-r, --recovery
To activate recovery mode. Example: 1.  Required
Value Priority
1 Very low
2 Low
3 Medium
4 High
5 Very High
6 Essential

Help

Help The plugin has a help option where you can see all its parameters and their descriptions.

If you want to see the plugin help, run it with this parameter only.

Manual execution

The plugin execution format is as follows:

./pandora_glpi --user < user > --password < password > --url < url > --app_token < app token > \
--alias_agent < id_module > --id_module < id module > \
--ticket_name < ticket name > --ticket_message < ticket message > --ticket_priority < ticket priority > \
--ticket_category < ticket category > --ticket_group < ticket group > \
--log_file < log file > --recovery < 1 or 0 >

Example:

./pandora_glpi --user "glpi" --password "glpi" --url "http://localhost:8200" --app_token "xZvyKomCYHSSva5oTXTNmMiy4SWzfi7O1FFt" \
--alias_agent < "Rocky linux 8" > --id_module "8025" \
--ticket_name " Incidendia modulo 8025" \
--ticket_priority 4 \
--ticket_category "Categoria1" --ticket_group "grupo1" \
--log_file "/tmp/glpi_logfile.txt" --recovery 1 --ticket_message"
2023-11-30 11:49:03
Free RAM
172.34.56.1
"

 

Configuration in PandoraFMS

To configure the plugin, you need to set up an alert command using the plugin parameters to create custom executions.

 

This can be done from the alerts menu in commands:

ouqimage.png

You must enter a name, group, and command, using the macro _fieldx_ as values for the parameters, where x is the parameter number (there is no specific order; each macro simply needs to have a different number).

Once configured, you can set the macro value below in the description fields.

2.png