Using Environment Variables in resource.cfg file

Is there a way to reference an environment variable in a resource.cfg file.
Specifically I want to set

I have this env. variable defined in my etc/profile and when I log in as nagios I can echo this value.


why would you want this?
you always use the same IP for the DB… so there’s not much use in this… or am i missing something?


Let’s say I have a user with an environment variable of:
Per a quote right out of the resource.cfg file is this:
"Nagios supports up to 32 $USERx$ macros ($USER1$ through $USER32$)"
So, I would put this in my resource.cfg file like this:
So yes, nagios is able to reference an envornment variable, but not like you suggested it could.
In your example you have an env variable like this:
So in resource.cfg you would put this:
I can see why you might want to do this. If your DB ip changes alot, then you would only have to modify the $USER3$= ip change and it would apply to all the other definitions that utilize $USER3$.

Hello, in response to Jakkedup and luca.

Luca - Nagios is running on one box and my db is on another. I need to change this for development->testing->production. The IP’s will definitely change between these environments.

Jakkedup - The macro’s are helpful but… if I understand the approach, I would have to change the DB IP in the Nagios file and in my .conf file that stores my export statements for all the other programs that need this IP. I’m trying to only do it in one place. As I’m sure you can imagine if there are two places to make the change, there’s a good chance one of them will get missed.