Changeset View
Changeset View
Standalone View
Standalone View
site-modules/profile/manifests/icinga2/objects/agent_checks.pp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | class profile::icinga2::objects::agent_checks { | ||||
$plugin_dir = '/usr/lib/nagios/plugins' | $plugin_dir = '/usr/lib/nagios/plugins' | ||||
$swh_plugin_dir = "${plugin_dir}/swh" | $swh_plugin_dir = "${plugin_dir}/swh" | ||||
$swh_plugin_configfile = '/etc/icinga2/conf.d/swh-plugins.conf' | $swh_plugin_configfile = '/etc/icinga2/conf.d/swh-plugins.conf' | ||||
$packages = [ | $packages = [ | ||||
'python3-nagiosplugin', | 'python3-nagiosplugin', | ||||
'python3-systemd', | 'python3-systemd', | ||||
'monitoring-plugins-basic', | 'monitoring-plugins-basic', | ||||
'monitoring-plugins-systemd', # in swh repository | |||||
] | ] | ||||
package {$packages: | package {$packages: | ||||
ensure => present, | ensure => present, | ||||
} | } | ||||
file {$swh_plugin_dir: | file {$swh_plugin_dir: | ||||
ensure => 'directory', | ensure => 'directory', | ||||
owner => 'root', | owner => 'root', | ||||
Show All 37 Lines | ::icinga2::object::checkcommand {$command: | ||||
import => ['plugin-check-command'], | import => ['plugin-check-command'], | ||||
command => $icinga_command, | command => $icinga_command, | ||||
arguments => $plugin['arguments'], | arguments => $plugin['arguments'], | ||||
vars => $plugin['vars'], | vars => $plugin['vars'], | ||||
target => $swh_plugin_configfile, | target => $swh_plugin_configfile, | ||||
} | } | ||||
} | } | ||||
$plugin_packages = [ | |||||
'monitoring-plugins-systemd', # in swh repository | |||||
] | |||||
package {$plugin_packages: | |||||
ensure => present, | |||||
require => Class['Profile::Swh::Apt_config'] | |||||
} | |||||
$check_command = "check_systemd" | $check_command = "check_systemd" | ||||
$check_command_path = "${plugin_dir}/${check_command}" | $check_command_path = "${plugin_dir}/${check_command}" | ||||
::icinga2::object::checkcommand {$check_command: | ::icinga2::object::checkcommand {$check_command: | ||||
import => ['plugin-check-command'], | import => ['plugin-check-command'], | ||||
command => [ $check_command_path ], | command => [ $check_command_path ], | ||||
arguments => { | arguments => { | ||||
'--unit' => { | '--unit' => { | ||||
value => '$check_systemd_unit$', | value => '$check_systemd_unit$', | ||||
description => 'Name of the systemd unit that is being tested.', | description => 'Name of the systemd unit that is being tested.', | ||||
}, | }, | ||||
}, | }, | ||||
target => $swh_plugin_configfile, | target => $swh_plugin_configfile, | ||||
require => Package[$packages], | require => Package[$plugin_packages], | ||||
} | } | ||||
} | } |