From 7673aca60e84d1c3df0d13e72d50695042315f55 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Tue, 24 Sep 2024 17:29:07 +0200 Subject: [PATCH] Move nrpe class from opsrepo --- manifests/nrpe.pp | 79 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 manifests/nrpe.pp diff --git a/manifests/nrpe.pp b/manifests/nrpe.pp new file mode 100644 index 0000000..c13f0ea --- /dev/null +++ b/manifests/nrpe.pp @@ -0,0 +1,79 @@ + +# NRPE class +class sunetdrive::nrpe( + $loadw = '15,10,5', + $loadc = '30,25,20', + $procsw = 150, + $procsc = 200, +) { + + require apt + class { 'sunet::nagios': + command_timeout => 600, + loadw => $loadw, + loadc => $loadc, + procsw => $procsw, + procsc => $procsc, + } + package {'nagios-plugins-contrib': ensure => latest} + if ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '22.04') >= 0 ){ + $mem_w = '90' + $mem_c = '95' + } else { + $mem_w = '10' + $mem_c = '5' + } + $checks = ['nrpe_check_memory'] + $checks.each |$check| { + ensure_resource("sunet::nagios::${check}", "nagios-nrpe-${check}") + } + sunet::nagios::nrpe_command {'check_entropy': + command_line => '/usr/lib/nagios/plugins/check_entropy -w 256' + } + sunet::nagios::nrpe_command {'check_ntp_time': + command_line => '/usr/lib/nagios/plugins/check_ntp_time -H localhost' + } + sunet::nagios::nrpe_command {'check_scriptherder': + command_line => '/usr/local/bin/scriptherder --mode check' + } + sunet::sudoer {'nagios_run_needrestart_command': + user_name => 'nagios', + collection => 'nrpe_needrestart_check', + command_line => '/usr/sbin/needrestart -p -l' + } + sunet::sudoer {'nagios_run_galera_command': + user_name => 'nagios', + collection => 'nrpe_galera_check', + command_line => '/usr/lib/nagios/plugins/check_galera_cluster -w 2 -c 1 -0' + } + sunet::nagios::nrpe_command {'check_galera_cluster': + command_line => '/usr/bin/sudo /usr/lib/nagios/plugins/check_galera_cluster -w 2 -c 1 -0' + } + sunet::sudoer {'nagios_run_proxysql_command': + user_name => 'nagios', + collection => 'nrpe_proxysql_check', + command_line => '/usr/lib/nagios/plugins/check_proxysql_server, /usr/lib/nagios/plugins/check_mysql_server_status' + } + sunet::nagios::nrpe_command {'check_proxysql_server': + command_line => '/usr/bin/sudo /usr/lib/nagios/plugins/check_proxysql_server' + } + sunet::sudoer {'nagios_run_replication_command': + user_name => 'nagios', + collection => 'nrpe_replication_check', + command_line => '/usr/local/bin/check_replication' + } + sunet::nagios::nrpe_command {'check_async_replication': + command_line => '/usr/bin/sudo /usr/local/bin/check_replication' + } + sunet::sudoer {'nagios_run_backup_command': + user_name => 'nagios', + collection => 'nrpe_backup_check', + command_line => '/usr/local/bin/check_backups' + } + sunet::nagios::nrpe_command {'check_backups': + command_line => '/usr/bin/sudo /usr/local/bin/check_backups' + } + sunet::nagios::nrpe_command {'check_mysql_server_status': + command_line => '/usr/bin/sudo /usr/lib/nagios/plugins/check_mysql_server_status' + } +}