There are many different ways to use free variables, here's just one example :
I am running some VMware Guest checks
The plugin requires the name of the Guest (as named in the vSphere inventory) for the --guest argument
I have three separate guest checks (memory, cpu, disk)
So in three separate services I need to provide the name of the Guest.
And that’s just for one Guest. What if I'm monitoring 50 guests. That's 150 service definition entries.
So what I could do is create a free variable in the HOST object.
It needs to be named beginning with an underscore
So we'll call it _GUESTNAME
And in the variable we've given it the value "File Server Production"
Now that can be referenced as a macro using $_HOSTGUESTNAME$
It looks confusing but host macros are referneced as $_HOST followed by the free variable without the underscore and ending with $
So now, in my service definition, instead of populating one of the $ARGx$ fields with the name of the guest, I could use $_HOSTGUESTNAME$ instead. I do this to all three service definitions.
To extend that further, I could assign that service to a host group instead of directly to a host. That host group ONLY has hosts that have that _GUESTNAME free variable defined.
So in the future, every time I add a new host to that host group, it will automatically get those three guest services.
So instead of three guest service definitions per host, we have just three guest service definitions for ALL hosts in the host group.
Does this make sense?
Here's some more reading on it:
http://nagios.sourceforge.net/docs/3_0/ ... tvars.html