Skip to main content
Released

Possibility to use macros within macros

Related products:Infra Monitoring - Configuration
  • Oct 24, 2022 12:46 PM UTC
  • 21 replies
  • 383 views

LucasL
Forum|alt.badge.img+3

Hello,

 

A nice feature would be to be able to use macros within custom macros.

For example use $hostname$ in a URL like this in order to use the hostname do dynamically create the URL.


Thanks in advance for the consideration.

21 replies

LucasL
Forum|alt.badge.img+3
  • Author
  • Steward **
  • Oct 24, 2022 2:31 PM UTC

Hello,

This is my first idea post I did not know about the template, I did not find a way to update my post so I’ll add this here : 
 

  • Persona : Anyone who manages a Centreon platform

  • Problem : Prevents to set manual value for each host or create a dedicated service template

  • Expected outcome : Gain time and flexibility in macro management

  • Potential solutions : Refer to my screenshot

Hope this adds up to the initial post


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Nov 18, 2022 10:23 AM UTC
New→Needs Votes

omercier
Centreonian
Forum|alt.badge.img+15
  • Centreonian
  • Dec 5, 2022 4:04 PM UTC

Hi @LucasL, 

I acknowledge the interest of such a feature in a general purpose, of course.

But I also have an alternative proposition.

What about changing the way the commands are built, from

--url='$_HOSTJOLOKIAURL$'

to

--url='$_HOSTJOLOKIAPROTO$://$HOSTADDRESS$:$_HOSTJOLOKIAPORT$/$_HOSTJOLOKIAPATH$

?


LucasL
Forum|alt.badge.img+3
  • Author
  • Steward **
  • Dec 5, 2022 4:10 PM UTC

Hello,

@omercier my post was to give an example this was not specifically related to Jolokia. The idea is to have the possibility macro in custom macro fields.

 

And the issue with having to modify the command you would have to modify the command for each services you want to add ‘the intelligence’


Forum|alt.badge.img+14
  • Ranger *
  • Dec 8, 2022 8:23 PM UTC

Hello,

I have an exemple with an old question

I would use a resource on a template because it was impossible to use a macro on a macro with standard command, standard service template.

The goal was to use a macro inside the value of a macro who contains a path of filesystem.

The workaround was to create a custom command, custom service template.

Regards,


omercier
Centreonian
Forum|alt.badge.img+15
  • Centreonian
  • Dec 13, 2022 7:58 AM UTC

If we imagine such a feature, the order in which macros are evaluated would be important. 

And maybe all types of macros do not need to be usable in other macros?

For example, what if only resource macros ($USER1$, $CENTREONPLUGINS$, any name you want that would have a unique value for each poller) and standard macros ($HOSTNAME$, $HOSTADDRESS$, $SERVICEDESC$ and all the builtin macros from centengine) would be available for substitution and custom macros ($_HOSTSNMPCOMMUNITY$, $_SERVICEWARNING$, all the macros that you can customize from the host/service configuration menus) would be excluded? Would it fit your needs?


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Dec 19, 2022 3:56 PM UTC
Needs Votes→Discussion ongoing

Forum|alt.badge.img+14
  • Ranger *
  • Dec 22, 2022 6:45 PM UTC

Hello,

I'm not the creator of this ideas, but i think the type of Macros that it’s could be used inside a Macro would be the custom macro.

But the standard macro could be a good use case also.

I don't think ressource macro is a good features, by design this type of macro would be used to set user account and others macro for the execution of command.

But maybe, by that i limit the Idea and the new functionnality that we could imagine.

Greg,

 

 


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Feb 22, 2023 2:30 PM UTC
Discussion ongoing→In Backlog

Forum|alt.badge.img+13
  • Builder ***
  • Nov 25, 2025 4:12 PM UTC

After 2 years in Backlog and 24 upvotes.

What is the status of this please ?

We still can’t use standard macro like $HOSTADDRESS$ in custom macros 😐


fmattes
Centreonian
Forum|alt.badge.img+11
  • Centreonian
  • Jan 9, 2026 2:28 PM UTC

Hi,

We propose the following implementation : 

  • for a service, allow to include in custom macros :
    • this service standard & custom macros 
    • linked host’s standard & custom macros 
    • linked poller’s resource macros
    • not allowed to include other host/service/poller macros
  • recursive count limited to 1 (macros in custom macro)

ie : 

$_SERVICECUSTOMURL$ =  http://$HOSTADDRESS$:$_HOSTHTTPPORT$/$_SERVICEENDPOINT$

 

Would this fit with your needs ​@LucasL ​@benoitp ​@gespada ?


Alexandre Belhomme
Forum|alt.badge.img+13

I would love that personally.


Forum|alt.badge.img+13
  • Builder ***
  • Jan 12, 2026 10:04 AM UTC

Hello,

 

It seems great, I think it matches our needs. 


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Mar 20, 2026 1:25 PM UTC
In Backlog→Planned

rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • May 29, 2026 12:26 PM UTC

Just released in recent 25.10 


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • May 29, 2026 12:26 PM UTC
Updated idea statusPlanned→Released

Forum|alt.badge.img+6

Hi,

Any plan to release in 22.10 LTS?


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Jun 2, 2026 5:28 AM UTC

No, 22.10 is not supported (and was never an LTS...). We strongly advise you to upgrade to a supported version


Forum|alt.badge.img+13
  • Builder ***
  • Jun 2, 2026 7:35 AM UTC

Edit :

Release in :

Centreon Collect 25.10.6

[Configuration] Macros can now be used inside custom macros (recursive).


Forum|alt.badge.img+6

No, 22.10 is not supported (and was never an LTS...). We strongly advise you to upgrade to a supported version

Sorry, typo, any plans to make it in version 24.10?

centreon-web-24.10.25-1.el9


rchauvel
Centreonian
Forum|alt.badge.img+18
  • Centreonian
  • Jun 2, 2026 3:52 PM UTC

Ah I see. No, 24.10 is now in phase 2 (no enhancements) of the version lifecycle.