diff --git a/modules/monitoring/library/Monitoring/ProvidedHook/X509/Sni.php b/modules/monitoring/library/Monitoring/ProvidedHook/X509/Sni.php new file mode 100644 index 000000000..fd1818fd6 --- /dev/null +++ b/modules/monitoring/library/Monitoring/ProvidedHook/X509/Sni.php @@ -0,0 +1,35 @@ +select() + ->from('hoststatus', [ + 'host_name', + 'host_address', + 'host_address6' + ]); + if ($filter !== null) { + $hosts->applyFilter($filter); + } + + foreach ($hosts as $host) { + if (! empty($host->host_address)) { + yield $host->host_address => $host->host_name; + } + + if (! empty($host->host_address6)) { + yield $host->host_address6 => $host->host_name; + } + } + } +} diff --git a/modules/monitoring/run.php b/modules/monitoring/run.php index 50f715589..f1f48ddbe 100644 --- a/modules/monitoring/run.php +++ b/modules/monitoring/run.php @@ -4,3 +4,4 @@ /** @var $this \Icinga\Application\Modules\Module */ $this->provideHook('ApplicationState'); +$this->provideHook('X509/Sni');