Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
This isn't possible. The first line Nagios finds that isn't a proper nagios config line, it will error out and tell you the offending line is a misconfig.
You can use the $USERX$ macros for this, but they would all be in the one file.
Disregard this post, complete misunderstanding. @eloyd is correct here.
For instance, we define a "_SSH_PORT" custom object variable on each host because we run SSH on non-standard ports. We can then use this on a "check_ssh -p $_HOST_SSH_PORT" service check so that each host gets its custom SSH port checked without having to do something weird.
Your mileage may vary, but you can do a lot with the built-in macro capabilities.
Last edited by eloyd on Tue Aug 05, 2014 10:20 am, edited 1 time in total.
I completely misread the initial post - I thought @badonde was asking how to pass variables into a service (like passing arguments to a function), implying the config files have their own scripting language!