Skip to main content
Question

OpenTicket and macro

  • March 5, 2026
  • 3 replies
  • 20 views

snoulot
Forum|alt.badge.img+2

Bonjour,

Je cherche à ouvrir des tickets dans mon ITSM (EasyVista) via OpenTicket, mais je rencontre une difficulté avec les macros.

Je souhaite passer en paramètre le Catalogue GUID stocké dans la macro EVSM_CATALOG_ID située dans les modèles (templates) de mes services.

  • Lorsque je renseigne le GUID directement dans la règle de notification (champ Catalog GUID), cela fonctionne.

  • En revanche, si j'utilise la variable {$service.custom_variables.EVSM_CATALOG_ID}, la transmission échoue.

De plus, je souhaiterais récupérer la valeur présente dans l'alias du service pour l'intégrer dans le champ CI, afin de lier automatiquement le ticket à ce CI.

Pourriez-vous m'aider à résoudre ces deux points ?

Merci d'avance.

English Version 

 

Hello,

I am trying to open tickets in my ITSM (EasyVista) using OpenTicket, but I am having an issue with macro integration.

I need to pass the Catalog GUID as a parameter. This GUID is stored in the EVSM_CATALOG_ID macro within my service templates.

  • When I enter the GUID manually in the notification rule (Catalog GUID field), it works perfectly.

  • However, when I use the variable {$service.custom_variables.EVSM_CATALOG_ID}, it no longer works.

Additionally, I would like to retrieve the value from the service alias to populate the CI field, in order to link the ticket to that specific CI.

Could you please assist me with these two issues?

Best regards,

 

3 replies

lpinsivy
Centreonian
Forum|alt.badge.img+21
  • Centreonian
  • March 9, 2026

Hi ​@snoulot, where do you want to use EVSM_CATALOG_ID? in a notification command?

If yes you must use $_SERVICEEVSM_CATALOG_ID$


snoulot
Forum|alt.badge.img+2
  • Author
  • Steward *
  • March 10, 2026

Hi,

Yes in notification command.

But if i use {$_SERVICEEVSM_CATALOG_ID$},

i have:  Syntax error in template "eval:{$_SERVICEEVSM_CATALOG_ID$}" on line 1 "{$_SERVICEEVSM_CATALOG_ID$}" - Unexpected "$", expected one of: "}"

And if use juste $_SERVICEEVSM_CATALOG_ID$ i have php error: “Error to open the ticket: An error happened with endpoint: https://mon_itsm/api/v1/50004/requests. Easyvista response is: { "message": "{\"error\":\"\\u00c9chec de la conversion d'une cha\\u00eene de caract\\u00e8res en uniqueidentifier\",\"error_code\":2013}", "correlationId": "69afe8b9aa603", "dataError": "", "exception": [ { "type": "Easyvista\\Exceptions\\ApiException", "code": 13, "message": "{\"error\":\"\\u00c9chec de la conversion d'une cha\\u00eene de caract\\u00e8res en uniqueidentifier\",\"error_code\":2013}", "file": "\/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/models\/Rest_model_ERRORHANDLER.php", "line": 339, "trace": [ "#0 \/var\/www\/html\/easyvista\/server\/src\/Core\/Api\/models\/Rest_model.php(400): Easyvista\\Core\\Api\\models\\ErrorHandler->changeStatusCodeFromResult('create(Object(Slim\\Psr7\\Response))", "#2 \/var\/www\/html\/easyvista\/server\/src\/App\/Api\/processHandler\/external\/post\/RestPostRequestsProcessHandler.php(38): Evsm\\Core\\Api\\models\\Rest_REQUEST->create(Object(Slim\\Psr7\\Response))", "#3 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/processHandler\/RestParentProcessHandler.php(735): Evsm\\App\\Api\\processHandler\\external\\post\\RestPostRequestsProcessHandler->processing()", "#4 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/RestAdapter\/JsonRouteLoader.php(190): Easyvista\\Core\\Api\\processHandler\\RestParentProcessHandler->process()", "#5 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Handlers\/Strategies\/RequestResponse.php(38): Easyvista\\Core\\Api\\RestAdapter\\JsonRouteLoader->{closure:Easyvista\\Core\\Api\\RestAdapter\\JsonRouteLoader::createRestRouteForFramework():168}(Object(Slim\\Psr7\\Request), Object(Slim\\Psr7\\Response), Array)", "#6 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Routing\/Route.php(358): Slim\\Handlers\\Strategies\\RequestResponse->__invoke(Object(Closure), Object(Slim\\Psr7\\Request), Object(Slim\\Psr7\\Response), Array)", "#7 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Slim\\Routing\\Route->handle(Object(Slim\\Psr7\\Request))", "#8 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Slim\\MiddlewareDispatcher->handle(Object(Slim\\Psr7\\Request))", "#9 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Routing\/Route.php(315): Slim\\MiddlewareDispatcher->handle(Object(Slim\\Psr7\\Request))", "#10 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Routing\/RouteRunner.php(68): Slim\\Routing\\Route->run(Object(Slim\\Psr7\\Request))", "#11 \/var\/www\/html\/easyvista\/server\/src\/Core\/Rest\/DebugInfoMiddleware.php(31): Slim\\Routing\\RouteRunner->handle(Object(Slim\\Psr7\\Request))", "#12 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Evsm\\Core\\Rest\\DebugInfoMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Slim\\Routing\\RouteRunner))", "#13 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/CompressMiddleware.php(30): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#14 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\CompressMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#15 \/var\/www\/html\/easyvista\/server\/src\/Core\/Rest\/MainTaskMiddleware.php(59): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#16 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Evsm\\Core\\Rest\\MainTaskMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#17 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/LogActivityMiddleware.php(31): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#18 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\LogActivityMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#19 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/AutorizationMiddleware.php(64): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#20 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\AutorizationMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#21 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/AuthenticationMiddleware.php(48): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#22 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\AuthenticationMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#23 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/CacheMiddleware.php(73): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#24 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\CacheMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#25 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/JsonBodyParserMiddleware.php(27): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#26 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\JsonBodyParserMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#27 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Middleware\/RoutingMiddleware.php(45): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#28 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(121): Slim\\Middleware\\RoutingMiddleware->process(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#29 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/Middleware\/ErrorMiddleware.php(76): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#30 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(121): Slim\\Middleware\\ErrorMiddleware->process(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#31 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/middleware\/CorsMiddleware.php(32): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#32 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Easyvista\\Core\\Api\\middleware\\CorsMiddleware->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#33 \/var\/www\/html\/easyvista\/server\/dependencies\/middlewares\/trailing-slash\/src\/TrailingSlash.php(56): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#34 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(121): Middlewares\\TrailingSlash->process(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#35 \/var\/www\/html\/easyvista\/server\/src\/Core\/Api\/RestAdapter\/JsonRouteLoaderEVSM.php(93): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#36 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(269): Evsm\\Core\\Api\\RestAdapter\\JsonRouteLoaderEVSM->__invoke(Object(Slim\\Psr7\\Request), Object(Psr\\Http\\Server\\RequestHandlerInterface@anonymous))", "#37 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/MiddlewareDispatcher.php(65): Psr\\Http\\Server\\RequestHandlerInterface@anonymous->handle(Object(Slim\\Psr7\\Request))", "#38 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/App.php(199): Slim\\MiddlewareDispatcher->handle(Object(Slim\\Psr7\\Request))", "#39 \/var\/www\/html\/easyvista\/server\/dependencies\/slim\/slim\/Slim\/App.php(183): Slim\\App->handle(Object(Slim\\Psr7\\Request))", "#40 \/var\/www\/html\/easyvista\/server\/dependencies\/easyvista\/servercommons\/src\/Core\/Api\/RestAdapter\/RestAdapter.php(83): Slim\\App->run()", "#41 \/var\/www\/html\/easyvista\/api\/v1\/index.php(66): Easyvista\\Core\\Api\\RestAdapter\\RestAdapter->run()", "#42 {main}" ] } ] }.”

 


tcharles
Centreonian
Forum|alt.badge.img+5
  • Centreonian
  • March 19, 2026

Hello ​@snoulot,

 

As we discussed today during our call, most of what you want to achieve is doable. We mostly talked about

  • using values from service custom macro
    • not currently doable for services custom macro. But you can do it for host macros. I think for service this is a feature that we can add
  • using values from service note field
    • that is doable

 

CI example

Let’s start with the easy part and a little example. You want to use the note field of your service to set the CI field in easy vista.

First, just to let you know, by default, this provider sends the name of the host or one of its hostgroup as a CI  https://github.com/centreon/centreon-documentation/blob/MON-16060_open_ticket_connectors_1/cloud/alerts-notifications/ticketing/providers/easyvista-rest.md#ci-parameter

But this is not your use case, so let’s jump onto it.

service config

 

open ticket rule configuration

 

value used is: 

{if $service_selected|@count gt 0}{foreach from=$service_selected item=service}{$service.notes}{/foreach}{/if}

This code is based on Smarty (a template engine for php). The variables that you see are documented here:  https://docs.centreon.com/cloud/alerts-notifications/ticketing/ticketing-advanced-smarty-variables/#tickets-on-services

 

When I open a ticket on my service with such configuration, I will send the below payload

{
"requests": [
{
"catalog_guid": "2712",
"catalog_code": null,
"title": "Issue central/passif/CRITICAL",
"description": "\nadmin open ticket at 19/03/26 10:59:19\n\n\n\n CATALOG GUID: 2712 - 2712\n \n\nHost: central\nService: passif\nState: CRITICAL\nDuration: 17s\nOutput: (No output returned from plugin)\n\n",
"ci_name": "MY_SERVICE_NOTE"
}
]
}

As you can see, there is a ci_name field that is the one used by Easyvista to link your ticket to a CI.

 

Host custom macro example

As I said, custom macro on services are not currently usable. But I am still showing you the way you can do it with host custom macro. Keep in mind that it is a very advanced usage.

 

Let say I want the Catalog GUID value to come from my custom macro EZVCATALOG that is set on each host.

So first, in the general tab of your open ticket rule you can have something like that

 

  • in the first part, the value is {$select.ezv_catalog_guid.value}
  • second part is very basic, just make juste that the Id is ezv_catalog_guid and Type is Custom
  • the third part is where the magic will start. Value and label are going to use Smarty code. Code that is here to load a file {include file="file:$centreon_open_tickets_path/providers/EasyVistaRest/templates/catalog.ihtml"}

 

Now let’s have a look at the /usr/share/centreon/www/modules/centreon-open-tickets/providers/EasyVistaRest/templates/catalog.ihtml file 

 

{if $service_selected|@count gt 0}{foreach from=$service_selected item=service}{host_get_macro_value_in_config host_id=$service.host_id macro_name='EZVCATALOG'}{$host_get_macro_value_in_config_result}{/foreach}{/if}

This code checks if you are opening a ticket on a service and if so if triggers a Centreon Smarty function that will get the value of the EZVCATALOG custom macro from the host. (Centreon Smarty functions are documented here: https://docs.centreon.com/cloud/alerts-notifications/ticketing/ticketing-advanced-smarty-functions/

 

At this point, it looks good but it is not going to work. Values that are set in the Custom List Definition are supposed to be string. Therefore, if you write Smarty code inside it, it is not going to be executed. 

 

In the advanced tab of your open ticket rule, you have the following block of Smarty code

<table class="table">
<tr>
<td class="FormHeader" colspan="2"><h3 style="color: #00bfb3;">{$title}</h3></td>
</tr>
<tr>
<td class="FormRowField" style="padding-left:15px;">{$custom_message.label}</td>
<td class="FormRowValue" style="padding-left:15px;">
<textarea id="custom_message" name="custom_message" cols="50" rows="6"></textarea>
</td>
</tr>
<tr>
<td class="FormRowField" style="padding-left:15px;">Use hostgroup name as CI</td>
<td class="FormRowField" style="padding-left:15px;"><input id="ci_type_selector" type="checkbox"></input></td>
</tr>
</tr>
{include file="file:$centreon_open_tickets_path/providers/Abstract/templates/groups.ihtml"}
{include file="file:$centreon_open_tickets_path/providers/EasyVistaRest/templates/handle_ci.ihtml"}
</table>

 

You have this part {include file="file:$centreon_open_tickets_path/providers/Abstract/templates/groups.ihtml"} that must be replaced by {include file="file:$centreon_open_tickets_path/providers/EasyVistaRest/templates/groups.ihtml"}

 

then you need to duplicate this “groups” file with the following command on your central server

 cp /usr/share/centreon/www/modules/centreon-open-tickets/providers/Abstract/templates/group* /usr/share/centreon/www/modules/centreon-open-tickets/providers/EasyVistaRest/templates/

The groups.ihtml file is calling the group.ihtml file from the Abstract directory, we need to change that using the below command

sed -i 's/Abstract/EasyVistaRest/g' /usr/share/centreon/www/modules/centreon-open-tickets/providers/EasyVistaRest/templates/groups.ihtml

And now, in the  /usr/share/centreon/www/modules/centreon-open-tickets/providers/EasyVistaRest/templates/group.ihtml replace 

<option value='{$k}___{$v}___{$groups.$groupId.placeholder.$k}' {if $v eq $groups.$groupId.default}selected{/if}>{$groups.$groupId.placeholder.$k}</option> 

by 

<option value='{$k}___{eval var=$v}___{eval var=$groups.$groupId.placeholder.$k}' {if $v eq $groups.$groupId.default}selected{/if}>{eval var=$groups.$groupId.placeholder.$k}</option>

 

By adding those eval blocks, the Smarty code from our custom list definition is going to be interpreted.

 

 

Documentation references:

As I said, we are currently reworking the whole open ticket documentation that’s why at the moment we have only put it on the cloud documentation and the connector new documentation is not yet published)

centreon smarty variables: https://docs.centreon.com/cloud/alerts-notifications/ticketing/ticketing-advanced-smarty-variables/

centreon smarty functions: https://docs.centreon.com/cloud/alerts-notifications/ticketing/ticketing-advanced-smarty-functions/

how mapping in the rule works: https://docs.centreon.com/cloud/alerts-notifications/ticketing/ticketing-advanced-mapping/

provider documention (not yet published): https://github.com/centreon/centreon-documentation/blob/MON-16060_open_ticket_connectors_1/cloud/alerts-notifications/ticketing/providers/easyvista-rest.md#ci-parameter 

 

I hope it helps.

Have a nice day,

Regards,