I'm in a unix environment where I'm using check_by_ssh to execute Nagios plug-ins. A few hosts have a different unix account to which Nagios needs to ssh into to run the plug-ins. I pass the account name with -l like this:
command_line $USER1$/check_by_ssh -p 22 \ -H $HOSTADDRESS$ -l <user> -i /home/nagios/.ssh/$HOSTNAME$ -C '<plug-in path>'
For the machines that have a different unix account is there a way to not have to double all the command definitions e.g. replacing -l nagios with -l user1 ?
I was hoping there was a way to pass the username in the host definition to say this set of hosts should login with user1 and this other set of hosts should use user2.
Any help is appreciated.