I have a Nagios NRPE module in my Puppet environment.
In the nrpe.cfg template I've configured some if statements in order to set specific checks to specific hosts.
Example:
<% if @hostname =~ /rs\d+/ -%>
command[check_smtp]=/usr/lib64/nagios/plugins/check_smtp -H rs01.company.com -p 25 -e rs01.company.com
<% end -%>
Meaning:
If hostname starts with chars rs followed by a digit then apply the check commands in the if statement block.
I want change the check to something like this:
command[check_smtp]=/usr/lib64/nagios/plugins/check_smtp -H @hostname -p 25 -e @hostname
But the problem is that @hostname is a ruby variable and the check command is written in bash.
How can I achieve my goal?