Is it possible to pass a different password to the check_nt/check_nrpe command for each windows host I have defined in my icinga configs?
For example, I have 3 windows hosts
define host {
use windows-server
host_name prod
address 10.0.0.1
}
define host {
use windows-server
host_name db
address 10.0.0.2
}
define host {
use windows-server
host_name test
address 10.0.0.3
}
and a service set up:
define service{
use generic-service
host_name prod,db,test
service_description Uptime
check_command check_nt!UPTIME
normal_check_interval 180
}
which calls
define command {
command_name check_nt
command_line /usr/lib/nagios/plugins/check_nt -H '$HOSTADDRESS$' -p 12489 -v '$ARG1$'
}
This is all working great but I want to be able to set a different password for each host (that isn't viewable from the web interface). I know that the USERn macro's don't appear in the web interface but I don't know how I could use them here.
Is there a simple way to do this without creating 3 different services and passing the password as an argument at that stage?
Best Answer
Yes, just rewrite the command definition:
Then you can either use three service definitions like so:
Or if you have a modern Nagios set host variables (_password) and use a macro ($_HOSTPASSWORD$) like so:
Or if you want add the macro directly to the command definition in a similar fashion.