All the setings have been imported, the config is deployed locally and icinga is successfully restarted.
Now time to configure deploying configs to collectors, and I'm facing a problem: SSH works on a non-standart port (let's say 4321).
The script first copies the config using scp, then restarts icinga using ssh. But the fact is that port is defined using the -P parameter for scp and -p for ssh.
So if I add "-P 4321" to ssh_options, scp works and ssh does not and vice versa:
scp upload collector config FAILED
system call OK
scp -r -i /etc/nconf/id_rsa -P 4321 -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 15' /tmp/nconf/ nconf@mon1:/etc/icinga/nconf/
system call FAILED
ssh -i /etc/nconf/id_rsa -P 4321 -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 15' nconf@mon1 "sudo /etc/init.d/icinga reload"
ssh: connect to host 4321 port 22: Invalid argument
So I propose adding a ssh_port directive to set the port if it's not the default one.
Maybe someone can propose a workaround for this situation, I think I'm not the only one using custom SSH ports.