如何在不使用 CLI 向导的情况下设置 Icinga2 远程客户端?

Lim*_*eng 11 icinga2

我想通过 Puppet 设置 Icinga2 远程客户端,但是官方文档的整个页面都在谈论使用他们很棒的CLI 向导,这需要手动运行。

任何解决方法?也许我应该回到Nagios?

小智 16

我遇到过同样的问题。这是我在从 icinga2 节点向导代码中提取逻辑后使用的。

您将需要的变量:

$pki_dir - /etc/icinga2/pki in the default installation
$fqdn - fully host+domain name of the client.
$icinga2_master - resolvable fqdn of the master
$icinga2_master_port - the port the master is connectable on.
$ticket - generated on the master via 'icinga2 pki ticket --cn $fqdn'
Run Code Online (Sandbox Code Playgroud)

编码:

mkdir icinga:icinga 0700 $pki_dir
icinga2 pki new-cert --cn $fqdn --key $pki_dir/$fqdn.key --cert $pki_dir/$fqdn.crt
icinga2 pki save-cert --key $pki_dir/$fqdn.key --cert $pki_dir/$fqdn.crt --trustedcert $pki_dir/trusted-master.crt --host $icinga2_master
icinga2 pki request --host $icinga2_master --port $icinga2_master_port --ticket $ticket --key $pki_dir/$fqdn.key --cert $pki_dir/$fqdn.crt --trustedcert $pki_dir/trusted-master.crt --ca $pki_dir/ca.key
icinga2 node setup --ticket $ticket --endpoint $icinga2_master --zone $fqdn --master_host $icinga2_master --trustedcert $pki_dir/trusted-master.crt
systemctl restart icinga2  # or however you restart your icinga
Run Code Online (Sandbox Code Playgroud)