Page 2 of 2

Re: Using host macros in static service definition

Posted: Thu Sep 24, 2015 6:57 am
by eloyd
Just wondering if this was ever opened or resolved?

Re: Using host macros in static service definition

Posted: Thu Sep 24, 2015 5:18 pm
by ssax
I'm not seeing it as being an open or closed issue.

Re: Using host macros in static service definition

Posted: Fri Sep 25, 2015 5:08 pm
by eloyd
I wonder if, you know, like someone should open it as a ticket. :)

Re: Using host macros in static service definition

Posted: Mon Sep 28, 2015 10:05 am
by tmcdonald
I don't know if this would be an easy change.

Macros are typically used in commands, such as using $HOSTADDRESS$, because that information changes based on the check being run and is parsed each run-through. In order to have macros work in definitions in other places, you would need to have Nagios parse out the configs in a very specific order. If you try to reference a macro that has not been "built" yet, you will need to parse every other config file and "build" it, then go back and fill it in once the value is know. I might not be explaining this the best, but in my mind configs like contacts are "static" meaning once they are loaded into memory they do not change, and commands are "dynamic" because they change depending on the host/service. Changing Core to make everything dynamic would be a huge undertaking, and there would likely be some heavy performance implications.

I'll have a dev weigh in, and if he says differently I would be happy to file a request.

Re: Using host macros in static service definition

Posted: Tue Sep 29, 2015 6:57 am
by eloyd
Yes, but...we're talking about user-defined macros that are indeed included and expanded at other points in the code:
My browse through common/macros.c indicates that _SERVICE and _HOST and _CONTACT variables are all included at the same time, but only in service, host, and contact configurations.
It's just a double-pass compiler parse is all. You can probably do it all with yacc and bison. :)

Re: Using host macros in static service definition

Posted: Wed Sep 30, 2015 8:57 am
by lgroschen
So the issue was opened on Github by abrist - we should verify it still is in the issue list. I'm sure John Frickson will be able to take a look at it.

Re: Using host macros in static service definition

Posted: Fri Oct 02, 2015 12:29 pm
by jfrickson
In this message https://support.nagios.com/forum/viewto ... 74#p108900, abrist asked someone (Eric?) to open an issue in github. I don't see any issues (either open or closed) in either github or tracker.

Re: Using host macros in static service definition

Posted: Mon Oct 05, 2015 3:05 pm
by eloyd

Re: Using host macros in static service definition

Posted: Mon Oct 05, 2015 3:08 pm
by hsmith
Thanks for the submission. I let John know you replied here.