diff --git a/site-modules/profile/manifests/icinga2/objects/agent_checks.pp b/site-modules/profile/manifests/icinga2/objects/agent_checks.pp --- a/site-modules/profile/manifests/icinga2/objects/agent_checks.pp +++ b/site-modules/profile/manifests/icinga2/objects/agent_checks.pp @@ -75,13 +75,15 @@ } } - $swh_plugin_dir = '/usr/lib/nagios/plugins/swh' + $plugin_dir = '/usr/lib/nagios/plugins' + $swh_plugin_dir = "${plugin_dir}/swh" $swh_plugin_configfile = '/etc/icinga2/conf.d/swh-plugins.conf' $packages = [ 'python3-nagiosplugin', 'python3-systemd', 'monitoring-plugins-basic', + 'monitoring-plugins-systemd', # in swh repository ] package {$packages: ensure => present, @@ -134,4 +136,19 @@ target => $swh_plugin_configfile, } } + + $check_command = "check_systemd" + $check_command_path = "${plugin_dir}/${check_command}" + ::icinga2::object::checkcommand {$check_command: + import => ['plugin-check-command'], + command => [ $check_command_path ], + arguments => { + '--unit' => { + value => '$check_systemd_unit$', + description => 'Name of the systemd unit that is being tested.', + }, + }, + target => $swh_plugin_configfile, + require => Package[$packages], + } }