Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/opnsense/monitoring.pp
# Configure the icinga checks and prometheus endpoints for the firewalls | # Configure the icinga checks and prometheus endpoints for the firewalls | ||||
class profile::opnsense::monitoring { | class profile::opnsense::monitoring { | ||||
$fw_hosts = lookup('opnsense::hosts') | $fw_hosts = lookup('opnsense::hosts') | ||||
$fw_prometheus_port = lookup('opnsense::prometheus::port') | $fw_prometheus_port = lookup('opnsense::prometheus::port') | ||||
$fw_prometheus_metrics_path = lookup('opnsense::prometheus::metrics_path') | $fw_prometheus_metrics_path = lookup('opnsense::prometheus::metrics_path') | ||||
$icinga_checks_file = lookup('icinga2::exported_checks::filename') | $icinga_checks_file = lookup('icinga2::exported_checks::filename') | ||||
$fw_hosts.each | $host | { | $icinga_zonename = lookup('icinga2::master::zonename') | ||||
$static_labels = lookup('prometheus::static_labels', Hash) | $fw_hosts.each | $host | { | ||||
$target = "${host}:${fw_prometheus_port}" | $target = "${host}:${fw_prometheus_port}" | ||||
profile::prometheus::export_scrape_config { $host : | profile::prometheus::export_scrape_config { $host : | ||||
target => $target, | target => $target, | ||||
scheme => 'http', | scheme => 'http', | ||||
metrics_path => $fw_prometheus_metrics_path, | metrics_path => $fw_prometheus_metrics_path, | ||||
} | } | ||||
::icinga2::object::host {$host: | |||||
display_name => $host, | |||||
check_command => 'hostalive', | |||||
target => "/etc/icinga2/zones.d/${icinga_zonename}/${host}.conf", | |||||
} | |||||
::icinga2::object::service {"opnsense https on ${host}": | ::icinga2::object::service {"opnsense https on ${host}": | ||||
service_name => 'opnsense', | service_name => 'opnsense', | ||||
import => ['generic-service'], | import => ['generic-service'], | ||||
host_name => $host, | host_name => $host, | ||||
check_command => 'http', | check_command => 'http', | ||||
vars => { | vars => { | ||||
http_address => $host, | http_address => $host, | ||||
http_vhost => $host, | http_vhost => $host, | ||||
Show All 9 Lines |